From a53f96704015ad945e2b9ca861a1699c2f2aa4ba Mon Sep 17 00:00:00 2001 From: dead_horse Date: Thu, 27 Oct 2016 21:01:24 +0800 Subject: [PATCH] feat: update dist --- browser-build.js | 1 + dist/aliyun-oss-sdk.js | 31475 +++++++++++++++++++++++++++++++++++ dist/aliyun-oss-sdk.min.js | 16 + 3 files changed, 31492 insertions(+) diff --git a/browser-build.js b/browser-build.js index 2aae67bc9..5a2b914fb 100644 --- a/browser-build.js +++ b/browser-build.js @@ -28,6 +28,7 @@ function build(options, callback) { }; browserify(brOpts).add('./browser.js') .transform(babelify, { + "global": true, "presets": ["es2015"], "plugins": ["transform-runtime"] }).transform(aliasify, { diff --git a/dist/aliyun-oss-sdk.js b/dist/aliyun-oss-sdk.js index e69de29bb..903bdbf71 100644 --- a/dist/aliyun-oss-sdk.js +++ b/dist/aliyun-oss-sdk.js @@ -0,0 +1,31475 @@ +// Aliyun OSS SDK for JavaScript v4.6.0 +// Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved. +// License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OSS = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o' + region + ''; + } + params.successStatuses = [200]; + _context2.next = 5; + return this.request(params); + + case 5: + result = _context2.sent; + return _context2.abrupt('return', { + bucket: result.headers.location && result.headers.location.substring(1) || null, + res: result.res + }); + + case 7: + case 'end': + return _context2.stop(); + } + } + }, putBucket, this); +}); + +proto.deleteBucket = _regenerator2.default.mark(function deleteBucket(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function deleteBucket$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + params = this._bucketRequestParams('DELETE', name, '', options); + _context3.next = 3; + return this.request(params); + + case 3: + result = _context3.sent; + + if (!(result.status === 200 || result.status === 204)) { + _context3.next = 6; + break; + } + + return _context3.abrupt('return', { + res: result.res + }); + + case 6: + _context3.next = 8; + return this.requestError(result); + + case 8: + throw _context3.sent; + + case 9: + case 'end': + return _context3.stop(); + } + } + }, deleteBucket, this); +}); + +// acl + +proto.putBucketACL = _regenerator2.default.mark(function putBucketACL(name, region, acl, options) { + var params, result; + return _regenerator2.default.wrap(function putBucketACL$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + params = this._bucketRequestParams('PUT', name, 'acl', options); + + params.headers = { + 'x-oss-acl': acl + }; + params.successStatuses = [200]; + _context4.next = 5; + return this.request(params); + + case 5: + result = _context4.sent; + return _context4.abrupt('return', { + bucket: result.headers.location && result.headers.location.substring(1) || null, + res: result.res + }); + + case 7: + case 'end': + return _context4.stop(); + } + } + }, putBucketACL, this); +}); + +proto.getBucketACL = _regenerator2.default.mark(function getBucketACL(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function getBucketACL$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + params = this._bucketRequestParams('GET', name, 'acl', options); + + params.successStatuses = [200]; + params.xmlResponse = true; + _context5.next = 5; + return this.request(params); + + case 5: + result = _context5.sent; + return _context5.abrupt('return', { + acl: result.data.AccessControlList.Grant, + owner: { + id: result.data.Owner.ID, + displayName: result.data.Owner.DisplayName + }, + res: result.res + }); + + case 7: + case 'end': + return _context5.stop(); + } + } + }, getBucketACL, this); +}); + +// logging + +proto.putBucketLogging = _regenerator2.default.mark(function putBucketLogging(name, region, prefix, options) { + var params, xml, result; + return _regenerator2.default.wrap(function putBucketLogging$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + params = this._bucketRequestParams('PUT', name, 'logging', options); + xml = '\n\n' + '\n' + name + '\n'; + + if (prefix) { + xml += '' + prefix + '\n'; + } + xml += '\n'; + params.content = xml; + params.mime = 'xml'; + params.successStatuses = [200]; + _context6.next = 9; + return this.request(params); + + case 9: + result = _context6.sent; + return _context6.abrupt('return', { + res: result.res + }); + + case 11: + case 'end': + return _context6.stop(); + } + } + }, putBucketLogging, this); +}); + +proto.getBucketLogging = _regenerator2.default.mark(function getBucketLogging(name, region, options) { + var params, result, enable; + return _regenerator2.default.wrap(function getBucketLogging$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + params = this._bucketRequestParams('GET', name, 'logging', options); + + params.successStatuses = [200]; + params.xmlResponse = true; + _context7.next = 5; + return this.request(params); + + case 5: + result = _context7.sent; + enable = result.data.LoggingEnabled; + return _context7.abrupt('return', { + enable: !!enable, + prefix: enable && enable.TargetPrefix || null, + res: result.res + }); + + case 8: + case 'end': + return _context7.stop(); + } + } + }, getBucketLogging, this); +}); + +proto.deleteBucketLogging = _regenerator2.default.mark(function deleteBucketLogging(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function deleteBucketLogging$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + params = this._bucketRequestParams('DELETE', name, 'logging', options); + + params.successStatuses = [204, 200]; + _context8.next = 4; + return this.request(params); + + case 4: + result = _context8.sent; + return _context8.abrupt('return', { + res: result.res + }); + + case 6: + case 'end': + return _context8.stop(); + } + } + }, deleteBucketLogging, this); +}); + +// website + +proto.putBucketWebsite = _regenerator2.default.mark(function putBucketWebsite(name, region, config, options) { + var params, xml, result; + return _regenerator2.default.wrap(function putBucketWebsite$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + // config: index, [error] + params = this._bucketRequestParams('PUT', name, 'website', options); + + config = config || {}; + config.index = config.index || 'index.html'; + xml = '\n\n' + ' ' + config.index + '\n'; + + if (config.error) { + xml += '' + config.error + '\n'; + } + xml += ''; + params.content = xml; + params.mime = 'xml'; + params.successStatuses = [200]; + return _context9.delegateYield(this.request(params), 't0', 10); + + case 10: + result = _context9.t0; + return _context9.abrupt('return', { + res: result.res + }); + + case 12: + case 'end': + return _context9.stop(); + } + } + }, putBucketWebsite, this); +}); + +proto.getBucketWebsite = _regenerator2.default.mark(function getBucketWebsite(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function getBucketWebsite$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + params = this._bucketRequestParams('GET', name, 'website', options); + + params.successStatuses = [200]; + params.xmlResponse = true; + _context10.next = 5; + return this.request(params); + + case 5: + result = _context10.sent; + return _context10.abrupt('return', { + index: result.data.IndexDocument.Suffix, + error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null, + res: result.res + }); + + case 7: + case 'end': + return _context10.stop(); + } + } + }, getBucketWebsite, this); +}); + +proto.deleteBucketWebsite = _regenerator2.default.mark(function deleteBucketWebsite(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function deleteBucketWebsite$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + params = this._bucketRequestParams('DELETE', name, 'website', options); + + params.successStatuses = [204]; + _context11.next = 4; + return this.request(params); + + case 4: + result = _context11.sent; + return _context11.abrupt('return', { + res: result.res + }); + + case 6: + case 'end': + return _context11.stop(); + } + } + }, deleteBucketWebsite, this); +}); + +// lifecycle + +proto.putBucketLifecycle = _regenerator2.default.mark(function putBucketLifecycle(name, region, rules, options) { + var params, xml, i, rule, expiration, id, result; + return _regenerator2.default.wrap(function putBucketLifecycle$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + // rules: [rule, ...] + // rule: [id], prefix, status, expiration, [days or date] + // status: 'Enabled' or 'Disabled' + params = this._bucketRequestParams('PUT', name, 'lifecycle', options); + xml = '\n\n'; + + for (i = 0; i < rules.length; i++) { + rule = rules[i]; + expiration = rule.days ? '' + rule.days + '' : '' + rule.date + ''; + id = rule.id ? '' + rule.id + '\n' : ''; + + xml += ' \n' + id + ' ' + rule.prefix + '\n' + ' ' + rule.status + '\n' + ' ' + expiration + '\n' + ' \n'; + } + xml += ''; + params.content = xml; + params.mime = 'xml'; + params.successStatuses = [200]; + _context12.next = 9; + return this.request(params); + + case 9: + result = _context12.sent; + return _context12.abrupt('return', { + res: result.res + }); + + case 11: + case 'end': + return _context12.stop(); + } + } + }, putBucketLifecycle, this); +}); + +proto.getBucketLifecycle = _regenerator2.default.mark(function getBucketLifecycle(name, region, options) { + var params, result, rules; + return _regenerator2.default.wrap(function getBucketLifecycle$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + params = this._bucketRequestParams('GET', name, 'lifecycle', options); + + params.successStatuses = [200]; + params.xmlResponse = true; + _context13.next = 5; + return this.request(params); + + case 5: + result = _context13.sent; + rules = result.data.Rule || null; + + if (rules) { + if (!Array.isArray(rules)) { + rules = [rules]; + } + rules = rules.map(function (rule) { + var item = { + id: rule.ID, + prefix: rule.Prefix, + status: rule.Status + }; + if (rule.Expiration.Days) { + item.days = rule.Expiration.Days; + } else { + item.date = rule.Expiration.Date; + } + return item; + }); + } + return _context13.abrupt('return', { + rules: rules, + res: result.res + }); + + case 9: + case 'end': + return _context13.stop(); + } + } + }, getBucketLifecycle, this); +}); + +proto.deleteBucketLifecycle = _regenerator2.default.mark(function deleteBucketLifecycle(name, region, options) { + var params, result; + return _regenerator2.default.wrap(function deleteBucketLifecycle$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + params = this._bucketRequestParams('DELETE', name, 'lifecycle', options); + + params.successStatuses = [204]; + _context14.next = 4; + return this.request(params); + + case 4: + result = _context14.sent; + return _context14.abrupt('return', { + res: result.res + }); + + case 6: + case 'end': + return _context14.stop(); + } + } + }, deleteBucketLifecycle, this); +}); + +// referer + +proto.putBucketReferer = _regenerator2.default.mark(function putBucketReferer(name, region, allowEmpty, referers, options) { + var params, xml, i, result; + return _regenerator2.default.wrap(function putBucketReferer$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + params = this._bucketRequestParams('PUT', name, 'referer', options); + xml = '\n\n'; + + xml += ' ' + (allowEmpty ? 'true' : 'false') + '\n'; + if (referers && referers.length > 0) { + xml += ' \n'; + for (i = 0; i < referers.length; i++) { + xml += ' ' + referers[i] + '\n'; + } + xml += ' \n'; + } else { + xml += ' \n'; + } + xml += ''; + params.content = xml; + params.mime = 'xml'; + params.successStatuses = [200]; + _context15.next = 10; + return this.request(params); + + case 10: + result = _context15.sent; + return _context15.abrupt('return', { + res: result.res + }); + + case 12: + case 'end': + return _context15.stop(); + } + } + }, putBucketReferer, this); +}); + +proto.getBucketReferer = _regenerator2.default.mark(function getBucketReferer(name, region, options) { + var params, result, referers; + return _regenerator2.default.wrap(function getBucketReferer$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + params = this._bucketRequestParams('GET', name, 'referer', options); + + params.successStatuses = [200]; + params.xmlResponse = true; + _context16.next = 5; + return this.request(params); + + case 5: + result = _context16.sent; + referers = result.data.RefererList.Referer || null; + + if (referers) { + if (!Array.isArray(referers)) { + referers = [referers]; + } + } + return _context16.abrupt('return', { + allowEmpty: result.data.AllowEmptyReferer === 'true', + referers: referers, + res: result.res + }); + + case 9: + case 'end': + return _context16.stop(); + } + } + }, getBucketReferer, this); +}); + +proto.deleteBucketReferer = _regenerator2.default.mark(function deleteBucketReferer(name, region, options) { + return _regenerator2.default.wrap(function deleteBucketReferer$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + _context17.next = 2; + return this.putBucketReferer(name, region, true, null, options); + + case 2: + return _context17.abrupt('return', _context17.sent); + + case 3: + case 'end': + return _context17.stop(); + } + } + }, deleteBucketReferer, this); +}); + +// private apis + +proto._bucketRequestParams = function _bucketRequestParams(method, bucket, subres, options) { + return { + method: method, + bucket: bucket, + subres: subres, + timeout: options && options.timeout, + ctx: options && options.ctx + }; +}; + +},{"babel-runtime/regenerator":40}],3:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var debug = require('debug')('ali-oss'); +var crypto = require('./../shims/crypto.js'); +var path = require('path'); +var querystring = require('querystring'); +var copy = require('copy-to'); +var mime = require('mime'); +var xml = require('xml2js'); +var ms = require('humanize-ms'); +var AgentKeepalive = require('agentkeepalive'); +var merge = require('merge-descriptors'); +var urlutil = require('url'); +var is = require('is-type-of'); +var platform = require('platform'); +var utility = require('utility'); +var urllib = require('urllib'); +var pkg = require('../package.json'); +var dateFormat = require('dateformat'); + +var globalHttpAgent = new AgentKeepalive(); + +/** + * Expose `Client` + */ + +module.exports = Client; + +function Client(options, ctx) { + if (!(this instanceof Client)) { + return new Client(options, ctx); + } + + if (options && options.inited) { + this.options = options; + } else { + this.options = Client.initOptions(options); + } + + // support custom agent and urllib client + if (this.options.urllib) { + this.urllib = this.options.urllib; + } else { + this.urllib = urllib; + this.agent = this.options.agent || globalHttpAgent; + } + this.ctx = ctx; +} + +Client.initOptions = function initOptions(options) { + if (!options || !options.accessKeyId || !options.accessKeySecret) { + throw new Error('require accessKeyId, accessKeySecret'); + } + + var opts = { + region: 'oss-cn-hangzhou', + internal: false, + secure: false, + timeout: 60000, // 60s + bucket: null, + endpoint: null, + cname: false + }; + + for (var key in options) { + if (options[key] === undefined) continue; + opts[key] = options[key]; + } + opts.accessKeyId = opts.accessKeyId.trim(); + opts.accessKeySecret = opts.accessKeySecret.trim(); + + opts.timeout = ms(opts.timeout); + + if (opts.endpoint) { + opts.endpoint = setEndpoint(opts.endpoint); + } else if (opts.region) { + opts.endpoint = setRegion(opts.region, opts.internal, opts.secure); + } else { + throw new Error('require options.endpoint or options.region'); + } + + opts.inited = true; + return opts; +}; + +/** + * prototype + */ + +var proto = Client.prototype; + +/** + * Object operations + */ +merge(proto, require('./object')); +/** + * Bucket operations + */ +merge(proto, require('./bucket')); +/** + * Multipart operations + */ +merge(proto, require('./multipart')); + +/** + * ImageClient class + */ +Client.ImageClient = require('./image')(Client); +/** + * Cluster Client class + */ +Client.ClusterClient = require('./cluster')(Client); + +/** + * STS Client class + */ +Client.STS = require('./sts'); + +/** + * Aysnc wrapper + */ +Client.Wrapper = require('./wrapper'); + +/** + * get OSS signature + * @param {String} stringToSign + * @return {String} the signature + */ +proto.signature = function signature(stringToSign) { + debug('authorization stringToSign: %s', stringToSign); + + var signature = crypto.createHmac('sha1', this.options.accessKeySecret); + signature = signature.update(new Buffer(stringToSign, 'utf8')).digest('base64'); + + return signature; +}; + +/** + * get author header + * + * "Authorization: OSS " + Access Key Id + ":" + Signature + * + * Signature = base64(hmac-sha1(Access Key Secret + "\n" + * + VERB + "\n" + * + CONTENT-MD5 + "\n" + * + CONTENT-TYPE + "\n" + * + DATE + "\n" + * + CanonicalizedOSSHeaders + * + CanonicalizedResource)) + * + * @param {String} method + * @param {String} resource + * @param {Object} header + * @return {String} + * + * @api private + */ + +proto.authorization = function authorization(method, resource, subres, headers) { + var params = [method.toUpperCase(), headers['Content-Md5'] || '', getHeader(headers, 'Content-Type'), headers['x-oss-date']]; + + var ossHeaders = {}; + for (var key in headers) { + var lkey = key.toLowerCase().trim(); + if (lkey.indexOf('x-oss-') === 0) { + ossHeaders[lkey] = ossHeaders[lkey] || []; + ossHeaders[lkey].push(String(headers[key]).trim()); + } + } + + var ossHeadersList = []; + (0, _keys2.default)(ossHeaders).sort().forEach(function (key) { + ossHeadersList.push(key + ':' + ossHeaders[key].join(',')); + }); + + params = params.concat(ossHeadersList); + + var resourceStr = ''; + resourceStr += resource; + + var subresList = []; + if (subres) { + if (is.string(subres)) { + subresList.push(subres); + } else if (is.array(subres)) { + subresList = subresList.concat(subres); + } else { + for (var k in subres) { + var item = subres[k] ? k + '=' + subres[k] : k; + subresList.push(item); + } + } + } + + if (subresList.length > 0) { + resourceStr += '?' + subresList.join('&'); + } + params.push(resourceStr); + var stringToSign = params.join('\n'); + + var auth = 'OSS ' + this.options.accessKeyId + ':'; + return auth + this.signature(stringToSign); +}; + +/** + * create request params + * See `request` + * @api private + */ + +proto.createRequest = function createRequest(params) { + var userAgent = this._userAgent(); + + var headers = { + 'x-oss-date': dateFormat(new Date(), 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''), + 'x-oss-user-agent': userAgent, + 'User-Agent': userAgent + }; + + if (this.options.stsToken) { + headers['x-oss-security-token'] = this.options.stsToken; + } + + copy(params.headers).to(headers); + + if (!getHeader(headers, 'Content-Type')) { + if (params.mime === mime.default_type) { + params.mime = ''; + } + + if (params.mime && params.mime.indexOf('/') > 0) { + headers['Content-Type'] = params.mime; + } else { + headers['Content-Type'] = mime.lookup(params.mime || path.extname(params.object || '')); + } + } + + if (params.content) { + headers['Content-Md5'] = crypto.createHash('md5').update(new Buffer(params.content, 'utf8')).digest('base64'); + if (!headers['Content-Length']) { + headers['Content-Length'] = params.content.length; + } + } + + var authResource = this._getResource(params); + headers.authorization = this.authorization(params.method, authResource, params.subres, headers); + + var url = this._getReqUrl(params); + debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream); + var timeout = params.timeout || this.options.timeout; + var reqParams = { + agent: this.agent, + method: params.method, + content: params.content, + stream: params.stream, + headers: headers, + timeout: timeout, + writeStream: params.writeStream, + customResponse: params.customResponse, + ctx: params.ctx || this.ctx + }; + + return { + url: url, + params: reqParams + }; +}; + +/** + * request oss server + * @param {Object} params + * - {String} object + * - {String} bucket + * - {Object} [headers] + * - {Object} [query] + * - {Buffer} [content] + * - {Stream} [stream] + * - {Stream} [writeStream] + * - {String} [mime] + * - {Boolean} [xmlResponse] + * - {Boolean} [customResponse] + * - {Number} [timeout] + * - {Object} [ctx] request context, default is `this.ctx` + * + * @api private + */ + +proto.request = _regenerator2.default.mark(function request(params) { + var reqParams, result, err; + return _regenerator2.default.wrap(function request$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + reqParams = this.createRequest(params); + _context.next = 3; + return this.urllib.request(reqParams.url, reqParams.params); + + case 3: + result = _context.sent; + + debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers); + + if (!(params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) { + _context.next = 10; + break; + } + + return _context.delegateYield(this.requestError(result), 't0', 7); + + case 7: + err = _context.t0; + + err.params = params; + throw err; + + case 10: + if (!params.xmlResponse) { + _context.next = 14; + break; + } + + _context.next = 13; + return this.parseXML(result.data); + + case 13: + result.data = _context.sent; + + case 14: + return _context.abrupt('return', result); + + case 15: + case 'end': + return _context.stop(); + } + } + }, request, this); +}); + +proto._getResource = function _getResource(params) { + var resource = '/'; + if (params.bucket) resource += params.bucket + '/'; + if (params.object) resource += params.object; + + return resource; +}; + +proto._isIP = function _isIP(host) { + var ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/; + return ipv4Regex.test(host); +}; + +proto._escape = function _escape(name) { + return utility.encodeURIComponent(name).replace(/%2F/g, '/'); +}; + +proto._getReqUrl = function _getReqUrl(params) { + var ep = {}; + copy(this.options.endpoint).to(ep); + var isIP = this._isIP(ep.hostname); + var isCname = this.options.cname; + if (params.bucket && !isCname && !isIP) { + ep.host = params.bucket + '.' + ep.host; + } + + var path = '/'; + if (params.bucket && isIP) { + path += params.bucket + '/'; + } + + if (params.object) { + // Preserve '/' in result url + path += this._escape(params.object); + } + ep.pathname = path; + + var query = {}; + if (params.query) { + merge(query, params.query); + } + + if (params.subres) { + var subresAsQuery = {}; + if (is.string(params.subres)) { + subresAsQuery[params.subres] = ''; + } else if (is.array(params.subres)) { + params.subres.forEach(function (k) { + subresAsQuery[k] = ''; + }); + } else { + subresAsQuery = params.subres; + } + merge(query, subresAsQuery); + } + + ep.query = query; + + // As '%20' is not recognized by OSS server, we must convert it to '+'. + return urlutil.format(ep).replace(/%20/g, '+'); +}; + +/* + * Get User-Agent for browser & node.js + * @example + * aliyun-sdk-nodejs/4.1.2 Node.js 5.3.0 on Darwin 64-bit + * aliyun-sdk-js/4.1.2 Safari 9.0 on Apple iPhone(iOS 9.2.1) + * aliyun-sdk-js/4.1.2 Chrome 43.0.2357.134 32-bit on Windows Server 2008 R2 / 7 64-bit + */ + +proto._userAgent = function _userAgent() { + var agent = process && process.browser ? 'js' : 'nodejs'; + var sdk = 'aliyun-sdk-' + agent + '/' + pkg.version; + var plat = platform.description; + + return sdk + ' ' + plat; +}; + +/** + * thunkify xml.parseString + * @param {String|Buffer} str + * + * @api private + */ + +proto.parseXML = function parseXMLThunk(str) { + return function parseXML(done) { + if (Buffer.isBuffer(str)) { + str = str.toString(); + } + xml.parseString(str, { + explicitRoot: false, + explicitArray: false + }, done); + }; +}; + +/** + * generater a request error with request response + * @param {Object} result + * + * @api private + */ + +proto.requestError = _regenerator2.default.mark(function requestError(result) { + var err, message, info; + return _regenerator2.default.wrap(function requestError$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(!result.data || !result.data.length)) { + _context2.next = 6; + break; + } + + // HEAD not exists resource + if (result.status === 404) { + err = new Error('Object not exists'); + err.name = 'NoSuchKeyError'; + err.status = 404; + err.code = 'NoSuchKey'; + } else if (result.status === 412) { + err = new Error('Pre condition failed'); + err.name = 'PreconditionFailedError'; + err.status = 412; + err.code = 'PreconditionFailed'; + } else { + err = new Error('Unknow error, status: ' + result.status); + err.name = 'UnknowError'; + err.status = result.status; + } + err.requestId = result.headers['x-oss-request-id']; + err.host = ''; + _context2.next = 29; + break; + + case 6: + message = String(result.data); + + debug('request response error data: %s', message); + + _context2.prev = 8; + _context2.next = 11; + return this.parseXML(message) || {}; + + case 11: + info = _context2.sent; + _context2.next = 21; + break; + + case 14: + _context2.prev = 14; + _context2.t0 = _context2['catch'](8); + + debug(message); + _context2.t0.message += '\nraw xml: ' + message; + _context2.t0.status = result.status; + _context2.t0.requestId = result.headers['x-oss-request-id']; + return _context2.abrupt('return', _context2.t0); + + case 21: + message = info.Message || 'unknow request error, status: ' + result.status; + + if (info.Condition) { + message += ' (condition: ' + info.Condition + ')'; + } + err = new Error(message); + + err.name = info.Code ? info.Code + 'Error' : 'UnknowError'; + err.status = result.status; + err.code = info.Code; + err.requestId = info.RequestId; + err.hostId = info.HostId; + + case 29: + + debug('generate error %j', err); + return _context2.abrupt('return', err); + + case 31: + case 'end': + return _context2.stop(); + } + } + }, requestError, this, [[8, 14]]); +}); + +function getHeader(headers, name) { + return headers[name] || headers[name.toLowerCase()]; +} + +function setEndpoint(endpoint) { + var url = urlutil.parse(endpoint); + + if (!url.protocol) { + url = urlutil.parse('http://' + endpoint); + } + + if (url.protocol != 'http:' && url.protocol != 'https:') { + throw new Error('Endpoint protocol must be http or https.'); + } + + return url; +} + +function setRegion(region, internal, secure) { + var protocol = secure ? 'https://' : 'http://'; + var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com'; + + return urlutil.parse(protocol + region + suffix); +} + +}).call(this,require('_process'),require("buffer").Buffer) +},{"../package.json":419,"./../shims/crypto.js":420,"./bucket":2,"./cluster":4,"./image":5,"./multipart":6,"./object":7,"./sts":8,"./wrapper":9,"_process":345,"agentkeepalive":11,"babel-runtime/core-js/object/keys":30,"babel-runtime/regenerator":40,"buffer":45,"copy-to":54,"dateformat":183,"debug":184,"humanize-ms":196,"is-type-of":201,"merge-descriptors":335,"mime":336,"path":342,"platform":343,"querystring":349,"url":377,"urllib":379,"utility":395,"xml2js":400}],4:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var co = require('co'); +var defer = require('co-defer'); +var Base = require('sdk-base'); +var util = require('util'); +var utility = require('utility'); +var ready = require('get-ready'); +var copy = require('copy-to'); +var currentIP = require('address').ip(); + +var RR = 'roundRobin'; +var MS = 'masterSlave'; + +module.exports = function (OssClient) { + function Client(options) { + if (!(this instanceof Client)) { + return new Client(options); + } + + if (!options || !Array.isArray(options.cluster)) { + throw new Error('require options.cluster to be an array'); + } + + Base.call(this); + + this.clients = []; + this.availables = {}; + + for (var i = 0; i < options.cluster.length; i++) { + var opt = options.cluster[i]; + copy(options).pick('timeout', 'agent', 'urllib').to(opt); + this.clients.push(new OssClient(opt)); + this.availables[i] = true; + } + + this.schedule = options.schedule || RR; + this.index = 0; + + var heartbeatInterval = options.heartbeatInterval || 10000; + this._checkAvailableLock = false; + this._timerId = defer.setInterval(this._checkAvailable.bind(this, true), heartbeatInterval); + this._ignoreStatusFile = options.ignoreStatusFile || false; + this._init(); + } + + util.inherits(Client, Base); + var proto = Client.prototype; + ready.mixin(proto); + + var GET_METHODS = ['head', 'get', 'getStream', 'list']; + + var PUT_METHODS = ['put', 'putStream', 'delete', 'deleteMulti', 'copy', 'putMeta']; + + GET_METHODS.forEach(function (method) { + proto[method] = _regenerator2.default.mark(function _callee() { + var args, + client, + lastError, + i, + c, + _args = arguments; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + args = utility.argumentsToArray(_args); + client = this.chooseAvailable(); + _context.prev = 2; + _context.next = 5; + return client[method].apply(client, args); + + case 5: + return _context.abrupt('return', _context.sent); + + case 8: + _context.prev = 8; + _context.t0 = _context['catch'](2); + + if (!(_context.t0.status && _context.t0.status >= 200 && _context.t0.status < 500)) { + _context.next = 12; + break; + } + + throw _context.t0; + + case 12: + // < 200 || >= 500 need to retry from other cluser node + lastError = _context.t0; + + case 13: + i = 0; + + case 14: + if (!(i < this.clients.length)) { + _context.next = 32; + break; + } + + c = this.clients[i]; + + if (!(c === client)) { + _context.next = 18; + break; + } + + return _context.abrupt('continue', 29); + + case 18: + _context.prev = 18; + _context.next = 21; + return c[method].apply(client, args); + + case 21: + return _context.abrupt('return', _context.sent); + + case 24: + _context.prev = 24; + _context.t1 = _context['catch'](18); + + if (!(_context.t1.status && _context.t1.status >= 200 && _context.t1.status < 500)) { + _context.next = 28; + break; + } + + throw _context.t1; + + case 28: + // < 200 || >= 500 need to retry from other cluser node + lastError = _context.t1; + + case 29: + i++; + _context.next = 14; + break; + + case 32: + + lastError.message += ' (all clients are down)'; + throw lastError; + + case 34: + case 'end': + return _context.stop(); + } + } + }, _callee, this, [[2, 8], [18, 24]]); + }); + }); + + // must cluster node write success + PUT_METHODS.forEach(function (method) { + proto[method] = _regenerator2.default.mark(function _callee2() { + var args, + res, + _args2 = arguments; + return _regenerator2.default.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + args = utility.argumentsToArray(_args2); + _context2.next = 3; + return this.clients.map(function (client) { + return client[method].apply(client, args); + }); + + case 3: + res = _context2.sent; + return _context2.abrupt('return', res[0]); + + case 5: + case 'end': + return _context2.stop(); + } + } + }, _callee2, this); + }); + }); + + proto.signatureUrl = function signatureUrl() /* name */{ + var args = utility.argumentsToArray(arguments); + var client = this.chooseAvailable(); + return client.signatureUrl.apply(client, args); + }; + + proto.getObjectUrl = function getObjectUrl() /* name, baseUrl */{ + var args = utility.argumentsToArray(arguments); + var client = this.chooseAvailable(); + return client.getObjectUrl.apply(client, args); + }; + + proto._init = function _init() { + var that = this; + co(_regenerator2.default.mark(function _callee3() { + return _regenerator2.default.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return that._checkAvailable(that._ignoreStatusFile); + + case 2: + that.ready(true); + + case 3: + case 'end': + return _context3.stop(); + } + } + }, _callee3, this); + })).catch(function (err) { + that.emit('error', err); + }); + }; + + proto._checkAvailable = _regenerator2.default.mark(function _checkAvailable(ignoreStatusFile) { + var name, downStatusFiles, i, client, available, err; + return _regenerator2.default.wrap(function _checkAvailable$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + name = '._ali-oss/check.status.' + currentIP + '.txt'; + + if (ignoreStatusFile) { + _context4.next = 4; + break; + } + + _context4.next = 4; + return this.put(name, new Buffer('check available started at ' + Date())); + + case 4: + if (!this._checkAvailableLock) { + _context4.next = 6; + break; + } + + return _context4.abrupt('return'); + + case 6: + this._checkAvailableLock = true; + downStatusFiles = []; + i = 0; + + case 9: + if (!(i < this.clients.length)) { + _context4.next = 27; + break; + } + + client = this.clients[i]; + // check 3 times + + _context4.next = 13; + return this._checkStatus(client, name); + + case 13: + available = _context4.sent; + + if (available) { + _context4.next = 18; + break; + } + + _context4.next = 17; + return this._checkStatus(client, name); + + case 17: + available = _context4.sent; + + case 18: + if (available) { + _context4.next = 23; + break; + } + + _context4.next = 21; + return this._checkStatus(client, name); + + case 21: + available = _context4.sent; + + if (!available) { + downStatusFiles.push(client._objectUrl(name)); + } + + case 23: + this.availables[i] = available; + + case 24: + i++; + _context4.next = 9; + break; + + case 27: + this._checkAvailableLock = false; + + if (downStatusFiles.length > 0) { + err = new Error(downStatusFiles.length + ' data node down, please check status file: ' + downStatusFiles.join(', ')); + + err.name = 'CheckAvailableError'; + this.emit('error', err); + } + + case 29: + case 'end': + return _context4.stop(); + } + } + }, _checkAvailable, this); + }); + + proto._checkStatus = _regenerator2.default.mark(function _checkStatus(client, name) { + var available; + return _regenerator2.default.wrap(function _checkStatus$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + available = true; + _context5.prev = 1; + _context5.next = 4; + return client.head(name); + + case 4: + _context5.next = 9; + break; + + case 6: + _context5.prev = 6; + _context5.t0 = _context5['catch'](1); + + // 404 will be available too + if (!_context5.t0.status || _context5.t0.status >= 500 || _context5.t0.status < 200) { + available = false; + } + + case 9: + return _context5.abrupt('return', available); + + case 10: + case 'end': + return _context5.stop(); + } + } + }, _checkStatus, this, [[1, 6]]); + }); + + proto.chooseAvailable = function chooseAvailable() { + if (this.schedule === MS) { + for (var i = 0; i < this.clients.length; i++) { + if (this.availables[i]) { + return this.clients[i]; + } + } + // all down, try to use this first one + return this.clients[0]; + } + + // RR + var n = this.clients.length; + while (n > 0) { + var i = this._nextRRIndex(); + if (this.availables[i]) { + return this.clients[i]; + } + n--; + } + // all down, try to use this first one + return this.clients[0]; + }; + + proto._nextRRIndex = function _nextRRIndex() { + var index = this.index++; + if (this.index >= this.clients.length) { + this.index = 0; + } + return index; + }; + + proto.close = function close() { + clearInterval(this._timerId); + this._timerId = null; + }; + + return Client; +}; + +}).call(this,require("buffer").Buffer) +},{"address":10,"babel-runtime/regenerator":40,"buffer":45,"co":51,"co-defer":48,"copy-to":54,"get-ready":194,"sdk-base":365,"util":384,"utility":395}],5:[function(require,module,exports){ +'use strict'; + +/* istanbul ignore next */ + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = function (OssClient) { + + function ImageClient(options) { + if (!(this instanceof ImageClient)) { + return new ImageClient(options); + } + if (!options.bucket) { + throw new Error('require bucket for image service instance'); + } + if (!options.imageHost) { + throw new Error('require imageHost for image service instance'); + } + + this.ossClient = new OssClient(options); + this.ossClient.options.imageHost = options.imageHost; + this.ossClient._objectRequestParams = objectRequestParams; + } + + /** + * Image operations + */ + + ImageClient.prototype.get = _regenerator2.default.mark(function get(name, file, options) { + return _regenerator2.default.wrap(function get$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this.ossClient.get(name, file, options); + + case 2: + return _context.abrupt('return', _context.sent); + + case 3: + case 'end': + return _context.stop(); + } + } + }, get, this); + }); + + ImageClient.prototype.getStream = _regenerator2.default.mark(function getStream(name, options) { + return _regenerator2.default.wrap(function getStream$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this.ossClient.getStream(name, options); + + case 2: + return _context2.abrupt('return', _context2.sent); + + case 3: + case 'end': + return _context2.stop(); + } + } + }, getStream, this); + }); + + ImageClient.prototype.getExif = _regenerator2.default.mark(function getExif(name, options) { + var params, result; + return _regenerator2.default.wrap(function getExif$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + params = this.ossClient._objectRequestParams('GET', name + '@exif', options); + + params.successStatuses = [200]; + + _context3.next = 4; + return this.ossClient.request(params); + + case 4: + result = _context3.sent; + _context3.next = 7; + return this._parseResponse(result); + + case 7: + result = _context3.sent; + return _context3.abrupt('return', { + res: result.res, + data: result.data + }); + + case 9: + case 'end': + return _context3.stop(); + } + } + }, getExif, this); + }); + + ImageClient.prototype.getInfo = _regenerator2.default.mark(function getInfo(name, options) { + var params, result; + return _regenerator2.default.wrap(function getInfo$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + params = this.ossClient._objectRequestParams('GET', name + '@infoexif', options); + + params.successStatuses = [200]; + + _context4.next = 4; + return this.ossClient.request(params); + + case 4: + result = _context4.sent; + _context4.next = 7; + return this._parseResponse(result); + + case 7: + result = _context4.sent; + return _context4.abrupt('return', { + res: result.res, + data: result.data + }); + + case 9: + case 'end': + return _context4.stop(); + } + } + }, getInfo, this); + }); + + ImageClient.prototype.putStyle = _regenerator2.default.mark(function putStyle(styleName, style, options) { + var params, result; + return _regenerator2.default.wrap(function putStyle$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + params = this.ossClient._objectRequestParams('PUT', '/?style&styleName=' + styleName, options); + + params.successStatuses = [200]; + params.content = '\n' + ''; + + _context5.next = 5; + return this.ossClient.request(params); + + case 5: + result = _context5.sent; + _context5.next = 8; + return this._parseResponse(result); + + case 8: + result = _context5.sent; + return _context5.abrupt('return', { + res: result.res, + data: result.data + }); + + case 10: + case 'end': + return _context5.stop(); + } + } + }, putStyle, this); + }); + + ImageClient.prototype.getStyle = _regenerator2.default.mark(function getStyle(styleName, options) { + var params, result; + return _regenerator2.default.wrap(function getStyle$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + params = this.ossClient._objectRequestParams('GET', '/?style&styleName=' + styleName, options); + + params.successStatuses = [200]; + + _context6.next = 4; + return this.ossClient.request(params); + + case 4: + result = _context6.sent; + _context6.next = 7; + return this._parseResponse(result); + + case 7: + result = _context6.sent; + return _context6.abrupt('return', { + res: result.res, + data: result.data + }); + + case 9: + case 'end': + return _context6.stop(); + } + } + }, getStyle, this); + }); + + ImageClient.prototype.listStyle = _regenerator2.default.mark(function listStyle(options) { + var params, result; + return _regenerator2.default.wrap(function listStyle$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + params = this.ossClient._objectRequestParams('GET', '/?style', options); + + params.successStatuses = [200]; + + _context7.next = 4; + return this.ossClient.request(params); + + case 4: + result = _context7.sent; + _context7.next = 7; + return this._parseResponse(result); + + case 7: + result = _context7.sent; + return _context7.abrupt('return', { + res: result.res, + data: result.data.Style + }); + + case 9: + case 'end': + return _context7.stop(); + } + } + }, listStyle, this); + }); + + ImageClient.prototype.deleteStyle = _regenerator2.default.mark(function deleteStyle(styleName, options) { + var params, result; + return _regenerator2.default.wrap(function deleteStyle$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + params = this.ossClient._objectRequestParams('DELETE', '/?style&styleName=' + styleName, options); + + params.successStatuses = [204]; + + _context8.next = 4; + return this.ossClient.request(params); + + case 4: + result = _context8.sent; + return _context8.abrupt('return', { + res: result.res + }); + + case 6: + case 'end': + return _context8.stop(); + } + } + }, deleteStyle, this); + }); + + ImageClient.prototype.signatureUrl = function signatureUrl(name) { + return this.ossClient.signatureUrl(name, this.ossClient.options.imageHost); + }; + + ImageClient.prototype._parseResponse = _regenerator2.default.mark(function _parseResponse(result) { + var str, type, data, key; + return _regenerator2.default.wrap(function _parseResponse$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + str = result.data.toString(); + type = result.res.headers['content-type']; + + if (!(type === 'application/json')) { + _context9.next = 8; + break; + } + + data = JSON.parse(str); + + result.data = {}; + for (key in data) { + result.data[key] = parseFloat(data[key].value, 10) || data[key].value; + } + _context9.next = 12; + break; + + case 8: + if (!(type === 'application/xml')) { + _context9.next = 12; + break; + } + + _context9.next = 11; + return this.ossClient.parseXML(str); + + case 11: + result.data = _context9.sent; + + case 12: + return _context9.abrupt('return', result); + + case 13: + case 'end': + return _context9.stop(); + } + } + }, _parseResponse, this); + }); + + return ImageClient; +}; + +/* istanbul ignore next */ +function objectRequestParams(method, name, options) { + options = options || {}; + name = this._objectName(name); + var authResource = '/' + this.options.bucket + '/' + name; + var params = { + name: name, + method: method, + host: this.options.imageHost, + resource: '/' + name, + timeout: options.timeout, + authResource: authResource, + ctx: options.ctx + }; + + if (options.headers) { + params.headers = options.headers; + } + return params; +} + +},{"babel-runtime/regenerator":40}],6:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var _from = require('babel-runtime/core-js/array/from'); + +var _from2 = _interopRequireDefault(_from); + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var debug = require('debug')('ali-oss:multipart'); +var fs = require('fs'); +var is = require('is-type-of'); +var destroy = require('destroy'); +var eoe = require('end-or-error'); +var util = require('util'); +var path = require('path'); +var mime = require('mime'); +var gather = require('co-gather'); + +var proto = exports; + +/** + * Multipart operations + */ + +/** + * Upload an file to OSS using multipart uploads + * @param {String} name + * @param {String|File} file + * @param {Object} options + */ +proto.multipartUpload = _regenerator2.default.mark(function multipartUpload(name, file, options) { + var minPartSize, filename, fileSize, stream, ret, result, uploadId, partSize, checkpoint; + return _regenerator2.default.wrap(function multipartUpload$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + options = options || {}; + + if (!(options.checkpoint && options.checkpoint.uploadId)) { + _context.next = 5; + break; + } + + _context.next = 4; + return this._resumeMultipart(options.checkpoint, options); + + case 4: + return _context.abrupt('return', _context.sent); + + case 5: + minPartSize = 100 * 1024; + filename = is.file(file) ? file.name : file; + + options.mime = options.mime || mime.lookup(path.extname(filename)); + options.headers = options.headers || {}; + this._convertMetaToHeaders(options.meta, options.headers); + + _context.next = 12; + return this._getFileSize(file); + + case 12: + fileSize = _context.sent; + + if (!(fileSize < minPartSize)) { + _context.next = 23; + break; + } + + stream = this._createStream(file, 0, fileSize); + + options.contentLength = fileSize; + + _context.next = 18; + return this.putStream(name, stream, options); + + case 18: + ret = _context.sent; + + if (!(options && options.progress)) { + _context.next = 22; + break; + } + + _context.next = 22; + return options.progress(1); + + case 22: + return _context.abrupt('return', ret); + + case 23: + if (!(options.partSize && options.partSize < minPartSize)) { + _context.next = 25; + break; + } + + throw new Error('partSize must not be smaller than ' + minPartSize); + + case 25: + _context.next = 27; + return this._initMultipartUpload(name, options); + + case 27: + result = _context.sent; + uploadId = result.uploadId; + partSize = this._getPartSize(fileSize, options.partSize); + checkpoint = { + file: file, + name: name, + fileSize: fileSize, + partSize: partSize, + uploadId: uploadId, + doneParts: [] + }; + _context.next = 33; + return this._resumeMultipart(checkpoint, options); + + case 33: + return _context.abrupt('return', _context.sent); + + case 34: + case 'end': + return _context.stop(); + } + } + }, multipartUpload, this); +}); + +/* + * Resume multipart upload from checkpoint. The checkpoint will be + * updated after each successful part upload. + * @param {Object} checkpoint the checkpoint + * @param {Object} options + */ +proto._resumeMultipart = _regenerator2.default.mark(function _resumeMultipart(checkpoint, options) { + var file, fileSize, partSize, uploadId, doneParts, name, partOffs, numParts, uploadPartJob, all, done, todo, jobs, i, defaultParallel, parallel, results; + return _regenerator2.default.wrap(function _resumeMultipart$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + file = checkpoint.file; + fileSize = checkpoint.fileSize; + partSize = checkpoint.partSize; + uploadId = checkpoint.uploadId; + doneParts = checkpoint.doneParts; + name = checkpoint.name; + partOffs = this._divideParts(fileSize, partSize); + numParts = partOffs.length; + uploadPartJob = _regenerator2.default.mark(function uploadPartJob(self, partNo) { + var pi, data, result; + return _regenerator2.default.wrap(function uploadPartJob$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + pi = partOffs[partNo - 1]; + data = { + stream: self._createStream(file, pi.start, pi.end), + size: pi.end - pi.start + }; + _context2.next = 4; + return self._uploadPart(name, uploadId, partNo, data); + + case 4: + result = _context2.sent; + + + doneParts.push({ + number: partNo, + etag: result.res.headers.etag + }); + checkpoint.doneParts = doneParts; + + if (!(options && options.progress)) { + _context2.next = 10; + break; + } + + _context2.next = 10; + return options.progress(doneParts.length / numParts, checkpoint); + + case 10: + case 'end': + return _context2.stop(); + } + } + }, uploadPartJob, this); + }); + all = (0, _from2.default)(new Array(numParts), function (x, i) { + return i + 1; + }); + done = doneParts.map(function (p) { + return p.number; + }); + todo = all.filter(function (p) { + return done.indexOf(p) < 0; + }); + jobs = []; + + for (i = 0; i < todo.length; i++) { + jobs.push(uploadPartJob(this, todo[i])); + } + + defaultParallel = 5; + parallel = options.parallel || defaultParallel; + + // yield in parallel + + _context3.next = 18; + return gather(jobs, parallel); + + case 18: + results = _context3.sent; + i = 0; + + case 20: + if (!(i < results.length)) { + _context3.next = 26; + break; + } + + if (!results[i].isError) { + _context3.next = 23; + break; + } + + throw new Error('Failed to upload some parts with error: ' + results[i].error.toString()); + + case 23: + i++; + _context3.next = 20; + break; + + case 26: + _context3.next = 28; + return this._completeMultipartUpload(name, uploadId, doneParts, options); + + case 28: + return _context3.abrupt('return', _context3.sent); + + case 29: + case 'end': + return _context3.stop(); + } + } + }, _resumeMultipart, this); +}); + +/** + * List the on-going multipart uploads + * @param {Object} options + * @return {Array} the multipart uploads + */ +proto.listUploads = _regenerator2.default.mark(function listUploads(query, options) { + var params, result, uploads; + return _regenerator2.default.wrap(function listUploads$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + options = options || {}; + options.subres = 'uploads'; + params = this._objectRequestParams('GET', '', options); + + params.query = query; + params.xmlResponse = true; + params.successStatuses = [200]; + + _context4.next = 8; + return this.request(params); + + case 8: + result = _context4.sent; + uploads = result.data.Upload || []; + + if (!Array.isArray(uploads)) { + uploads = [uploads]; + } + uploads = uploads.map(function (up) { + return { + name: up.Key, + uploadId: up.UploadId, + initiated: up.Initiated + }; + }); + + return _context4.abrupt('return', { + res: result.res, + uploads: uploads, + bucket: result.data.Bucket, + nextKeyMarker: result.data.NextKeyMarker, + nextUploadIdMarker: result.data.NextUploadIdMarker, + isTruncated: result.data.IsTruncated === 'true' + }); + + case 13: + case 'end': + return _context4.stop(); + } + } + }, listUploads, this); +}); + +/** + * Abort a multipart upload transaction + * @param {String} name the object name + * @param {String} uploadId the upload id + * @param {Object} options + */ +proto.abortMultipartUpload = _regenerator2.default.mark(function abortMultipartUpload(name, uploadId, options) { + var params, result; + return _regenerator2.default.wrap(function abortMultipartUpload$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + options = options || {}; + options.subres = { uploadId: uploadId }; + params = this._objectRequestParams('DELETE', name, options); + + params.successStatuses = [204]; + + _context5.next = 6; + return this.request(params); + + case 6: + result = _context5.sent; + return _context5.abrupt('return', { + res: result.res + }); + + case 8: + case 'end': + return _context5.stop(); + } + } + }, abortMultipartUpload, this); +}); + +/** + * Initiate a multipart upload transaction + * @param {String} name the object name + * @param {Object} options + * @return {String} upload id + */ +proto._initMultipartUpload = _regenerator2.default.mark(function _initMultipartUpload(name, options) { + var params, result; + return _regenerator2.default.wrap(function _initMultipartUpload$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + options = options || {}; + options.headers = options.headers || {}; + this._convertMetaToHeaders(options.meta, options.headers); + + options.subres = 'uploads'; + params = this._objectRequestParams('POST', name, options); + + params.mime = options.mime; + params.xmlResponse = true; + params.successStatuses = [200]; + + _context6.next = 10; + return this.request(params); + + case 10: + result = _context6.sent; + return _context6.abrupt('return', { + res: result.res, + bucket: result.data.Bucket, + name: result.data.Key, + uploadId: result.data.UploadId + }); + + case 12: + case 'end': + return _context6.stop(); + } + } + }, _initMultipartUpload, this); +}); + +/** + * Upload a part in a multipart upload transaction + * @param {String} name the object name + * @param {String} uploadId the upload id + * @param {Integer} partNo the part number + * @param {Object} data the body data + * @param {Object} options + */ +proto._uploadPart = _regenerator2.default.mark(function _uploadPart(name, uploadId, partNo, data, options) { + var params, result; + return _regenerator2.default.wrap(function _uploadPart$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + options = options || {}; + options.headers = { + 'Content-Length': data.size + }; + + options.subres = { + partNumber: partNo, + uploadId: uploadId + }; + params = this._objectRequestParams('PUT', name, options); + + params.mime = options.mime; + params.stream = data.stream; + params.successStatuses = [200]; + + _context7.next = 9; + return this.request(params); + + case 9: + result = _context7.sent; + return _context7.abrupt('return', { + name: name, + etag: result.res.headers.etag, + res: result.res + }); + + case 11: + case 'end': + return _context7.stop(); + } + } + }, _uploadPart, this); +}); + +/** + * Complete a multipart upload transaction + * @param {String} name the object name + * @param {String} uploadId the upload id + * @param {Array} parts the uploaded parts + * @param {Object} options + */ +proto._completeMultipartUpload = _regenerator2.default.mark(function _completeMultipartUpload(name, uploadId, parts, options) { + var xml, i, p, params, result, ret; + return _regenerator2.default.wrap(function _completeMultipartUpload$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + parts.sort(function (a, b) { + return a.number - b.number; + }); + xml = '\n\n'; + + for (i = 0; i < parts.length; i++) { + p = parts[i]; + + xml += '\n'; + xml += '' + p.number + '\n'; + xml += '' + p.etag + '\n'; + xml += '\n'; + } + xml += ''; + + options = options || {}; + options.subres = { uploadId: uploadId }; + params = this._objectRequestParams('POST', name, options); + + params.mime = 'xml'; + params.content = xml; + if (!(options.headers && options.headers['x-oss-callback'])) { + params.xmlResponse = true; + } + params.successStatuses = [200]; + _context8.next = 13; + return this.request(params); + + case 13: + result = _context8.sent; + ret = { + res: result.res, + bucket: params.bucket, + name: name, + etag: result.res.headers['etag'] + }; + + + if (options.headers && options.headers['x-oss-callback']) { + ret.data = JSON.parse(result.data.toString()); + } + + return _context8.abrupt('return', ret); + + case 17: + case 'end': + return _context8.stop(); + } + } + }, _completeMultipartUpload, this); +}); + +is.file = function (file) { + return typeof File !== 'undefined' && file instanceof File; +}; + +/** + * Get file size + */ +proto._getFileSize = _regenerator2.default.mark(function _getFileSize(file) { + var stat; + return _regenerator2.default.wrap(function _getFileSize$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + if (!is.buffer(file)) { + _context9.next = 4; + break; + } + + return _context9.abrupt('return', file.length); + + case 4: + if (!is.file(file)) { + _context9.next = 6; + break; + } + + return _context9.abrupt('return', file.size); + + case 6: + if (!is.string(file)) { + _context9.next = 11; + break; + } + + _context9.next = 9; + return this._statFile(file); + + case 9: + stat = _context9.sent; + return _context9.abrupt('return', stat.size); + + case 11: + throw new Error('_getFileSize requires Buffer/File/String.'); + + case 12: + case 'end': + return _context9.stop(); + } + } + }, _getFileSize, this); +}); + +/* + * Readable stream for Web File + */ +var Readable = require('stream').Readable; + +function WebFileReadStream(file, options) { + if (!(this instanceof WebFileReadStream)) { + return new WebFileReadStream(file, options); + } + + Readable.call(this, options); + + this.file = file; + this.reader = null; +}; +util.inherits(WebFileReadStream, Readable); + +WebFileReadStream.prototype._read = function _read() { + if (!this.reader) { + var that = this; + that.reader = new FileReader(); + that.reader.onload = function (e) { + that.push(new Buffer(new Uint8Array(e.target.result))); + that.push(null); + }; + that.reader.readAsArrayBuffer(that.file); + } +}; + +proto._createStream = function _createStream(file, start, end) { + if (is.file(file)) { + return new WebFileReadStream(file.slice(start, end)); + } else if (is.string(file)) { + return fs.createReadStream(file, { + start: start, + end: end - 1 + }); + } else { + throw new Error('_createStream requires File/String.'); + } +}; + +proto._getPartSize = function _getPartSize(fileSize, partSize) { + var maxNumParts = 10 * 1000; + var defaultPartSize = 1 * 1024 * 1024; + + if (!partSize) { + return defaultPartSize; + } + + return Math.max(Math.ceil(fileSize / maxNumParts), partSize); +}; + +proto._divideParts = function _divideParts(fileSize, partSize) { + var numParts = Math.ceil(fileSize / partSize); + + var partOffs = []; + for (var i = 0; i < numParts; i++) { + var start = partSize * i; + var end = Math.min(start + partSize, fileSize); + + partOffs.push({ + start: start, + end: end + }); + } + + return partOffs; +}; + +}).call(this,require("buffer").Buffer) +},{"babel-runtime/core-js/array/from":15,"babel-runtime/regenerator":40,"buffer":45,"co-gather":49,"debug":184,"destroy":187,"end-or-error":191,"fs":43,"is-type-of":201,"mime":336,"path":342,"stream":369,"util":384}],7:[function(require,module,exports){ +'use strict'; + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var debug = require('debug')('ali-oss:object'); +var utility = require('utility'); +var crypto = require('./../shims/crypto.js'); +var fs = require('fs'); +var is = require('is-type-of'); +var destroy = require('destroy'); +var eoe = require('end-or-error'); +var urlutil = require('url'); +var copy = require('copy-to'); +var querystring = require('querystring'); +var path = require('path'); +var mime = require('mime'); + +var proto = exports; + +/** + * Object operations + */ + +/** + * put an object from String(file path)/Buffer/ReadableStream + * @param {String} name the object key + * @param {Mixed} file String(file path)/Buffer/ReadableStream + * @param {Object} options + * @return {Object} + */ +proto.put = _regenerator2.default.mark(function put(name, file, options) { + var content, stream, params, result, ret; + return _regenerator2.default.wrap(function put$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + + options = options || {}; + + if (!is.buffer(file)) { + _context.next = 5; + break; + } + + content = file; + _context.next = 23; + break; + + case 5: + if (!is.string(file)) { + _context.next = 16; + break; + } + + options.mime = options.mime || mime.lookup(path.extname(file)); + stream = fs.createReadStream(file); + _context.next = 10; + return this._getFileSize(file); + + case 10: + options.contentLength = _context.sent; + _context.next = 13; + return this.putStream(name, stream, options); + + case 13: + return _context.abrupt('return', _context.sent); + + case 16: + if (!is.readableStream(file)) { + _context.next = 22; + break; + } + + _context.next = 19; + return this.putStream(name, file, options); + + case 19: + return _context.abrupt('return', _context.sent); + + case 22: + throw new TypeError('Must provide String/Buffer/ReadableStream for put.'); + + case 23: + + options.headers = options.headers || {}; + this._convertMetaToHeaders(options.meta, options.headers); + + params = this._objectRequestParams('PUT', name, options); + + params.mime = options.mime; + params.content = content; + params.successStatuses = [200]; + + _context.next = 31; + return this.request(params); + + case 31: + result = _context.sent; + ret = { + name: name, + url: this._objectUrl(name), + res: result.res + }; + + + if (options.headers && options.headers['x-oss-callback']) { + ret.data = JSON.parse(result.data.toString()); + } + + return _context.abrupt('return', ret); + + case 35: + case 'end': + return _context.stop(); + } + } + }, put, this); +}); + +/** + * put an object from ReadableStream. If `options.contentLength` is + * not provided, chunked encoding is used. + * @param {String} name the object key + * @param {Readable} stream the ReadableStream + * @param {Object} options + * @return {Object} + */ +proto.putStream = _regenerator2.default.mark(function putStream(name, stream, options) { + var params, result, ret; + return _regenerator2.default.wrap(function putStream$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + options = options || {}; + options.headers = options.headers || {}; + if (options.contentLength) { + options.headers['Content-Length'] = options.contentLength; + } else { + options.headers['Transfer-Encoding'] = 'chunked'; + } + this._convertMetaToHeaders(options.meta, options.headers); + params = this._objectRequestParams('PUT', name, options); + + + params.mime = options.mime; + params.stream = stream; + params.successStatuses = [200]; + + _context2.next = 10; + return this.request(params); + + case 10: + result = _context2.sent; + ret = { + name: name, + url: this._objectUrl(name), + res: result.res + }; + + + if (options.headers && options.headers['x-oss-callback']) { + ret.data = JSON.parse(result.data.toString()); + } + + return _context2.abrupt('return', ret); + + case 14: + case 'end': + return _context2.stop(); + } + } + }, putStream, this); +}); + +proto.head = _regenerator2.default.mark(function head(name, options) { + var params, result, data, k; + return _regenerator2.default.wrap(function head$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + params = this._objectRequestParams('HEAD', name, options); + + params.successStatuses = [200, 304]; + + _context3.next = 4; + return this.request(params); + + case 4: + result = _context3.sent; + data = { + meta: null, + res: result.res, + status: result.status + }; + + + if (result.status === 200) { + for (k in result.headers) { + if (k.indexOf('x-oss-meta-') === 0) { + if (!data.meta) { + data.meta = {}; + } + data.meta[k.substring(11)] = result.headers[k]; + } + } + } + return _context3.abrupt('return', data); + + case 8: + case 'end': + return _context3.stop(); + } + } + }, head, this); +}); + +proto.get = _regenerator2.default.mark(function get(name, file, options) { + var writeStream, needDestroy, result, params; + return _regenerator2.default.wrap(function get$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + writeStream = null; + needDestroy = false; + + + if (is.writableStream(file)) { + writeStream = file; + } else if (is.string(file)) { + writeStream = fs.createWriteStream(file); + needDestroy = true; + } else { + // get(name, options) + options = file; + } + + options = options || {}; + _context4.prev = 4; + params = this._objectRequestParams('GET', name, options); + + params.writeStream = writeStream; + params.successStatuses = [200, 206, 304]; + + _context4.next = 10; + return this.request(params); + + case 10: + result = _context4.sent; + + + if (needDestroy) { + writeStream.destroy(); + } + _context4.next = 22; + break; + + case 14: + _context4.prev = 14; + _context4.t0 = _context4['catch'](4); + + if (!needDestroy) { + _context4.next = 21; + break; + } + + writeStream.destroy(); + // should delete the exists file before throw error + debug('get error: %s, delete the exists file %s', _context4.t0, file); + _context4.next = 21; + return this._deleteFileSafe(file); + + case 21: + throw _context4.t0; + + case 22: + return _context4.abrupt('return', { + res: result.res, + content: result.data + }); + + case 23: + case 'end': + return _context4.stop(); + } + } + }, get, this, [[4, 14]]); +}); + +proto.getStream = _regenerator2.default.mark(function getStream(name, options) { + var params, result; + return _regenerator2.default.wrap(function getStream$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + options = options || {}; + params = this._objectRequestParams('GET', name, options); + + params.customResponse = true; + params.successStatuses = [200, 206, 304]; + + _context5.next = 6; + return this.request(params); + + case 6: + result = _context5.sent; + return _context5.abrupt('return', { + stream: result.res, + res: { + status: result.status, + headers: result.headers + } + }); + + case 8: + case 'end': + return _context5.stop(); + } + } + }, getStream, this); +}); + +proto.delete = _regenerator2.default.mark(function _delete(name, options) { + var params, result; + return _regenerator2.default.wrap(function _delete$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + params = this._objectRequestParams('DELETE', name, options); + + params.successStatuses = [204]; + + _context6.next = 4; + return this.request(params); + + case 4: + result = _context6.sent; + return _context6.abrupt('return', { + res: result.res + }); + + case 6: + case 'end': + return _context6.stop(); + } + } + }, _delete, this); +}); + +proto.deleteMulti = _regenerator2.default.mark(function deleteMulti(names, options) { + var xml, i, params, result, r, deleted; + return _regenerator2.default.wrap(function deleteMulti$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + options = options || {}; + xml = '\n\n'; + + if (options.quiet) { + xml += ' true\n'; + } else { + xml += ' false\n'; + } + for (i = 0; i < names.length; i++) { + xml += ' ' + utility.escape(this._objectName(names[i])) + '\n'; + } + xml += ''; + debug('delete multi objects: %s', xml); + + options.subres = 'delete'; + params = this._objectRequestParams('POST', '', options); + + params.mime = 'xml'; + params.content = xml; + params.xmlResponse = true; + params.successStatuses = [200]; + _context7.next = 14; + return this.request(params); + + case 14: + result = _context7.sent; + r = result.data; + deleted = r && r.Deleted || null; + + if (deleted) { + if (!Array.isArray(deleted)) { + deleted = [deleted]; + } + deleted = deleted.map(function (item) { + return item.Key; + }); + } + return _context7.abrupt('return', { + res: result.res, + deleted: deleted + }); + + case 19: + case 'end': + return _context7.stop(); + } + } + }, deleteMulti, this); +}); + +proto.copy = _regenerator2.default.mark(function copy(name, sourceName, options) { + var k, params, result, data; + return _regenerator2.default.wrap(function copy$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + options = options || {}; + options.headers = options.headers || {}; + for (k in options.headers) { + options.headers['x-oss-copy-source-' + k.toLowerCase()] = options.headers[k]; + } + + if (options.meta) { + options.headers['x-oss-metadata-directive'] = 'REPLACE'; + } + this._convertMetaToHeaders(options.meta, options.headers); + + if (sourceName[0] !== '/') { + // copy same bucket object + sourceName = '/' + this.options.bucket + '/' + sourceName; + } + options.headers['x-oss-copy-source'] = sourceName; + + params = this._objectRequestParams('PUT', name, options); + + params.xmlResponse = true; + params.successStatuses = [200, 304]; + + _context8.next = 12; + return this.request(params); + + case 12: + result = _context8.sent; + data = result.data; + + if (data) { + data = { + etag: data.ETag, + lastModified: data.LastModified + }; + } + + return _context8.abrupt('return', { + data: data, + res: result.res + }); + + case 16: + case 'end': + return _context8.stop(); + } + } + }, copy, this); +}); + +proto.putMeta = _regenerator2.default.mark(function putMeta(name, meta, options) { + return _regenerator2.default.wrap(function putMeta$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return this.copy(name, name, { + meta: meta || {}, + timeout: options && options.timeout, + ctx: options && options.ctx + }); + + case 2: + return _context9.abrupt('return', _context9.sent); + + case 3: + case 'end': + return _context9.stop(); + } + } + }, putMeta, this); +}); + +proto.list = _regenerator2.default.mark(function list(query, options) { + var params, result, objects, that, prefixes; + return _regenerator2.default.wrap(function list$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + // prefix, marker, max-keys, delimiter + + params = this._objectRequestParams('GET', '', options); + + params.query = query; + params.xmlResponse = true; + params.successStatuses = [200]; + + _context10.next = 6; + return this.request(params); + + case 6: + result = _context10.sent; + objects = result.data.Contents; + that = this; + + if (objects) { + if (!Array.isArray(objects)) { + objects = [objects]; + } + objects = objects.map(function (obj) { + return { + name: obj.Key, + url: that._objectUrl(obj.Key), + lastModified: obj.LastModified, + etag: obj.ETag, + type: obj.Type, + size: Number(obj.Size), + storageClass: obj.StorageClass, + owner: { + id: obj.Owner.ID, + displayName: obj.Owner.DisplayName + } + }; + }); + } + prefixes = result.data.CommonPrefixes || null; + + if (prefixes) { + if (!Array.isArray(prefixes)) { + prefixes = [prefixes]; + } + prefixes = prefixes.map(function (item) { + return item.Prefix; + }); + } + return _context10.abrupt('return', { + res: result.res, + objects: objects, + prefixes: prefixes, + nextMarker: result.data.NextMarker || null, + isTruncated: result.data.IsTruncated === 'true' + }); + + case 13: + case 'end': + return _context10.stop(); + } + } + }, list, this); +}); + +/* + * Set object's ACL + * @param {String} name the object key + * @param {String} acl the object ACL + * @param {Object} options + */ +proto.putACL = _regenerator2.default.mark(function putACL(name, acl, options) { + var params, result; + return _regenerator2.default.wrap(function putACL$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + options = options || {}; + options.subres = 'acl'; + options.headers = options.headers || {}; + options.headers['x-oss-object-acl'] = acl; + name = this._objectName(name); + + params = this._objectRequestParams('PUT', name, options); + + params.successStatuses = [200]; + + _context11.next = 9; + return this.request(params); + + case 9: + result = _context11.sent; + return _context11.abrupt('return', { + res: result.res + }); + + case 11: + case 'end': + return _context11.stop(); + } + } + }, putACL, this); +}); + +/* + * Get object's ACL + * @param {String} name the object key + * @param {Object} options + * @return {Object} + */ +proto.getACL = _regenerator2.default.mark(function getACL(name, options) { + var params, result; + return _regenerator2.default.wrap(function getACL$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + options = options || {}; + options.subres = 'acl'; + name = this._objectName(name); + + params = this._objectRequestParams('GET', name, options); + + params.successStatuses = [200]; + params.xmlResponse = true; + + _context12.next = 8; + return this.request(params); + + case 8: + result = _context12.sent; + return _context12.abrupt('return', { + acl: result.data.AccessControlList.Grant, + owner: { + id: result.data.Owner.ID, + displayName: result.data.Owner.DisplayName + }, + res: result.res + }); + + case 10: + case 'end': + return _context12.stop(); + } + } + }, getACL, this); +}); + +proto.signatureUrl = function (name, options) { + name = this._objectName(name); + var params = { + bucket: this.options.bucket, + object: name + }; + options = options || {}; + var expires = utility.timestamp() + (options.expires || 1800); + var resource = this._getResource(params); + + var query = {}; + var signList = []; + for (var k in options.response) { + var key = 'response-' + k.toLowerCase(); + query[key] = options.response[k]; + signList.push(key + '=' + options.response[k]); + } + if (this.options.stsToken) { + query['security-token'] = this.options.stsToken; + signList.push('security-token=' + this.options.stsToken); + } + if (signList.length > 0) { + signList.sort(); + resource += '?' + signList.join('&'); + } + + var stringToSign = [options.method || 'GET', options['content-md5'] || '', // Content-MD5 + options['content-type'] || '', // Content-Type + expires, resource].join('\n'); + var signature = this.signature(stringToSign); + + var url = urlutil.parse(this._getReqUrl(params)); + url.query = { + OSSAccessKeyId: this.options.accessKeyId, + Expires: expires, + Signature: signature + }; + copy(query).to(url.query); + + return url.format(); +}; + +/** + * Get Object url by name + * @param {String} name - object name + * @param {String} [baseUrl] - If provide `baseUrl`, will use `baseUrl` instead the default `endpoint`. + * @return {String} object url + */ +proto.getObjectUrl = function (name, baseUrl) { + if (!baseUrl) { + baseUrl = this.options.endpoint.format(); + } else if (baseUrl[baseUrl.length - 1] !== '/') { + baseUrl += '/'; + } + return baseUrl + this._escape(this._objectName(name)); +}; + +proto._objectUrl = function (name) { + return this._getReqUrl({ bucket: this.options.bucket, object: name }); +}; + +/** + * generator request params + * @return {Object} params + * + * @api private + */ + +proto._objectRequestParams = function (method, name, options) { + if (!this.options.bucket) { + throw new Error('Please create a bucket first'); + } + + options = options || {}; + name = this._objectName(name); + var params = { + object: name, + bucket: this.options.bucket, + method: method, + subres: options && options.subres, + timeout: options && options.timeout, + ctx: options && options.ctx + }; + + if (options.headers) { + params.headers = options.headers; + } + return params; +}; + +proto._objectName = function (name) { + return name.replace(/^\/+/, ''); +}; + +proto._statFile = function (filepath) { + return function (callback) { + fs.stat(filepath, callback); + }; +}; + +proto._convertMetaToHeaders = function (meta, headers) { + if (!meta) { + return; + } + + for (var k in meta) { + headers['x-oss-meta-' + k] = meta[k]; + } +}; + +proto._deleteFileSafe = function (filepath) { + return function (callback) { + fs.exists(filepath, function (exists) { + if (!exists) { + return callback(); + } + fs.unlink(filepath, function (err) { + if (err) { + debug('unlink %j error: %s', filepath, err); + } + callback(); + }); + }); + }; +}; + +},{"./../shims/crypto.js":420,"babel-runtime/regenerator":40,"copy-to":54,"debug":184,"destroy":187,"end-or-error":191,"fs":43,"is-type-of":201,"mime":336,"path":342,"querystring":349,"url":377,"utility":395}],8:[function(require,module,exports){ +'use strict'; + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _stringify = require('babel-runtime/core-js/json/stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var debug = require('debug')('ali-oss:sts'); +var crypto = require('./../shims/crypto.js'); +var querystring = require('querystring'); +var copy = require('copy-to'); +var AgentKeepalive = require('agentkeepalive'); +var is = require('is-type-of'); +var ms = require('humanize-ms'); +var urllib = require('urllib'); + +var globalHttpAgent = new AgentKeepalive(); + +module.exports = STS; + +function STS(options) { + if (!(this instanceof STS)) { + return new STS(options); + } + + if (!options || !options.accessKeyId || !options.accessKeySecret) { + throw new Error('require accessKeyId, accessKeySecret'); + } + + this.options = { + endpoint: options.endpoint || 'https://sts.aliyuncs.com', + format: 'JSON', + apiVersion: '2015-04-01', + sigMethod: 'HMAC-SHA1', + sigVersion: '1.0', + timeout: '60s' + }; + copy(options).to(this.options); + + // support custom agent and urllib client + if (this.options.urllib) { + this.urllib = this.options.urllib; + } else { + this.urllib = urllib; + this.agent = this.options.agent || globalHttpAgent; + } +}; + +var proto = STS.prototype; + +/** + * STS opertaions + */ + +proto.assumeRole = _regenerator2.default.mark(function assumeRole(role, policy, expiration, session, options) { + var opts, params, policyStr, signature, reqUrl, reqParams, result, err; + return _regenerator2.default.wrap(function assumeRole$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + opts = this.options; + params = { + 'Action': 'AssumeRole', + 'RoleArn': role, + 'RoleSessionName': session || 'app', + 'DurationSeconds': expiration || 3600, + + 'Format': opts.format, + 'Version': opts.apiVersion, + 'AccessKeyId': opts.accessKeyId, + 'SignatureMethod': opts.sigMethod, + 'SignatureVersion': opts.sigVersion, + 'SignatureNonce': Math.random(), + 'Timestamp': new Date().toISOString() + }; + + if (!policy) { + _context.next = 15; + break; + } + + if (!is.string(policy)) { + _context.next = 13; + break; + } + + _context.prev = 4; + + policyStr = (0, _stringify2.default)(JSON.parse(policy)); + _context.next = 11; + break; + + case 8: + _context.prev = 8; + _context.t0 = _context['catch'](4); + throw new Error('Policy string is not a valid JSON: ' + _context.t0.message); + + case 11: + _context.next = 14; + break; + + case 13: + policyStr = (0, _stringify2.default)(policy); + + case 14: + params.Policy = policyStr; + + case 15: + signature = this._getSignature('POST', params, opts.accessKeySecret); + + params.Signature = signature; + + reqUrl = opts.endpoint; + reqParams = { + agent: this.agent, + timeout: ms(options && options.timeout || opts.timeout), + method: 'POST', + content: querystring.stringify(params), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + ctx: options && options.ctx + }; + _context.next = 21; + return this.urllib.request(reqUrl, reqParams); + + case 21: + result = _context.sent; + + debug('response %s %s, got %s, headers: %j', reqParams.method, reqUrl, result.status, result.headers); + + if (!(Math.floor(result.status / 100) !== 2)) { + _context.next = 29; + break; + } + + _context.next = 26; + return this._requestError(result); + + case 26: + err = _context.sent; + + err.params = reqParams; + throw err; + + case 29: + result.data = JSON.parse(result.data); + + return _context.abrupt('return', { + res: result.res, + credentials: result.data.Credentials + }); + + case 31: + case 'end': + return _context.stop(); + } + } + }, assumeRole, this, [[4, 8]]); +}); + +proto._requestError = _regenerator2.default.mark(function _requestError(result) { + var err, resp; + return _regenerator2.default.wrap(function _requestError$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + err = new Error(); + + err.status = result.status; + + _context2.prev = 2; + _context2.next = 5; + return JSON.parse(result.data) || {}; + + case 5: + resp = _context2.sent; + + err.code = resp.Code; + err.message = resp.Code + ': ' + resp.Message; + err.requestId = resp.RequestId; + _context2.next = 14; + break; + + case 11: + _context2.prev = 11; + _context2.t0 = _context2['catch'](2); + + err.message = 'UnknownError: ' + String(result.data); + + case 14: + return _context2.abrupt('return', err); + + case 15: + case 'end': + return _context2.stop(); + } + } + }, _requestError, this, [[2, 11]]); +}); + +proto._getSignature = function _getSignature(method, params, key) { + var that = this; + var canoQuery = (0, _keys2.default)(params).sort().map(function (key) { + return that._escape(key) + '=' + that._escape(params[key]); + }).join('&'); + + var stringToSign = method.toUpperCase() + '&' + this._escape('/') + '&' + this._escape(canoQuery); + + debug('string to sign: %s', stringToSign); + + var signature = crypto.createHmac('sha1', key + '&'); + signature = signature.update(stringToSign).digest('base64'); + + debug('signature: %s', signature); + + return signature; +}; + +/** + * Since `encodeURIComponent` doesn't encode '*', which causes + * 'SignatureDoesNotMatch'. We need do it ourselves. + */ +proto._escape = function _escape(str) { + return encodeURIComponent(str).replace(/\*/g, '%2A'); +}; + +},{"./../shims/crypto.js":420,"agentkeepalive":11,"babel-runtime/core-js/json/stringify":18,"babel-runtime/core-js/object/keys":30,"babel-runtime/regenerator":40,"copy-to":54,"debug":184,"humanize-ms":196,"is-type-of":201,"querystring":349,"urllib":379}],9:[function(require,module,exports){ +'use strict'; + +var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var co = require('co'); +var OssClient = require('..'); + +module.exports = Client; + +function isGenerator(obj) { + return obj && 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +function isGeneratorFunction(obj) { + if (!obj) return false; + + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype) || isGenerator(obj.prototype); +} + +function wrap(ObjectClass, options) { + var client = new ObjectClass(options); + var props = (0, _keys2.default)(client); + var protoProps = (0, _keys2.default)((0, _getPrototypeOf2.default)(client)); + + props.concat(protoProps).forEach(function (key) { + if (isGeneratorFunction(client[key])) { + this[key] = co.wrap(client[key]).bind(client); + } else { + this[key] = client[key]; + } + }, this); +} + +function Client(options) { + if (!(this instanceof Client)) { + return new Client(options); + } + + wrap.call(this, OssClient, options); +} + +Client.STS = function STSClient(options) { + if (!(this instanceof STSClient)) { + return new STSClient(options); + } + + wrap.call(this, OssClient.STS, options); +}; + +},{"..":3,"babel-runtime/core-js/object/get-prototype-of":28,"babel-runtime/core-js/object/keys":30,"co":51}],10:[function(require,module,exports){ +'use strict'; + +var os = require('os'); +var fs = require('fs'); +var child = require('child_process'); + +var DEFAULT_RESOLV_FILE = '/etc/resolv.conf'; +var DEFAULT_INTERFACE = 'eth'; +var IFCONFIG_CMD = '/sbin/ifconfig'; + +var platform = os.platform(); +if (platform === 'darwin') { + DEFAULT_INTERFACE = 'en'; +} else if (platform === 'win32') { + IFCONFIG_CMD = 'ipconfig'; +} + +/** + * Get all addresses. + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @param {Function(err, addr)} callback + * - {Object} addr { + * - {String} ip + * - {String} ipv6 + * - {String} mac + * } + */ +function address(interfaceName, callback) { + if (typeof interfaceName === 'function') { + callback = interfaceName; + interfaceName = null; + } + + var addr = { + ip: address.ip(interfaceName), + ipv6: address.ipv6(interfaceName), + mac: null + }; + address.mac(interfaceName, function (err, mac) { + if (mac) { + addr.mac = mac; + } + callback(err, addr); + }); +} + +address.interface = function (family, name) { + var interfaces = os.networkInterfaces(); + var noName = !name; + name = name || DEFAULT_INTERFACE; + family = family || 'IPv4'; + var networks; + for (var i = -1; i < 8; i++) { + var interfaceName = name + (i >= 0 ? i : ''); // support 'lo' and 'lo0' + var items = interfaces[interfaceName]; + if (items) { + for (var j = 0; j < items.length; j++) { + var item = items[j]; + if (item.family === family) { + return item; + } + } + } + } + + if (noName) { + // filter 127.0.0.1, get the first ip + for (var k in interfaces) { + var items = interfaces[k]; + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.family === family && item.address !== '127.0.0.1') { + return item; + } + } + } + } + return; +}; + +/** + * Get current machine IPv4 + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @return {String} IP address + */ +address.ip = function (interfaceName) { + var item = address.interface('IPv4', interfaceName); + return item && item.address; +}; + +/** + * Get current machine IPv6 + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @return {String} IP address + */ +address.ipv6 = function (interfaceName) { + var item = address.interface('IPv6', interfaceName); + return item && item.address; +}; + +// osx start line 'en0: flags=8863 mtu 1500' +// linux start line 'eth0 Link encap:Ethernet HWaddr 00:16:3E:00:0A:29 ' +var MAC_OSX_START_LINE = /^(\w+)\:\s+flags=/; +var MAC_LINUX_START_LINE = /^(\w+)\s{2,}link encap:\w+/i; + +// ether 78:ca:39:b0:e6:7d +// HWaddr 00:16:3E:00:0A:29 +var MAC_RE = address.MAC_RE = /(?:ether|HWaddr)\s+((?:[a-z0-9]{2}\:){5}[a-z0-9]{2})/i; + +// osx: inet 192.168.2.104 netmask 0xffffff00 broadcast 192.168.2.255 +// linux: inet addr:10.125.5.202 Bcast:10.125.15.255 Mask:255.255.240.0 +var MAC_IP_RE = address.MAC_IP_RE = /inet\s(?:addr\:)?(\d+\.\d+\.\d+\.\d+)/; + +function getMAC(content, interfaceName, matchIP) { + var lines = content.split('\n'); + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trimRight(); + var m = MAC_OSX_START_LINE.exec(line) || MAC_LINUX_START_LINE.exec(line); + if (!m) { + continue; + } + + // check interface name + var name = m[1]; + if (name.indexOf(interfaceName) !== 0) { + continue; + } + + var ip = null; + var mac = null; + var match = MAC_RE.exec(line); + if (match) { + mac = match[1]; + } + + i++; + while (true) { + line = lines[i]; + if (!line || MAC_OSX_START_LINE.exec(line) || MAC_LINUX_START_LINE.exec(line)) { + i--; + break; // hit next interface, handle next interface + } + if (!mac) { + match = MAC_RE.exec(line); + if (match) { + mac = match[1]; + } + } + + if (!ip) { + match = MAC_IP_RE.exec(line); + if (match) { + ip = match[1]; + } + } + + i++; + } + + if (ip === matchIP) { + return mac; + } + } +} + +/** + * Get current machine MAC address + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @param {Function(err, address)} callback + */ +address.mac = function (interfaceName, callback) { + if (typeof interfaceName === 'function') { + callback = interfaceName; + interfaceName = null; + } + + interfaceName = interfaceName || DEFAULT_INTERFACE; + + var item = address.interface('IPv4', interfaceName); + if (!item) { + return callback(); + } + + if (item.mac) { + return callback(null, item.mac); + } + + child.exec(IFCONFIG_CMD, { timeout: 5000 }, function (err, stdout, stderr) { + if (err || !stdout) { + return callback(err); + } + + var mac = getMAC(stdout || '', interfaceName, item.address); + callback(null, mac); + }); +}; + +// nameserver 172.24.102.254 +var DNS_SERVER_RE = /^nameserver\s+(\d+\.\d+\.\d+\.\d+)$/i; + +/** + * Get DNS servers. + * + * @param {String} [filepath] resolv config file path. default is '/etc/resolv.conf'. + * @param {Function(err, servers)} callback + */ +address.dns = function (filepath, callback) { + if (typeof filepath === 'function') { + callback = filepath; + filepath = null; + } + filepath = filepath || DEFAULT_RESOLV_FILE; + fs.readFile(filepath, 'utf8', function (err, content) { + if (err) { + return callback(err); + } + var servers = []; + content = content || ''; + var lines = content.split('\n'); + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim(); + var m = DNS_SERVER_RE.exec(line); + if (m) { + servers.push(m[1]); + } + } + + callback(null, servers); + }); +}; + +module.exports = address; + +},{"child_process":43,"fs":43,"os":339}],11:[function(require,module,exports){ +"use strict"; + +module.exports = noop; +module.exports.HttpsAgent = noop; + +// Noop function for browser since native api's don't use agents. +function noop() {} + +},{}],12:[function(require,module,exports){ +'use strict'; + +module.exports = require('./register')().Promise; + +},{"./register":14}],13:[function(require,module,exports){ +"use strict"; +// global key for user preferred registration + +var REGISTRATION_KEY = '@@any-promise/REGISTRATION', + +// Prior registration (preferred or detected) +registered = null; + +/** + * Registers the given implementation. An implementation must + * be registered prior to any call to `require("any-promise")`, + * typically on application load. + * + * If called with no arguments, will return registration in + * following priority: + * + * For Node.js: + * + * 1. Previous registration + * 2. global.Promise if node.js version >= 0.12 + * 3. Auto detected promise based on first sucessful require of + * known promise libraries. Note this is a last resort, as the + * loaded library is non-deterministic. node.js >= 0.12 will + * always use global.Promise over this priority list. + * 4. Throws error. + * + * For Browser: + * + * 1. Previous registration + * 2. window.Promise + * 3. Throws error. + * + * Options: + * + * Promise: Desired Promise constructor + * global: Boolean - Should the registration be cached in a global variable to + * allow cross dependency/bundle registration? (default true) + */ +module.exports = function (root, loadImplementation) { + return function register(implementation, opts) { + implementation = implementation || null; + opts = opts || {}; + // global registration unless explicitly {global: false} in options (default true) + var registerGlobal = opts.global !== false; + + // load any previous global registration + if (registered === null && registerGlobal) { + registered = root[REGISTRATION_KEY] || null; + } + + if (registered !== null && implementation !== null && registered.implementation !== implementation) { + // Throw error if attempting to redefine implementation + throw new Error('any-promise already defined as "' + registered.implementation + '". You can only register an implementation before the first ' + ' call to require("any-promise") and an implementation cannot be changed'); + } + + if (registered === null) { + // use provided implementation + if (implementation !== null && typeof opts.Promise !== 'undefined') { + registered = { + Promise: opts.Promise, + implementation: implementation + }; + } else { + // require implementation if implementation is specified but not provided + registered = loadImplementation(implementation); + } + + if (registerGlobal) { + // register preference globally in case multiple installations + root[REGISTRATION_KEY] = registered; + } + } + + return registered; + }; +}; + +},{}],14:[function(require,module,exports){ +"use strict"; + +module.exports = require('./loader')(window, loadImplementation); + +/** + * Browser specific loadImplementation. Always uses `window.Promise` + * + * To register a custom implementation, must register with `Promise` option. + */ +function loadImplementation() { + if (typeof window.Promise === 'undefined') { + throw new Error("any-promise browser requires a polyfill or explicit registration" + " e.g: require('any-promise/register/bluebird')"); + } + return { + Promise: window.Promise, + implementation: 'window.Promise' + }; +} + +},{"./loader":13}],15:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true }; + +},{"core-js/library/fn/array/from":55}],16:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/clear-immediate"), __esModule: true }; + +},{"core-js/library/fn/clear-immediate":56}],17:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/get-iterator"), __esModule: true }; + +},{"core-js/library/fn/get-iterator":57}],18:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true }; + +},{"core-js/library/fn/json/stringify":58}],19:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/number/is-finite"), __esModule: true }; + +},{"core-js/library/fn/number/is-finite":59}],20:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/number/is-nan"), __esModule: true }; + +},{"core-js/library/fn/number/is-nan":60}],21:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/number/max-safe-integer"), __esModule: true }; + +},{"core-js/library/fn/number/max-safe-integer":61}],22:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true }; + +},{"core-js/library/fn/object/create":62}],23:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/define-properties"), __esModule: true }; + +},{"core-js/library/fn/object/define-properties":63}],24:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true }; + +},{"core-js/library/fn/object/define-property":64}],25:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/get-own-property-descriptor"), __esModule: true }; + +},{"core-js/library/fn/object/get-own-property-descriptor":65}],26:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/get-own-property-names"), __esModule: true }; + +},{"core-js/library/fn/object/get-own-property-names":66}],27:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/get-own-property-symbols"), __esModule: true }; + +},{"core-js/library/fn/object/get-own-property-symbols":67}],28:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/get-prototype-of"), __esModule: true }; + +},{"core-js/library/fn/object/get-prototype-of":68}],29:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/is-extensible"), __esModule: true }; + +},{"core-js/library/fn/object/is-extensible":69}],30:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true }; + +},{"core-js/library/fn/object/keys":70}],31:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/prevent-extensions"), __esModule: true }; + +},{"core-js/library/fn/object/prevent-extensions":71}],32:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true }; + +},{"core-js/library/fn/object/set-prototype-of":72}],33:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/promise"), __esModule: true }; + +},{"core-js/library/fn/promise":73}],34:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/set-immediate"), __esModule: true }; + +},{"core-js/library/fn/set-immediate":74}],35:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/string/from-code-point"), __esModule: true }; + +},{"core-js/library/fn/string/from-code-point":75}],36:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true }; + +},{"core-js/library/fn/symbol":76}],37:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true }; + +},{"core-js/library/fn/symbol/iterator":77}],38:[function(require,module,exports){ +"use strict"; + +module.exports = { "default": require("core-js/library/fn/symbol/species"), __esModule: true }; + +},{"core-js/library/fn/symbol/species":78}],39:[function(require,module,exports){ +"use strict"; + +var _typeof3 = require("babel-runtime/helpers/typeof"); + +var _typeof4 = _interopRequireDefault2(_typeof3); + +function _interopRequireDefault2(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.__esModule = true; + +var _iterator = require("../core-js/symbol/iterator"); + +var _iterator2 = _interopRequireDefault(_iterator); + +var _symbol = require("../core-js/symbol"); + +var _symbol2 = _interopRequireDefault(_symbol); + +var _typeof = typeof _symbol2.default === "function" && (0, _typeof4.default)(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj); +}; + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +}; + +},{"../core-js/symbol":36,"../core-js/symbol/iterator":37,"babel-runtime/helpers/typeof":39}],40:[function(require,module,exports){ +"use strict"; + +module.exports = require("regenerator-runtime"); + +},{"regenerator-runtime":362}],41:[function(require,module,exports){ +'use strict'; + +exports.byteLength = byteLength; +exports.toByteArray = toByteArray; +exports.fromByteArray = fromByteArray; + +var lookup = []; +var revLookup = []; +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; +} + +revLookup['-'.charCodeAt(0)] = 62; +revLookup['_'.charCodeAt(0)] = 63; + +function placeHoldersCount(b64) { + var len = b64.length; + if (len % 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 + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; +} + +function byteLength(b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64); +} + +function toByteArray(b64) { + var i, j, l, tmp, placeHolders, arr; + var len = b64.length; + placeHolders = placeHoldersCount(b64); + + arr = new Arr(len * 3 / 4 - placeHolders); + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len; + + var L = 0; + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; + arr[L++] = tmp >> 16 & 0xFF; + arr[L++] = tmp >> 8 & 0xFF; + arr[L++] = tmp & 0xFF; + } + + if (placeHolders === 2) { + tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; + arr[L++] = tmp & 0xFF; + } else if (placeHolders === 1) { + tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; + arr[L++] = tmp >> 8 & 0xFF; + arr[L++] = tmp & 0xFF; + } + + return arr; +} + +function tripletToBase64(num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; +} + +function encodeChunk(uint8, start, end) { + var tmp; + var output = []; + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; + output.push(tripletToBase64(tmp)); + } + return output.join(''); +} + +function fromByteArray(uint8) { + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + var output = ''; + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1]; + output += lookup[tmp >> 2]; + output += lookup[tmp << 4 & 0x3F]; + output += '=='; + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + output += lookup[tmp >> 10]; + output += lookup[tmp >> 4 & 0x3F]; + output += lookup[tmp << 2 & 0x3F]; + output += '='; + } + + parts.push(output); + + return parts.join(''); +} + +},{}],42:[function(require,module,exports){ +"use strict"; + +},{}],43:[function(require,module,exports){ +"use strict"; + +},{}],44:[function(require,module,exports){ +(function (global){ +'use strict'; + +var buffer = require('buffer'); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; +}; +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); +}; +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +}; +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); + } + return new SlowBuffer(size); +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"buffer":45}],45:[function(require,module,exports){ +(function (global){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + +'use strict'; + +var _defineProperty = require('babel-runtime/core-js/object/define-property'); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +var _species = require('babel-runtime/core-js/symbol/species'); + +var _species2 = _interopRequireDefault(_species); + +var _symbol = require('babel-runtime/core-js/symbol'); + +var _symbol2 = _interopRequireDefault(_symbol); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var base64 = require('base64-js'); +var ieee754 = require('ieee754'); +var isArray = require('isarray'); + +exports.Buffer = Buffer; +exports.SlowBuffer = SlowBuffer; +exports.INSPECT_MAX_BYTES = 50; + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport(); + +/* + * Export kMaxLength after typed array support is determined. + */ +exports.kMaxLength = kMaxLength(); + +function typedArraySupport() { + try { + var arr = new Uint8Array(1); + arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function foo() { + return 42; + } }; + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray` + } catch (e) { + return false; + } +} + +function kMaxLength() { + return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff; +} + +function createBuffer(that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length'); + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length); + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length); + } + that.length = length; + } + + return that; +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer(arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length); + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error('If encoding is specified then the first argument must be a string'); + } + return allocUnsafe(this, arg); + } + return from(this, arg, encodingOrOffset, length); +} + +Buffer.poolSize = 8192; // not used by this implementation + +// TODO: Legacy, not needed anymore. Remove in next major version. +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype; + return arr; +}; + +function from(that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length); + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset); + } + + return fromObject(that, value); +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length); +}; + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype; + Buffer.__proto__ = Uint8Array; + if (typeof _symbol2.default !== 'undefined' && _species2.default && Buffer[_species2.default] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + (0, _defineProperty2.default)(Buffer, _species2.default, { + value: null, + configurable: true + }); + } +} + +function assertSize(size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number'); + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative'); + } +} + +function alloc(that, size, fill, encoding) { + assertSize(size); + if (size <= 0) { + return createBuffer(that, size); + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill); + } + return createBuffer(that, size); +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding); +}; + +function allocUnsafe(that, size) { + assertSize(size); + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0; + } + } + return that; +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size); +}; +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size); +}; + +function fromString(that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding'); + } + + var length = byteLength(string, encoding) | 0; + that = createBuffer(that, length); + + var actual = that.write(string, encoding); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual); + } + + return that; +} + +function fromArrayLike(that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + that = createBuffer(that, length); + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255; + } + return that; +} + +function fromArrayBuffer(that, array, byteOffset, length) { + array.byteLength; // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds'); + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds'); + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array); + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset); + } else { + array = new Uint8Array(array, byteOffset, length); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array; + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array); + } + return that; +} + +function fromObject(that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0; + that = createBuffer(that, len); + + if (that.length === 0) { + return that; + } + + obj.copy(that, 0, 0, len); + return that; + } + + if (obj) { + if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0); + } + return fromArrayLike(that, obj); + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.'); +} + +function checked(length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes'); + } + return length | 0; +} + +function SlowBuffer(length) { + if (+length != length) { + // eslint-disable-line eqeqeq + length = 0; + } + return Buffer.alloc(+length); +} + +Buffer.isBuffer = function isBuffer(b) { + return !!(b != null && b._isBuffer); +}; + +Buffer.compare = function compare(a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers'); + } + + if (a === b) return 0; + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; +}; + +Buffer.isEncoding = function isEncoding(encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true; + default: + return false; + } +}; + +Buffer.concat = function concat(list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + if (list.length === 0) { + return Buffer.alloc(0); + } + + var i; + if (length === undefined) { + length = 0; + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = Buffer.allocUnsafe(length); + var pos = 0; + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + buf.copy(buffer, pos); + pos += buf.length; + } + return buffer; +}; + +function byteLength(string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length; + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength; + } + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0; + + // Use a for loop to avoid recursion + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len; + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2; + case 'hex': + return len >>> 1; + case 'base64': + return base64ToBytes(string).length; + default: + if (loweredCase) return utf8ToBytes(string).length; // assume utf8 + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } +} +Buffer.byteLength = byteLength; + +function slowToString(encoding, start, end) { + var loweredCase = false; + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0; + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return ''; + } + + if (end === undefined || end > this.length) { + end = this.length; + } + + if (end <= 0) { + return ''; + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0; + start >>>= 0; + + if (end <= start) { + return ''; + } + + if (!encoding) encoding = 'utf8'; + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end); + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end); + + case 'ascii': + return asciiSlice(this, start, end); + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end); + + case 'base64': + return base64Slice(this, start, end); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = (encoding + '').toLowerCase(); + loweredCase = true; + } + } +} + +// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. +Buffer.prototype._isBuffer = true; + +function swap(b, n, m) { + var i = b[n]; + b[n] = b[m]; + b[m] = i; +} + +Buffer.prototype.swap16 = function swap16() { + var len = this.length; + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits'); + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + return this; +}; + +Buffer.prototype.swap32 = function swap32() { + var len = this.length; + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits'); + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + return this; +}; + +Buffer.prototype.swap64 = function swap64() { + var len = this.length; + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits'); + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + return this; +}; + +Buffer.prototype.toString = function toString() { + var length = this.length | 0; + if (length === 0) return ''; + if (arguments.length === 0) return utf8Slice(this, 0, length); + return slowToString.apply(this, arguments); +}; + +Buffer.prototype.equals = function equals(b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); + if (this === b) return true; + return Buffer.compare(this, b) === 0; +}; + +Buffer.prototype.inspect = function inspect() { + var str = ''; + var max = exports.INSPECT_MAX_BYTES; + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' '); + if (this.length > max) str += ' ... '; + } + return ''; +}; + +Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer'); + } + + if (start === undefined) { + start = 0; + } + if (end === undefined) { + end = target ? target.length : 0; + } + if (thisStart === undefined) { + thisStart = 0; + } + if (thisEnd === undefined) { + thisEnd = this.length; + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index'); + } + + if (thisStart >= thisEnd && start >= end) { + return 0; + } + if (thisStart >= thisEnd) { + return -1; + } + if (start >= end) { + return 1; + } + + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + + if (this === target) return 0; + + var x = thisEnd - thisStart; + var y = end - start; + var len = Math.min(x, y); + + var thisCopy = this.slice(thisStart, thisEnd); + var targetCopy = target.slice(start, end); + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; +}; + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1; + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff; + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000; + } + byteOffset = +byteOffset; // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : buffer.length - 1; + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset; + if (byteOffset >= buffer.length) { + if (dir) return -1;else byteOffset = buffer.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0;else return -1; + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding); + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1; + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir); + } else if (typeof val === 'number') { + val = val & 0xFF; // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); + } + + throw new TypeError('val must be string, number or Buffer'); +} + +function arrayIndexOf(arr, val, byteOffset, encoding, dir) { + var indexSize = 1; + var arrLength = arr.length; + var valLength = val.length; + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase(); + if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1; + } + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + + function read(buf, i) { + if (indexSize === 1) { + return buf[i]; + } else { + return buf.readUInt16BE(i * indexSize); + } + } + + var i; + if (dir) { + var foundIndex = -1; + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; + for (i = byteOffset; i >= 0; i--) { + var found = true; + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break; + } + } + if (found) return i; + } + } + + return -1; +} + +Buffer.prototype.includes = function includes(val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1; +}; + +Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true); +}; + +Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false); +}; + +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; + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string'); + + if (length > strLen / 2) { + length = strLen / 2; + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(parsed)) return i; + buf[offset + i] = parsed; + } + return i; +} + +function utf8Write(buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); +} + +function asciiWrite(buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length); +} + +function latin1Write(buf, string, offset, length) { + return asciiWrite(buf, string, offset, length); +} + +function base64Write(buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length); +} + +function ucs2Write(buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); +} + +Buffer.prototype.write = function write(string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8'; + length = this.length; + offset = 0; + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset; + length = this.length; + offset = 0; + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0; + if (isFinite(length)) { + length = length | 0; + if (encoding === undefined) encoding = 'utf8'; + } else { + encoding = length; + length = undefined; + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds'); + } + + if (!encoding) encoding = 'utf8'; + + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length); + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length); + + case 'ascii': + return asciiWrite(this, string, offset, length); + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length); + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } +}; + +Buffer.prototype.toJSON = function toJSON() { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + }; +}; + +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) { + end = Math.min(buf.length, end); + var res = []; + + var i = start; + while (i < end) { + var firstByte = buf[i]; + var codePoint = null; + var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint; + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte; + } + break; + case 2: + secondByte = buf[i + 1]; + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint; + } + } + break; + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint; + } + } + break; + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint; + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD; + bytesPerSequence = 1; + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000; + res.push(codePoint >>> 10 & 0x3FF | 0xD800); + codePoint = 0xDC00 | codePoint & 0x3FF; + } + + res.push(codePoint); + i += bytesPerSequence; + } + + return decodeCodePointsArray(res); +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000; + +function decodeCodePointsArray(codePoints) { + var len = codePoints.length; + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints); // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = ''; + var i = 0; + while (i < len) { + res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); + } + return res; +} + +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] & 0x7F); + } + return ret; +} + +function latin1Slice(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 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 slice(start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + + var newBuf; + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); + newBuf.__proto__ = Buffer.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer(sliceLen, undefined); + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf; +}; + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset(offset, ext, length) { + if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); +} + +Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + return val; +}; + +Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + checkOffset(offset, byteLength, this.length); + } + + var val = this[offset + --byteLength]; + var mul = 1; + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul; + } + + return val; +}; + +Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset]; +}; + +Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | this[offset + 1] << 8; +}; + +Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] << 8 | this[offset + 1]; +}; + +Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; +}; + +Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); +}; + +Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; +}; + +Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var i = byteLength; + var mul = 1; + var val = this[offset + --i]; + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; +}; + +Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 0x80)) return this[offset]; + return (0xff - this[offset] + 1) * -1; +}; + +Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset] | this[offset + 1] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; +}; + +Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset + 1] | this[offset] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; +}; + +Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; +}; + +Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; +}; + +Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, true, 23, 4); +}; + +Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, false, 23, 4); +}; + +Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, true, 52, 8); +}; + +Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, false, 52, 8); +}; + +function checkInt(buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw new RangeError('Index out of range'); +} + +Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var mul = 1; + var i = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var i = byteLength - 1; + var mul = 1; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + this[offset] = value & 0xff; + return offset + 1; +}; + +function objectWriteUInt16(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8; + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; +}; + +Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; +}; + +function objectWriteUInt32(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff; + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = value >>> 24; + this[offset + 2] = value >>> 16; + this[offset + 1] = value >>> 8; + this[offset] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; +}; + +Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; +}; + +Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = 0; + var mul = 1; + var sub = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = byteLength - 1; + var mul = 1; + var sub = 0; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + if (value < 0) value = 0xff + value + 1; + this[offset] = value & 0xff; + return offset + 1; +}; + +Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; +}; + +Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; +}; + +Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + this[offset + 2] = value >>> 16; + this[offset + 3] = value >>> 24; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; +}; + +Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (value < 0) value = 0xffffffff + value + 1; + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; +}; + +function checkIEEE754(buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + if (offset < 0) throw new RangeError('Index out of range'); +} + +function writeFloat(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38); + } + ieee754.write(buf, value, offset, littleEndian, 23, 4); + return offset + 4; +} + +Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert); +}; + +Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert); +}; + +function writeDouble(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308); + } + ieee754.write(buf, value, offset, littleEndian, 52, 8); + return offset + 8; +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert); +}; + +Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert); +}; + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; + + // Copy 0 bytes; we're done + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds'); + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds'); + if (end < 0) throw new RangeError('sourceEnd out of bounds'); + + // Are we oob? + if (end > this.length) end = this.length; + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); + } + + return len; +}; + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill(val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === 'string') { + encoding = end; + end = this.length; + } + if (val.length === 1) { + var code = val.charCodeAt(0); + if (code < 256) { + val = code; + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string'); + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding); + } + } else if (typeof val === 'number') { + val = val & 255; + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index'); + } + + if (end <= start) { + return this; + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + + if (!val) val = 0; + + var i; + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()); + var len = bytes.length; + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this; +}; + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; + +function base64clean(str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, ''); + // Node converts strings with length < 2 to '' + if (str.length < 2) return ''; + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '='; + } + return str; +} + +function stringtrim(str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +} + +function toHex(n) { + if (n < 16) return '0' + n.toString(16); + return n.toString(16); +} + +function utf8ToBytes(string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } + + // valid lead + leadSurrogate = codePoint; + + continue; + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + leadSurrogate = codePoint; + continue; + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + } + + leadSurrogate = null; + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else { + throw new Error('Invalid code point'); + } + } + + return bytes; +} + +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, units) { + var c, hi, lo; + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break; + + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + + return byteArray; +} + +function base64ToBytes(str) { + return base64.toByteArray(base64clean(str)); +} + +function blitBuffer(src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + return i; +} + +function isnan(val) { + return val !== val; // eslint-disable-line no-self-compare +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"babel-runtime/core-js/object/define-property":24,"babel-runtime/core-js/symbol":36,"babel-runtime/core-js/symbol/species":38,"base64-js":41,"ieee754":197,"isarray":46}],46:[function(require,module,exports){ +'use strict'; + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +},{}],47:[function(require,module,exports){ +"use strict"; + +module.exports = { + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +}; + +},{}],48:[function(require,module,exports){ +(function (process){ +'use strict'; + +var _setImmediate2 = require('babel-runtime/core-js/set-immediate'); + +var _setImmediate3 = _interopRequireDefault(_setImmediate2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var co = require('co'); + +exports = module.exports = deferImmediate; +exports.defer = exports.immediate = exports.setImmediate = deferImmediate; + +function createCallback(ctx, gen, cb) { + return function () { + cb = cb || error; + co.call(ctx, gen).then(function () { + cb(); + }, cb); + }; +} + +function deferImmediate(gen, cb) { + return (0, _setImmediate3.default)(createCallback(this, gen, cb)); +} + +exports.nextTick = function deferNextTick(gen, cb) { + return process.nextTick(createCallback(this, gen, cb)); +}; + +exports.timeout = exports.setTimeout = function deferTimeout(gen, timeout, cb) { + return setTimeout(createCallback(this, gen, cb), timeout); +}; + +exports.interval = exports.setInterval = function deferInterval(gen, timeout, cb) { + return setInterval(createCallback(this, gen, cb), timeout); +}; + +function error(err) { + if (err) throw err; +} + +}).call(this,require('_process')) +},{"_process":345,"babel-runtime/core-js/set-immediate":34,"co":51}],49:[function(require,module,exports){ +/*! + * co-gather - index.js + * Copyright(c) 2014 dead_horse + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var thread = require('co-thread'); + +module.exports = _regenerator2.default.mark(function gather(thunks, n) { + var _marked, ret, index, next; + + return _regenerator2.default.wrap(function gather$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + next = function next() { + var i; + return _regenerator2.default.wrap(function next$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + i = index++; + + ret[i] = { isError: false }; + _context.prev = 2; + _context.next = 5; + return thunks[i]; + + case 5: + ret[i].value = _context.sent; + _context.next = 12; + break; + + case 8: + _context.prev = 8; + _context.t0 = _context['catch'](2); + + ret[i].error = _context.t0; + ret[i].isError = true; + + case 12: + if (!(index < thunks.length)) { + _context.next = 15; + break; + } + + _context.next = 15; + return next; + + case 15: + case 'end': + return _context.stop(); + } + } + }, _marked[0], this, [[2, 8]]); + }; + + _marked = [next].map(_regenerator2.default.mark); + + n = Math.min(n || 5, thunks.length); + ret = []; + index = 0; + _context2.next = 7; + return thread(next, n); + + case 7: + return _context2.abrupt('return', ret); + + case 8: + case 'end': + return _context2.stop(); + } + } + }, gather, this); +}); + +},{"babel-runtime/regenerator":40,"co-thread":50}],50:[function(require,module,exports){ +"use strict"; + +/** + * Expose `thread`. + */ + +module.exports = thread; + +/** + * Run `fn` `n` times in parallel. + * + * @param {Function} fn + * @param {Number} n + * @return {Array} + * @api public + */ + +function thread(fn, n) { + var gens = []; + while (n--) { + gens.push(fn); + }return gens; +} + +},{}],51:[function(require,module,exports){ +'use strict'; + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _promise = require('babel-runtime/core-js/promise'); + +var _promise2 = _interopRequireDefault(_promise); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * slice() reference. + */ + +var slice = Array.prototype.slice; + +/** + * Expose `co`. + */ + +module.exports = co['default'] = co.co = co; + +/** + * Wrap the given generator `fn` into a + * function that returns a promise. + * This is a separate function so that + * every `co()` call doesn't create a new, + * unnecessary closure. + * + * @param {GeneratorFunction} fn + * @return {Function} + * @api public + */ + +co.wrap = function (fn) { + createPromise.__generatorFunction__ = fn; + return createPromise; + function createPromise() { + return co.call(this, fn.apply(this, arguments)); + } +}; + +/** + * Execute the generator function or a generator + * and return a promise. + * + * @param {Function} fn + * @return {Promise} + * @api public + */ + +function co(gen) { + var ctx = this; + var args = slice.call(arguments, 1); + + // we wrap everything in a promise to avoid promise chaining, + // which leads to memory leak errors. + // see https://github.com/tj/co/issues/180 + return new _promise2.default(function (resolve, reject) { + if (typeof gen === 'function') gen = gen.apply(ctx, args); + if (!gen || typeof gen.next !== 'function') return resolve(gen); + + onFulfilled(); + + /** + * @param {Mixed} res + * @return {Promise} + * @api private + */ + + function onFulfilled(res) { + var ret; + try { + ret = gen.next(res); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * @param {Error} err + * @return {Promise} + * @api private + */ + + function onRejected(err) { + var ret; + try { + ret = gen.throw(err); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * Get the next value in the generator, + * return a promise. + * + * @param {Object} ret + * @return {Promise} + * @api private + */ + + function next(ret) { + if (ret.done) return resolve(ret.value); + var value = toPromise.call(ctx, ret.value); + if (value && isPromise(value)) return value.then(onFulfilled, onRejected); + return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, ' + 'but the following object was passed: "' + String(ret.value) + '"')); + } + }); +} + +/** + * Convert a `yield`ed value into a promise. + * + * @param {Mixed} obj + * @return {Promise} + * @api private + */ + +function toPromise(obj) { + if (!obj) return obj; + if (isPromise(obj)) return obj; + if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj); + if ('function' == typeof obj) return thunkToPromise.call(this, obj); + if (Array.isArray(obj)) return arrayToPromise.call(this, obj); + if (isObject(obj)) return objectToPromise.call(this, obj); + return obj; +} + +/** + * Convert a thunk to a promise. + * + * @param {Function} + * @return {Promise} + * @api private + */ + +function thunkToPromise(fn) { + var ctx = this; + return new _promise2.default(function (resolve, reject) { + fn.call(ctx, function (err, res) { + if (err) return reject(err); + if (arguments.length > 2) res = slice.call(arguments, 1); + resolve(res); + }); + }); +} + +/** + * Convert an array of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Array} obj + * @return {Promise} + * @api private + */ + +function arrayToPromise(obj) { + return _promise2.default.all(obj.map(toPromise, this)); +} + +/** + * Convert an object of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Object} obj + * @return {Promise} + * @api private + */ + +function objectToPromise(obj) { + var results = new obj.constructor(); + var keys = (0, _keys2.default)(obj); + var promises = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var promise = toPromise.call(this, obj[key]); + if (promise && isPromise(promise)) defer(promise, key);else results[key] = obj[key]; + } + return _promise2.default.all(promises).then(function () { + return results; + }); + + function defer(promise, key) { + // predefine the key in the result + results[key] = undefined; + promises.push(promise.then(function (res) { + results[key] = res; + })); + } +} + +/** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + +function isPromise(obj) { + return 'function' == typeof obj.then; +} + +/** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGenerator(obj) { + return 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +/** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ +function isGeneratorFunction(obj) { + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype); +} + +/** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + +function isObject(val) { + return Object == val.constructor; +} + +},{"babel-runtime/core-js/object/keys":30,"babel-runtime/core-js/promise":33}],52:[function(require,module,exports){ +module.exports={ + "O_RDONLY": 0, + "O_WRONLY": 1, + "O_RDWR": 2, + "S_IFMT": 61440, + "S_IFREG": 32768, + "S_IFDIR": 16384, + "S_IFCHR": 8192, + "S_IFBLK": 24576, + "S_IFIFO": 4096, + "S_IFLNK": 40960, + "S_IFSOCK": 49152, + "O_CREAT": 512, + "O_EXCL": 2048, + "O_NOCTTY": 131072, + "O_TRUNC": 1024, + "O_APPEND": 8, + "O_DIRECTORY": 1048576, + "O_NOFOLLOW": 256, + "O_SYNC": 128, + "O_SYMLINK": 2097152, + "O_NONBLOCK": 4, + "S_IRWXU": 448, + "S_IRUSR": 256, + "S_IWUSR": 128, + "S_IXUSR": 64, + "S_IRWXG": 56, + "S_IRGRP": 32, + "S_IWGRP": 16, + "S_IXGRP": 8, + "S_IRWXO": 7, + "S_IROTH": 4, + "S_IWOTH": 2, + "S_IXOTH": 1, + "E2BIG": 7, + "EACCES": 13, + "EADDRINUSE": 48, + "EADDRNOTAVAIL": 49, + "EAFNOSUPPORT": 47, + "EAGAIN": 35, + "EALREADY": 37, + "EBADF": 9, + "EBADMSG": 94, + "EBUSY": 16, + "ECANCELED": 89, + "ECHILD": 10, + "ECONNABORTED": 53, + "ECONNREFUSED": 61, + "ECONNRESET": 54, + "EDEADLK": 11, + "EDESTADDRREQ": 39, + "EDOM": 33, + "EDQUOT": 69, + "EEXIST": 17, + "EFAULT": 14, + "EFBIG": 27, + "EHOSTUNREACH": 65, + "EIDRM": 90, + "EILSEQ": 92, + "EINPROGRESS": 36, + "EINTR": 4, + "EINVAL": 22, + "EIO": 5, + "EISCONN": 56, + "EISDIR": 21, + "ELOOP": 62, + "EMFILE": 24, + "EMLINK": 31, + "EMSGSIZE": 40, + "EMULTIHOP": 95, + "ENAMETOOLONG": 63, + "ENETDOWN": 50, + "ENETRESET": 52, + "ENETUNREACH": 51, + "ENFILE": 23, + "ENOBUFS": 55, + "ENODATA": 96, + "ENODEV": 19, + "ENOENT": 2, + "ENOEXEC": 8, + "ENOLCK": 77, + "ENOLINK": 97, + "ENOMEM": 12, + "ENOMSG": 91, + "ENOPROTOOPT": 42, + "ENOSPC": 28, + "ENOSR": 98, + "ENOSTR": 99, + "ENOSYS": 78, + "ENOTCONN": 57, + "ENOTDIR": 20, + "ENOTEMPTY": 66, + "ENOTSOCK": 38, + "ENOTSUP": 45, + "ENOTTY": 25, + "ENXIO": 6, + "EOPNOTSUPP": 102, + "EOVERFLOW": 84, + "EPERM": 1, + "EPIPE": 32, + "EPROTO": 100, + "EPROTONOSUPPORT": 43, + "EPROTOTYPE": 41, + "ERANGE": 34, + "EROFS": 30, + "ESPIPE": 29, + "ESRCH": 3, + "ESTALE": 70, + "ETIME": 101, + "ETIMEDOUT": 60, + "ETXTBSY": 26, + "EWOULDBLOCK": 35, + "EXDEV": 18, + "SIGHUP": 1, + "SIGINT": 2, + "SIGQUIT": 3, + "SIGILL": 4, + "SIGTRAP": 5, + "SIGABRT": 6, + "SIGIOT": 6, + "SIGBUS": 10, + "SIGFPE": 8, + "SIGKILL": 9, + "SIGUSR1": 30, + "SIGSEGV": 11, + "SIGUSR2": 31, + "SIGPIPE": 13, + "SIGALRM": 14, + "SIGTERM": 15, + "SIGCHLD": 20, + "SIGCONT": 19, + "SIGSTOP": 17, + "SIGTSTP": 18, + "SIGTTIN": 21, + "SIGTTOU": 22, + "SIGURG": 16, + "SIGXCPU": 24, + "SIGXFSZ": 25, + "SIGVTALRM": 26, + "SIGPROF": 27, + "SIGWINCH": 28, + "SIGIO": 23, + "SIGSYS": 12, + "SSL_OP_ALL": 2147486719, + "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144, + "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304, + "SSL_OP_CISCO_ANYCONNECT": 32768, + "SSL_OP_COOKIE_EXCHANGE": 8192, + "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648, + "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048, + "SSL_OP_EPHEMERAL_RSA": 0, + "SSL_OP_LEGACY_SERVER_CONNECT": 4, + "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32, + "SSL_OP_MICROSOFT_SESS_ID_BUG": 1, + "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0, + "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912, + "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2, + "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824, + "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8, + "SSL_OP_NO_COMPRESSION": 131072, + "SSL_OP_NO_QUERY_MTU": 4096, + "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536, + "SSL_OP_NO_SSLv2": 16777216, + "SSL_OP_NO_SSLv3": 33554432, + "SSL_OP_NO_TICKET": 16384, + "SSL_OP_NO_TLSv1": 67108864, + "SSL_OP_NO_TLSv1_1": 268435456, + "SSL_OP_NO_TLSv1_2": 134217728, + "SSL_OP_PKCS1_CHECK_1": 0, + "SSL_OP_PKCS1_CHECK_2": 0, + "SSL_OP_SINGLE_DH_USE": 1048576, + "SSL_OP_SINGLE_ECDH_USE": 524288, + "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128, + "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0, + "SSL_OP_TLS_BLOCK_PADDING_BUG": 512, + "SSL_OP_TLS_D5_BUG": 256, + "SSL_OP_TLS_ROLLBACK_BUG": 8388608, + "ENGINE_METHOD_DSA": 2, + "ENGINE_METHOD_DH": 4, + "ENGINE_METHOD_RAND": 8, + "ENGINE_METHOD_ECDH": 16, + "ENGINE_METHOD_ECDSA": 32, + "ENGINE_METHOD_CIPHERS": 64, + "ENGINE_METHOD_DIGESTS": 128, + "ENGINE_METHOD_STORE": 256, + "ENGINE_METHOD_PKEY_METHS": 512, + "ENGINE_METHOD_PKEY_ASN1_METHS": 1024, + "ENGINE_METHOD_ALL": 65535, + "ENGINE_METHOD_NONE": 0, + "DH_CHECK_P_NOT_SAFE_PRIME": 2, + "DH_CHECK_P_NOT_PRIME": 1, + "DH_UNABLE_TO_CHECK_GENERATOR": 4, + "DH_NOT_SUITABLE_GENERATOR": 8, + "NPN_ENABLED": 1, + "RSA_PKCS1_PADDING": 1, + "RSA_SSLV23_PADDING": 2, + "RSA_NO_PADDING": 3, + "RSA_PKCS1_OAEP_PADDING": 4, + "RSA_X931_PADDING": 5, + "RSA_PKCS1_PSS_PADDING": 6, + "POINT_CONVERSION_COMPRESSED": 2, + "POINT_CONVERSION_UNCOMPRESSED": 4, + "POINT_CONVERSION_HYBRID": 6, + "F_OK": 0, + "R_OK": 4, + "W_OK": 2, + "X_OK": 1, + "UV_UDP_REUSEADDR": 4 +} + +},{}],53:[function(require,module,exports){ +/*! + * content-type + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var paramRegExp = /; *([!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) */g; +var textRegExp = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; +var tokenRegExp = /^[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+$/; + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +var qescRegExp = /\\([\u000b\u0020-\u00ff])/g; + +/** + * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 + */ +var quoteRegExp = /([\\"])/g; + +/** + * RegExp to match type in RFC 6838 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +var typeRegExp = /^[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+\/[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+$/; + +/** + * Module exports. + * @public + */ + +exports.format = format; +exports.parse = parse; + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @public + */ + +function format(obj) { + if (!obj || (typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) !== 'object') { + throw new TypeError('argument obj is required'); + } + + var parameters = obj.parameters; + var type = obj.type; + + if (!type || !typeRegExp.test(type)) { + throw new TypeError('invalid type'); + } + + var string = type; + + // append parameters + if (parameters && (typeof parameters === 'undefined' ? 'undefined' : (0, _typeof3.default)(parameters)) === 'object') { + var param; + var params = (0, _keys2.default)(parameters).sort(); + + for (var i = 0; i < params.length; i++) { + param = params[i]; + + if (!tokenRegExp.test(param)) { + throw new TypeError('invalid parameter name'); + } + + string += '; ' + param + '=' + qstring(parameters[param]); + } + } + + return string; +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @public + */ + +function parse(string) { + if (!string) { + throw new TypeError('argument string is required'); + } + + if ((typeof string === 'undefined' ? 'undefined' : (0, _typeof3.default)(string)) === 'object') { + // support req/res-like objects as argument + string = getcontenttype(string); + + if (typeof string !== 'string') { + throw new TypeError('content-type header is missing from object'); + } + } + + if (typeof string !== 'string') { + throw new TypeError('argument string is required to be a string'); + } + + var index = string.indexOf(';'); + var type = index !== -1 ? string.substr(0, index).trim() : string.trim(); + + if (!typeRegExp.test(type)) { + throw new TypeError('invalid media type'); + } + + var key; + var match; + var obj = new ContentType(type.toLowerCase()); + var value; + + paramRegExp.lastIndex = index; + + while (match = paramRegExp.exec(string)) { + if (match.index !== index) { + throw new TypeError('invalid parameter format'); + } + + index += match[0].length; + key = match[1].toLowerCase(); + value = match[2]; + + if (value[0] === '"') { + // remove quotes and escapes + value = value.substr(1, value.length - 2).replace(qescRegExp, '$1'); + } + + obj.parameters[key] = value; + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format'); + } + + return obj; +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @private + */ + +function getcontenttype(obj) { + if (typeof obj.getHeader === 'function') { + // res-like + return obj.getHeader('content-type'); + } + + if ((0, _typeof3.default)(obj.headers) === 'object') { + // req-like + return obj.headers && obj.headers['content-type']; + } +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring(val) { + var str = String(val); + + // no need to quote tokens + if (tokenRegExp.test(str)) { + return str; + } + + if (str.length > 0 && !textRegExp.test(str)) { + throw new TypeError('invalid parameter value'); + } + + return '"' + str.replace(quoteRegExp, '\\$1') + '"'; +} + +/** + * Class to represent a content type. + * @private + */ +function ContentType(type) { + this.parameters = (0, _create2.default)(null); + this.type = type; +} + +},{"babel-runtime/core-js/object/create":22,"babel-runtime/core-js/object/keys":30,"babel-runtime/helpers/typeof":39}],54:[function(require,module,exports){ +/*! + * copy-to - index.js + * Copyright(c) 2014 dead_horse + * MIT Licensed + */ + +'use strict'; + +/** + * slice() reference. + */ + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var slice = Array.prototype.slice; + +/** + * Expose copy + * + * ``` + * copy({foo: 'nar', hello: 'copy'}).to({hello: 'world'}); + * copy({foo: 'nar', hello: 'copy'}).toCover({hello: 'world'}); + * ``` + * + * @param {Object} src + * @return {Copy} + */ + +module.exports = Copy; + +/** + * Copy + * @param {Object} src + * @param {Boolean} withAccess + */ + +function Copy(src, withAccess) { + if (!(this instanceof Copy)) return new Copy(src, withAccess); + this.src = src; + this._withAccess = withAccess; +} + +/** + * copy properties include getter and setter + * @param {[type]} val [description] + * @return {[type]} [description] + */ + +Copy.prototype.withAccess = function (w) { + this._withAccess = w !== false; + return this; +}; + +/** + * pick keys in src + * + * @api: public + */ + +Copy.prototype.pick = function (keys) { + if (!Array.isArray(keys)) { + keys = slice.call(arguments); + } + if (keys.length) { + this.keys = keys; + } + return this; +}; + +/** + * copy src to target, + * do not cover any property target has + * @param {Object} to + * + * @api: public + */ + +Copy.prototype.to = function (to) { + to = to || {}; + + if (!this.src) return to; + var keys = this.keys || (0, _keys2.default)(this.src); + + if (!this._withAccess) { + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + if (to[key] !== undefined) continue; + to[key] = this.src[key]; + } + return to; + } + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!notDefined(to, key)) continue; + var getter = this.src.__lookupGetter__(key); + var setter = this.src.__lookupSetter__(key); + if (getter) to.__defineGetter__(key, getter); + if (setter) to.__defineSetter__(key, setter); + + if (!getter && !setter) { + to[key] = this.src[key]; + } + } + return to; +}; + +/** + * copy src to target, + * override any property target has + * @param {Object} to + * + * @api: public + */ + +Copy.prototype.toCover = function (to) { + var keys = this.keys || (0, _keys2.default)(this.src); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + delete to[key]; + var getter = this.src.__lookupGetter__(key); + var setter = this.src.__lookupSetter__(key); + if (getter) to.__defineGetter__(key, getter); + if (setter) to.__defineSetter__(key, setter); + + if (!getter && !setter) { + to[key] = this.src[key]; + } + } +}; + +Copy.prototype.override = Copy.prototype.toCover; + +/** + * append another object to src + * @param {Obj} obj + * @return {Copy} + */ + +Copy.prototype.and = function (obj) { + var src = {}; + this.to(src); + this.src = obj; + this.to(src); + this.src = src; + + return this; +}; + +/** + * check obj[key] if not defiend + * @param {Object} obj + * @param {String} key + * @return {Boolean} + */ + +function notDefined(obj, key) { + return obj[key] === undefined && obj.__lookupGetter__(key) === undefined && obj.__lookupSetter__(key) === undefined; +} + +},{"babel-runtime/core-js/object/keys":30}],55:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.string.iterator'); +require('../../modules/es6.array.from'); +module.exports = require('../../modules/_core').Array.from; + +},{"../../modules/_core":86,"../../modules/es6.array.from":152,"../../modules/es6.string.iterator":170}],56:[function(require,module,exports){ +'use strict'; + +require('../modules/web.immediate'); +module.exports = require('../modules/_core').clearImmediate; + +},{"../modules/_core":86,"../modules/web.immediate":175}],57:[function(require,module,exports){ +'use strict'; + +require('../modules/web.dom.iterable'); +require('../modules/es6.string.iterator'); +module.exports = require('../modules/core.get-iterator'); + +},{"../modules/core.get-iterator":151,"../modules/es6.string.iterator":170,"../modules/web.dom.iterable":174}],58:[function(require,module,exports){ +'use strict'; + +var _stringify = require('babel-runtime/core-js/json/stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var core = require('../../modules/_core'), + $JSON = core.JSON || (core.JSON = { stringify: _stringify2.default }); +module.exports = function stringify(it) { + // eslint-disable-line no-unused-vars + return $JSON.stringify.apply($JSON, arguments); +}; + +},{"../../modules/_core":86,"babel-runtime/core-js/json/stringify":18}],59:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.number.is-finite'); +module.exports = require('../../modules/_core').Number.isFinite; + +},{"../../modules/_core":86,"../../modules/es6.number.is-finite":154}],60:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.number.is-nan'); +module.exports = require('../../modules/_core').Number.isNaN; + +},{"../../modules/_core":86,"../../modules/es6.number.is-nan":155}],61:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.number.max-safe-integer'); +module.exports = 0x1fffffffffffff; + +},{"../../modules/es6.number.max-safe-integer":156}],62:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.create'); +var $Object = require('../../modules/_core').Object; +module.exports = function create(P, D) { + return $Object.create(P, D); +}; + +},{"../../modules/_core":86,"../../modules/es6.object.create":157}],63:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.define-properties'); +var $Object = require('../../modules/_core').Object; +module.exports = function defineProperties(T, D) { + return $Object.defineProperties(T, D); +}; + +},{"../../modules/_core":86,"../../modules/es6.object.define-properties":158}],64:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.define-property'); +var $Object = require('../../modules/_core').Object; +module.exports = function defineProperty(it, key, desc) { + return $Object.defineProperty(it, key, desc); +}; + +},{"../../modules/_core":86,"../../modules/es6.object.define-property":159}],65:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.get-own-property-descriptor'); +var $Object = require('../../modules/_core').Object; +module.exports = function getOwnPropertyDescriptor(it, key) { + return $Object.getOwnPropertyDescriptor(it, key); +}; + +},{"../../modules/_core":86,"../../modules/es6.object.get-own-property-descriptor":160}],66:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.get-own-property-names'); +var $Object = require('../../modules/_core').Object; +module.exports = function getOwnPropertyNames(it) { + return $Object.getOwnPropertyNames(it); +}; + +},{"../../modules/_core":86,"../../modules/es6.object.get-own-property-names":161}],67:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.symbol'); +module.exports = require('../../modules/_core').Object.getOwnPropertySymbols; + +},{"../../modules/_core":86,"../../modules/es6.symbol":171}],68:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.get-prototype-of'); +module.exports = require('../../modules/_core').Object.getPrototypeOf; + +},{"../../modules/_core":86,"../../modules/es6.object.get-prototype-of":162}],69:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.is-extensible'); +module.exports = require('../../modules/_core').Object.isExtensible; + +},{"../../modules/_core":86,"../../modules/es6.object.is-extensible":163}],70:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.keys'); +module.exports = require('../../modules/_core').Object.keys; + +},{"../../modules/_core":86,"../../modules/es6.object.keys":164}],71:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.prevent-extensions'); +module.exports = require('../../modules/_core').Object.preventExtensions; + +},{"../../modules/_core":86,"../../modules/es6.object.prevent-extensions":165}],72:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.object.set-prototype-of'); +module.exports = require('../../modules/_core').Object.setPrototypeOf; + +},{"../../modules/_core":86,"../../modules/es6.object.set-prototype-of":166}],73:[function(require,module,exports){ +'use strict'; + +require('../modules/es6.object.to-string'); +require('../modules/es6.string.iterator'); +require('../modules/web.dom.iterable'); +require('../modules/es6.promise'); +module.exports = require('../modules/_core').Promise; + +},{"../modules/_core":86,"../modules/es6.object.to-string":167,"../modules/es6.promise":168,"../modules/es6.string.iterator":170,"../modules/web.dom.iterable":174}],74:[function(require,module,exports){ +'use strict'; + +require('../modules/web.immediate'); +module.exports = require('../modules/_core').setImmediate; + +},{"../modules/_core":86,"../modules/web.immediate":175}],75:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.string.from-code-point'); +module.exports = require('../../modules/_core').String.fromCodePoint; + +},{"../../modules/_core":86,"../../modules/es6.string.from-code-point":169}],76:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.symbol'); +require('../../modules/es6.object.to-string'); +require('../../modules/es7.symbol.async-iterator'); +require('../../modules/es7.symbol.observable'); +module.exports = require('../../modules/_core').Symbol; + +},{"../../modules/_core":86,"../../modules/es6.object.to-string":167,"../../modules/es6.symbol":171,"../../modules/es7.symbol.async-iterator":172,"../../modules/es7.symbol.observable":173}],77:[function(require,module,exports){ +'use strict'; + +require('../../modules/es6.string.iterator'); +require('../../modules/web.dom.iterable'); +module.exports = require('../../modules/_wks-ext').f('iterator'); + +},{"../../modules/_wks-ext":148,"../../modules/es6.string.iterator":170,"../../modules/web.dom.iterable":174}],78:[function(require,module,exports){ +'use strict'; + +module.exports = require('../../modules/_wks-ext').f('species'); + +},{"../../modules/_wks-ext":148}],79:[function(require,module,exports){ +'use strict'; + +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +},{}],80:[function(require,module,exports){ +"use strict"; + +module.exports = function () {/* empty */}; + +},{}],81:[function(require,module,exports){ +'use strict'; + +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) { + throw TypeError(name + ': incorrect invocation!'); + }return it; +}; + +},{}],82:[function(require,module,exports){ +'use strict'; + +var isObject = require('./_is-object'); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +},{"./_is-object":106}],83:[function(require,module,exports){ +'use strict'; + +// false -> Array#indexOf +// true -> Array#includes +var toIObject = require('./_to-iobject'), + toLength = require('./_to-length'), + toIndex = require('./_to-index'); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this), + length = toLength(O.length), + index = toIndex(fromIndex, length), + value; + // Array#includes uses SameValueZero equality algorithm + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + if (value != value) return true; + // Array#toIndex ignores holes, Array#includes - not + } else for (; length > index; index++) { + if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } + }return !IS_INCLUDES && -1; + }; +}; + +},{"./_to-index":140,"./_to-iobject":142,"./_to-length":143}],84:[function(require,module,exports){ +'use strict'; + +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = require('./_cof'), + TAG = require('./_wks')('toStringTag') +// ES3 wrong here +, + ARG = cof(function () { + return arguments; +}()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function tryGet(it, key) { + try { + return it[key]; + } catch (e) {/* empty */} +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +},{"./_cof":85,"./_wks":149}],85:[function(require,module,exports){ +"use strict"; + +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +},{}],86:[function(require,module,exports){ +'use strict'; + +var core = module.exports = { version: '2.4.0' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +},{}],87:[function(require,module,exports){ +'use strict'; + +var $defineProperty = require('./_object-dp'), + createDesc = require('./_property-desc'); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value; +}; + +},{"./_object-dp":118,"./_property-desc":129}],88:[function(require,module,exports){ +'use strict'; + +// optional / simple context binding +var aFunction = require('./_a-function'); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: + return function (a) { + return fn.call(that, a); + }; + case 2: + return function (a, b) { + return fn.call(that, a, b); + }; + case 3: + return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function () /* ...args */{ + return fn.apply(that, arguments); + }; +}; + +},{"./_a-function":79}],89:[function(require,module,exports){ +"use strict"; + +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +},{}],90:[function(require,module,exports){ +'use strict'; + +// Thank's IE8 for his funny defineProperty +module.exports = !require('./_fails')(function () { + return Object.defineProperty({}, 'a', { get: function get() { + return 7; + } }).a != 7; +}); + +},{"./_fails":95}],91:[function(require,module,exports){ +'use strict'; + +var isObject = require('./_is-object'), + document = require('./_global').document +// in old IE typeof document.createElement is 'object' +, + is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + +},{"./_global":97,"./_is-object":106}],92:[function(require,module,exports){ +'use strict'; + +// IE 8- don't enum bug keys +module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); + +},{}],93:[function(require,module,exports){ +'use strict'; + +// all enumerable object keys, includes symbols +var getKeys = require('./_object-keys'), + gOPS = require('./_object-gops'), + pIE = require('./_object-pie'); +module.exports = function (it) { + var result = getKeys(it), + getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it), + isEnum = pIE.f, + i = 0, + key; + while (symbols.length > i) { + if (isEnum.call(it, key = symbols[i++])) result.push(key); + } + }return result; +}; + +},{"./_object-gops":123,"./_object-keys":126,"./_object-pie":127}],94:[function(require,module,exports){ +'use strict'; + +var global = require('./_global'), + core = require('./_core'), + ctx = require('./_ctx'), + hide = require('./_hide'), + PROTOTYPE = 'prototype'; + +var $export = function $export(type, name, source) { + var IS_FORCED = type & $export.F, + IS_GLOBAL = type & $export.G, + IS_STATIC = type & $export.S, + IS_PROTO = type & $export.P, + IS_BIND = type & $export.B, + IS_WRAP = type & $export.W, + exports = IS_GLOBAL ? core : core[name] || (core[name] = {}), + expProto = exports[PROTOTYPE], + target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE], + key, + own, + out; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if (own && key in exports) continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? function (C) { + var F = function F(a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: + return new C(); + case 1: + return new C(a); + case 2: + return new C(a, b); + }return new C(a, b, c); + }return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + }(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if (IS_PROTO) { + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + } + } +}; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":86,"./_ctx":88,"./_global":97,"./_hide":99}],95:[function(require,module,exports){ +"use strict"; + +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +},{}],96:[function(require,module,exports){ +'use strict'; + +var ctx = require('./_ctx'), + call = require('./_iter-call'), + isArrayIter = require('./_is-array-iter'), + anObject = require('./_an-object'), + toLength = require('./_to-length'), + getIterFn = require('./core.get-iterator-method'), + BREAK = {}, + RETURN = {}; +var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { + return iterable; + } : getIterFn(iterable), + f = ctx(fn, that, entries ? 2 : 1), + index = 0, + length, + step, + iterator, + result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +_exports.BREAK = BREAK; +_exports.RETURN = RETURN; + +},{"./_an-object":82,"./_ctx":88,"./_is-array-iter":104,"./_iter-call":107,"./_to-length":143,"./core.get-iterator-method":150}],97:[function(require,module,exports){ +'use strict'; + +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +},{}],98:[function(require,module,exports){ +"use strict"; + +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +},{}],99:[function(require,module,exports){ +'use strict'; + +var dP = require('./_object-dp'), + createDesc = require('./_property-desc'); +module.exports = require('./_descriptors') ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +},{"./_descriptors":90,"./_object-dp":118,"./_property-desc":129}],100:[function(require,module,exports){ +'use strict'; + +module.exports = require('./_global').document && document.documentElement; + +},{"./_global":97}],101:[function(require,module,exports){ +'use strict'; + +module.exports = !require('./_descriptors') && !require('./_fails')(function () { + return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function get() { + return 7; + } }).a != 7; +}); + +},{"./_descriptors":90,"./_dom-create":91,"./_fails":95}],102:[function(require,module,exports){ +"use strict"; + +// fast apply, http://jsperf.lnkit.com/fast-apply/5 +module.exports = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: + return un ? fn() : fn.call(that); + case 1: + return un ? fn(args[0]) : fn.call(that, args[0]); + case 2: + return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); + case 3: + return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); + case 4: + return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); + }return fn.apply(that, args); +}; + +},{}],103:[function(require,module,exports){ +'use strict'; + +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = require('./_cof'); +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +},{"./_cof":85}],104:[function(require,module,exports){ +'use strict'; + +// check on default Array iterator +var Iterators = require('./_iterators'), + ITERATOR = require('./_wks')('iterator'), + ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +},{"./_iterators":112,"./_wks":149}],105:[function(require,module,exports){ +'use strict'; + +// 7.2.2 IsArray(argument) +var cof = require('./_cof'); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + +},{"./_cof":85}],106:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = function (it) { + return (typeof it === 'undefined' ? 'undefined' : (0, _typeof3.default)(it)) === 'object' ? it !== null : typeof it === 'function'; +}; + +},{"babel-runtime/helpers/typeof":39}],107:[function(require,module,exports){ +'use strict'; + +// call something on iterator step with safe closing on error +var anObject = require('./_an-object'); +module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + +},{"./_an-object":82}],108:[function(require,module,exports){ +'use strict'; + +var create = require('./_object-create'), + descriptor = require('./_property-desc'), + setToStringTag = require('./_set-to-string-tag'), + IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { + return this; +}); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +},{"./_hide":99,"./_object-create":117,"./_property-desc":129,"./_set-to-string-tag":134,"./_wks":149}],109:[function(require,module,exports){ +'use strict'; + +var LIBRARY = require('./_library'), + $export = require('./_export'), + redefine = require('./_redefine'), + hide = require('./_hide'), + has = require('./_has'), + Iterators = require('./_iterators'), + $iterCreate = require('./_iter-create'), + setToStringTag = require('./_set-to-string-tag'), + getPrototypeOf = require('./_object-gpo'), + ITERATOR = require('./_wks')('iterator'), + BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` +, + FF_ITERATOR = '@@iterator', + KEYS = 'keys', + VALUES = 'values'; + +var returnThis = function returnThis() { + return this; +}; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function getMethod(kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: + return function keys() { + return new Constructor(this, kind); + }; + case VALUES: + return function values() { + return new Constructor(this, kind); + }; + }return function entries() { + return new Constructor(this, kind); + }; + }; + var TAG = NAME + ' Iterator', + DEF_VALUES = DEFAULT == VALUES, + VALUES_BUG = false, + proto = Base.prototype, + $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT], + $default = $native || getMethod(DEFAULT), + $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined, + $anyNative = NAME == 'Array' ? proto.entries || $native : $native, + methods, + key, + IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { + return $native.call(this); + }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +},{"./_export":94,"./_has":98,"./_hide":99,"./_iter-create":108,"./_iterators":112,"./_library":114,"./_object-gpo":124,"./_redefine":131,"./_set-to-string-tag":134,"./_wks":149}],110:[function(require,module,exports){ +'use strict'; + +var _from = require('babel-runtime/core-js/array/from'); + +var _from2 = _interopRequireDefault(_from); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var ITERATOR = require('./_wks')('iterator'), + SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { + SAFE_CLOSING = true; + }; + (0, _from2.default)(riter, function () { + throw 2; + }); +} catch (e) {/* empty */} + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7], + iter = arr[ITERATOR](); + iter.next = function () { + return { done: safe = true }; + }; + arr[ITERATOR] = function () { + return iter; + }; + exec(arr); + } catch (e) {/* empty */} + return safe; +}; + +},{"./_wks":149,"babel-runtime/core-js/array/from":15}],111:[function(require,module,exports){ +"use strict"; + +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + +},{}],112:[function(require,module,exports){ +"use strict"; + +module.exports = {}; + +},{}],113:[function(require,module,exports){ +'use strict'; + +var getKeys = require('./_object-keys'), + toIObject = require('./_to-iobject'); +module.exports = function (object, el) { + var O = toIObject(object), + keys = getKeys(O), + length = keys.length, + index = 0, + key; + while (length > index) { + if (O[key = keys[index++]] === el) return key; + } +}; + +},{"./_object-keys":126,"./_to-iobject":142}],114:[function(require,module,exports){ +"use strict"; + +module.exports = true; + +},{}],115:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _preventExtensions = require('babel-runtime/core-js/object/prevent-extensions'); + +var _preventExtensions2 = _interopRequireDefault(_preventExtensions); + +var _isExtensible = require('babel-runtime/core-js/object/is-extensible'); + +var _isExtensible2 = _interopRequireDefault(_isExtensible); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var META = require('./_uid')('meta'), + isObject = require('./_is-object'), + has = require('./_has'), + setDesc = require('./_object-dp').f, + id = 0; +var isExtensible = _isExtensible2.default || function () { + return true; +}; +var FREEZE = !require('./_fails')(function () { + return isExtensible((0, _preventExtensions2.default)({})); +}); +var setMeta = function setMeta(it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function fastKey(it, create) { + // return primitive with prefix + if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : (0, _typeof3.default)(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + }return it[META].i; +}; +var getWeak = function getWeak(it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + }return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function onFreeze(it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + +},{"./_fails":95,"./_has":98,"./_is-object":106,"./_object-dp":118,"./_uid":146,"babel-runtime/core-js/object/is-extensible":29,"babel-runtime/core-js/object/prevent-extensions":31,"babel-runtime/helpers/typeof":39}],116:[function(require,module,exports){ +'use strict'; + +var global = require('./_global'), + macrotask = require('./_task').set, + Observer = global.MutationObserver || global.WebKitMutationObserver, + process = global.process, + Promise = global.Promise, + isNode = require('./_cof')(process) == 'process'; + +module.exports = function () { + var head, last, notify; + + var flush = function flush() { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify();else last = undefined; + throw e; + } + }last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function notify() { + process.nextTick(flush); + }; + // browsers with MutationObserver + } else if (Observer) { + var toggle = true, + node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + notify = function notify() { + node.data = toggle = !toggle; + }; + // environments with maybe non-completely correct, but existent Promise + } else if (Promise && Promise.resolve) { + var promise = Promise.resolve(); + notify = function notify() { + promise.then(flush); + }; + // for other environments - macrotask based on: + // - setImmediate + // - MessageChannel + // - window.postMessag + // - onreadystatechange + // - setTimeout + } else { + notify = function notify() { + // strange IE + webpack dev server bug - use .call(global) + macrotask.call(global, flush); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + }last = task; + }; +}; + +},{"./_cof":85,"./_global":97,"./_task":139}],117:[function(require,module,exports){ +'use strict'; + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = require('./_an-object'), + dPs = require('./_object-dps'), + enumBugKeys = require('./_enum-bug-keys'), + IE_PROTO = require('./_shared-key')('IE_PROTO'), + Empty = function Empty() {/* empty */}, + PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var _createDict = function createDict() { + // Thrash, waste and sodomy: IE GC bug + var iframe = require('./_dom-create')('iframe'), + i = enumBugKeys.length, + lt = '<', + gt = '>', + iframeDocument; + iframe.style.display = 'none'; + require('./_html').appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + _createDict = iframeDocument.F; + while (i--) { + delete _createDict[PROTOTYPE][enumBugKeys[i]]; + }return _createDict(); +}; + +module.exports = _create2.default || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = _createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + +},{"./_an-object":82,"./_dom-create":91,"./_enum-bug-keys":92,"./_html":100,"./_object-dps":119,"./_shared-key":135,"babel-runtime/core-js/object/create":22}],118:[function(require,module,exports){ +'use strict'; + +var _defineProperty = require('babel-runtime/core-js/object/define-property'); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var anObject = require('./_an-object'), + IE8_DOM_DEFINE = require('./_ie8-dom-define'), + toPrimitive = require('./_to-primitive'), + dP = _defineProperty2.default; + +exports.f = require('./_descriptors') ? _defineProperty2.default : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) {/* empty */} + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +},{"./_an-object":82,"./_descriptors":90,"./_ie8-dom-define":101,"./_to-primitive":145,"babel-runtime/core-js/object/define-property":24}],119:[function(require,module,exports){ +'use strict'; + +var _defineProperties = require('babel-runtime/core-js/object/define-properties'); + +var _defineProperties2 = _interopRequireDefault(_defineProperties); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var dP = require('./_object-dp'), + anObject = require('./_an-object'), + getKeys = require('./_object-keys'); + +module.exports = require('./_descriptors') ? _defineProperties2.default : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties), + length = keys.length, + i = 0, + P; + while (length > i) { + dP.f(O, P = keys[i++], Properties[P]); + }return O; +}; + +},{"./_an-object":82,"./_descriptors":90,"./_object-dp":118,"./_object-keys":126,"babel-runtime/core-js/object/define-properties":23}],120:[function(require,module,exports){ +'use strict'; + +var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor'); + +var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var pIE = require('./_object-pie'), + createDesc = require('./_property-desc'), + toIObject = require('./_to-iobject'), + toPrimitive = require('./_to-primitive'), + has = require('./_has'), + IE8_DOM_DEFINE = require('./_ie8-dom-define'), + gOPD = _getOwnPropertyDescriptor2.default; + +exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) {/* empty */} + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; + +},{"./_descriptors":90,"./_has":98,"./_ie8-dom-define":101,"./_object-pie":127,"./_property-desc":129,"./_to-iobject":142,"./_to-primitive":145,"babel-runtime/core-js/object/get-own-property-descriptor":25}],121:[function(require,module,exports){ +'use strict'; + +var _getOwnPropertyNames = require('babel-runtime/core-js/object/get-own-property-names'); + +var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var toIObject = require('./_to-iobject'), + gOPN = require('./_object-gopn').f, + toString = {}.toString; + +var windowNames = (typeof window === 'undefined' ? 'undefined' : (0, _typeof3.default)(window)) == 'object' && window && _getOwnPropertyNames2.default ? (0, _getOwnPropertyNames2.default)(window) : []; + +var getWindowNames = function getWindowNames(it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; + +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; + +},{"./_object-gopn":122,"./_to-iobject":142,"babel-runtime/core-js/object/get-own-property-names":26,"babel-runtime/helpers/typeof":39}],122:[function(require,module,exports){ +'use strict'; + +var _getOwnPropertyNames = require('babel-runtime/core-js/object/get-own-property-names'); + +var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = require('./_object-keys-internal'), + hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); + +exports.f = _getOwnPropertyNames2.default || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; + +},{"./_enum-bug-keys":92,"./_object-keys-internal":125,"babel-runtime/core-js/object/get-own-property-names":26}],123:[function(require,module,exports){ +"use strict"; + +var _getOwnPropertySymbols = require("babel-runtime/core-js/object/get-own-property-symbols"); + +var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.f = _getOwnPropertySymbols2.default; + +},{"babel-runtime/core-js/object/get-own-property-symbols":27}],124:[function(require,module,exports){ +'use strict'; + +var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = require('./_has'), + toObject = require('./_to-object'), + IE_PROTO = require('./_shared-key')('IE_PROTO'), + ObjectProto = Object.prototype; + +module.exports = _getPrototypeOf2.default || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + }return O instanceof Object ? ObjectProto : null; +}; + +},{"./_has":98,"./_shared-key":135,"./_to-object":144,"babel-runtime/core-js/object/get-prototype-of":28}],125:[function(require,module,exports){ +'use strict'; + +var has = require('./_has'), + toIObject = require('./_to-iobject'), + arrayIndexOf = require('./_array-includes')(false), + IE_PROTO = require('./_shared-key')('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object), + i = 0, + result = [], + key; + for (key in O) { + if (key != IE_PROTO) has(O, key) && result.push(key); + } // Don't enum bug & hidden keys + while (names.length > i) { + if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + }return result; +}; + +},{"./_array-includes":83,"./_has":98,"./_shared-key":135,"./_to-iobject":142}],126:[function(require,module,exports){ +'use strict'; + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = require('./_object-keys-internal'), + enumBugKeys = require('./_enum-bug-keys'); + +module.exports = _keys2.default || function keys(O) { + return $keys(O, enumBugKeys); +}; + +},{"./_enum-bug-keys":92,"./_object-keys-internal":125,"babel-runtime/core-js/object/keys":30}],127:[function(require,module,exports){ +"use strict"; + +exports.f = {}.propertyIsEnumerable; + +},{}],128:[function(require,module,exports){ +'use strict'; + +// most Object methods by ES6 should accept primitives +var $export = require('./_export'), + core = require('./_core'), + fails = require('./_fails'); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY], + exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { + fn(1); + }), 'Object', exp); +}; + +},{"./_core":86,"./_export":94,"./_fails":95}],129:[function(require,module,exports){ +"use strict"; + +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],130:[function(require,module,exports){ +'use strict'; + +var hide = require('./_hide'); +module.exports = function (target, src, safe) { + for (var key in src) { + if (safe && target[key]) target[key] = src[key];else hide(target, key, src[key]); + }return target; +}; + +},{"./_hide":99}],131:[function(require,module,exports){ +'use strict'; + +module.exports = require('./_hide'); + +},{"./_hide":99}],132:[function(require,module,exports){ +'use strict'; + +var _setPrototypeOf = require('babel-runtime/core-js/object/set-prototype-of'); + +var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = require('./_is-object'), + anObject = require('./_an-object'); +var check = function check(O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: _setPrototypeOf2.default || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { + buggy = true; + } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto;else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + +},{"./_an-object":82,"./_ctx":88,"./_is-object":106,"./_object-gopd":120,"babel-runtime/core-js/object/set-prototype-of":32}],133:[function(require,module,exports){ +'use strict'; + +var global = require('./_global'), + core = require('./_core'), + dP = require('./_object-dp'), + DESCRIPTORS = require('./_descriptors'), + SPECIES = require('./_wks')('species'); + +module.exports = function (KEY) { + var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function get() { + return this; + } + }); +}; + +},{"./_core":86,"./_descriptors":90,"./_global":97,"./_object-dp":118,"./_wks":149}],134:[function(require,module,exports){ +'use strict'; + +var def = require('./_object-dp').f, + has = require('./_has'), + TAG = require('./_wks')('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +},{"./_has":98,"./_object-dp":118,"./_wks":149}],135:[function(require,module,exports){ +'use strict'; + +var shared = require('./_shared')('keys'), + uid = require('./_uid'); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +},{"./_shared":136,"./_uid":146}],136:[function(require,module,exports){ +'use strict'; + +var global = require('./_global'), + SHARED = '__core-js_shared__', + store = global[SHARED] || (global[SHARED] = {}); +module.exports = function (key) { + return store[key] || (store[key] = {}); +}; + +},{"./_global":97}],137:[function(require,module,exports){ +'use strict'; + +// 7.3.20 SpeciesConstructor(O, defaultConstructor) +var anObject = require('./_an-object'), + aFunction = require('./_a-function'), + SPECIES = require('./_wks')('species'); +module.exports = function (O, D) { + var C = anObject(O).constructor, + S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + +},{"./_a-function":79,"./_an-object":82,"./_wks":149}],138:[function(require,module,exports){ +'use strict'; + +var toInteger = require('./_to-integer'), + defined = require('./_defined'); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)), + i = toInteger(pos), + l = s.length, + a, + b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + +},{"./_defined":89,"./_to-integer":141}],139:[function(require,module,exports){ +'use strict'; + +var ctx = require('./_ctx'), + invoke = require('./_invoke'), + html = require('./_html'), + cel = require('./_dom-create'), + global = require('./_global'), + process = global.process, + setTask = global.setImmediate, + clearTask = global.clearImmediate, + MessageChannel = global.MessageChannel, + counter = 0, + queue = {}, + ONREADYSTATECHANGE = 'onreadystatechange', + defer, + channel, + port; +var run = function run() { + var id = +this; + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function listener(event) { + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if (!setTask || !clearTask) { + setTask = function setImmediate(fn) { + var args = [], + i = 1; + while (arguments.length > i) { + args.push(arguments[i++]); + }queue[++counter] = function () { + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (require('./_cof')(process) == 'process') { + defer = function defer(id) { + process.nextTick(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(port.postMessage, port, 1); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { + defer = function defer(id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function defer(id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function defer(id) { + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; + +},{"./_cof":85,"./_ctx":88,"./_dom-create":91,"./_global":97,"./_html":100,"./_invoke":102}],140:[function(require,module,exports){ +'use strict'; + +var toInteger = require('./_to-integer'), + max = Math.max, + min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + +},{"./_to-integer":141}],141:[function(require,module,exports){ +"use strict"; + +// 7.1.4 ToInteger +var ceil = Math.ceil, + floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +},{}],142:[function(require,module,exports){ +'use strict'; + +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = require('./_iobject'), + defined = require('./_defined'); +module.exports = function (it) { + return IObject(defined(it)); +}; + +},{"./_defined":89,"./_iobject":103}],143:[function(require,module,exports){ +'use strict'; + +// 7.1.15 ToLength +var toInteger = require('./_to-integer'), + min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +},{"./_to-integer":141}],144:[function(require,module,exports){ +'use strict'; + +// 7.1.13 ToObject(argument) +var defined = require('./_defined'); +module.exports = function (it) { + return Object(defined(it)); +}; + +},{"./_defined":89}],145:[function(require,module,exports){ +'use strict'; + +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = require('./_is-object'); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +},{"./_is-object":106}],146:[function(require,module,exports){ +'use strict'; + +var id = 0, + px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +},{}],147:[function(require,module,exports){ +'use strict'; + +var global = require('./_global'), + core = require('./_core'), + LIBRARY = require('./_library'), + wksExt = require('./_wks-ext'), + defineProperty = require('./_object-dp').f; +module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +}; + +},{"./_core":86,"./_global":97,"./_library":114,"./_object-dp":118,"./_wks-ext":148}],148:[function(require,module,exports){ +'use strict'; + +exports.f = require('./_wks'); + +},{"./_wks":149}],149:[function(require,module,exports){ +'use strict'; + +var store = require('./_shared')('wks'), + uid = require('./_uid'), + _Symbol = require('./_global').Symbol, + USE_SYMBOL = typeof _Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + +},{"./_global":97,"./_shared":136,"./_uid":146}],150:[function(require,module,exports){ +'use strict'; + +var classof = require('./_classof'), + ITERATOR = require('./_wks')('iterator'), + Iterators = require('./_iterators'); +module.exports = require('./_core').getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; +}; + +},{"./_classof":84,"./_core":86,"./_iterators":112,"./_wks":149}],151:[function(require,module,exports){ +'use strict'; + +var anObject = require('./_an-object'), + get = require('./core.get-iterator-method'); +module.exports = require('./_core').getIterator = function (it) { + var iterFn = get(it); + if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); +}; + +},{"./_an-object":82,"./_core":86,"./core.get-iterator-method":150}],152:[function(require,module,exports){ +'use strict'; + +var _from = require('babel-runtime/core-js/array/from'); + +var _from2 = _interopRequireDefault(_from); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var ctx = require('./_ctx'), + $export = require('./_export'), + toObject = require('./_to-object'), + call = require('./_iter-call'), + isArrayIter = require('./_is-array-iter'), + toLength = require('./_to-length'), + createProperty = require('./_create-property'), + getIterFn = require('./core.get-iterator-method'); + +$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { + (0, _from2.default)(iter); +}), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /*, mapfn = undefined, thisArg = undefined*/) { + var O = toObject(arrayLike), + C = typeof this == 'function' ? this : Array, + aLen = arguments.length, + mapfn = aLen > 1 ? arguments[1] : undefined, + mapping = mapfn !== undefined, + index = 0, + iterFn = getIterFn(O), + length, + result, + step, + iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +},{"./_create-property":87,"./_ctx":88,"./_export":94,"./_is-array-iter":104,"./_iter-call":107,"./_iter-detect":110,"./_to-length":143,"./_to-object":144,"./core.get-iterator-method":150,"babel-runtime/core-js/array/from":15}],153:[function(require,module,exports){ +'use strict'; + +var addToUnscopables = require('./_add-to-unscopables'), + step = require('./_iter-step'), + Iterators = require('./_iterators'), + toIObject = require('./_to-iobject'); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t, + kind = this._k, + index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + +},{"./_add-to-unscopables":80,"./_iter-define":109,"./_iter-step":111,"./_iterators":112,"./_to-iobject":142}],154:[function(require,module,exports){ +'use strict'; + +// 20.1.2.2 Number.isFinite(number) +var $export = require('./_export'), + _isFinite = require('./_global').isFinite; + +$export($export.S, 'Number', { + isFinite: function isFinite(it) { + return typeof it == 'number' && _isFinite(it); + } +}); + +},{"./_export":94,"./_global":97}],155:[function(require,module,exports){ +'use strict'; + +// 20.1.2.4 Number.isNaN(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { + isNaN: function isNaN(number) { + return number != number; + } +}); + +},{"./_export":94}],156:[function(require,module,exports){ +'use strict'; + +// 20.1.2.6 Number.MAX_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + +},{"./_export":94}],157:[function(require,module,exports){ +'use strict'; + +var $export = require('./_export'); +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +$export($export.S, 'Object', { create: require('./_object-create') }); + +},{"./_export":94,"./_object-create":117}],158:[function(require,module,exports){ +'use strict'; + +var $export = require('./_export'); +// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') }); + +},{"./_descriptors":90,"./_export":94,"./_object-dps":119}],159:[function(require,module,exports){ +'use strict'; + +var $export = require('./_export'); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); + +},{"./_descriptors":90,"./_export":94,"./_object-dp":118}],160:[function(require,module,exports){ +'use strict'; + +// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) +var toIObject = require('./_to-iobject'), + $getOwnPropertyDescriptor = require('./_object-gopd').f; + +require('./_object-sap')('getOwnPropertyDescriptor', function () { + return function getOwnPropertyDescriptor(it, key) { + return $getOwnPropertyDescriptor(toIObject(it), key); + }; +}); + +},{"./_object-gopd":120,"./_object-sap":128,"./_to-iobject":142}],161:[function(require,module,exports){ +'use strict'; + +// 19.1.2.7 Object.getOwnPropertyNames(O) +require('./_object-sap')('getOwnPropertyNames', function () { + return require('./_object-gopn-ext').f; +}); + +},{"./_object-gopn-ext":121,"./_object-sap":128}],162:[function(require,module,exports){ +'use strict'; + +// 19.1.2.9 Object.getPrototypeOf(O) +var toObject = require('./_to-object'), + $getPrototypeOf = require('./_object-gpo'); + +require('./_object-sap')('getPrototypeOf', function () { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; +}); + +},{"./_object-gpo":124,"./_object-sap":128,"./_to-object":144}],163:[function(require,module,exports){ +'use strict'; + +// 19.1.2.11 Object.isExtensible(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isExtensible', function ($isExtensible) { + return function isExtensible(it) { + return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; + }; +}); + +},{"./_is-object":106,"./_object-sap":128}],164:[function(require,module,exports){ +'use strict'; + +// 19.1.2.14 Object.keys(O) +var toObject = require('./_to-object'), + $keys = require('./_object-keys'); + +require('./_object-sap')('keys', function () { + return function keys(it) { + return $keys(toObject(it)); + }; +}); + +},{"./_object-keys":126,"./_object-sap":128,"./_to-object":144}],165:[function(require,module,exports){ +'use strict'; + +// 19.1.2.15 Object.preventExtensions(O) +var isObject = require('./_is-object'), + meta = require('./_meta').onFreeze; + +require('./_object-sap')('preventExtensions', function ($preventExtensions) { + return function preventExtensions(it) { + return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; + }; +}); + +},{"./_is-object":106,"./_meta":115,"./_object-sap":128}],166:[function(require,module,exports){ +'use strict'; + +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = require('./_export'); +$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set }); + +},{"./_export":94,"./_set-proto":132}],167:[function(require,module,exports){ +"use strict"; + +},{}],168:[function(require,module,exports){ +'use strict'; + +var LIBRARY = require('./_library'), + global = require('./_global'), + ctx = require('./_ctx'), + classof = require('./_classof'), + $export = require('./_export'), + isObject = require('./_is-object'), + aFunction = require('./_a-function'), + anInstance = require('./_an-instance'), + forOf = require('./_for-of'), + speciesConstructor = require('./_species-constructor'), + task = require('./_task').set, + microtask = require('./_microtask')(), + PROMISE = 'Promise', + TypeError = global.TypeError, + process = global.process, + $Promise = global[PROMISE], + process = global.process, + isNode = classof(process) == 'process', + empty = function empty() {/* empty */}, + Internal, + GenericPromiseCapability, + Wrapper; + +var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1), + FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; + } catch (e) {/* empty */} +}(); + +// helpers +var sameConstructor = function sameConstructor(a, b) { + // with library wrapper special case + return a === b || a === $Promise && b === Wrapper; +}; +var isThenable = function isThenable(it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var newPromiseCapability = function newPromiseCapability(C) { + return sameConstructor($Promise, C) ? new PromiseCapability(C) : new GenericPromiseCapability(C); +}; +var PromiseCapability = GenericPromiseCapability = function GenericPromiseCapability(C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aFunction(resolve); + this.reject = aFunction(reject); +}; +var perform = function perform(exec) { + try { + exec(); + } catch (e) { + return { error: e }; + } +}; +var notify = function notify(promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v, + ok = promise._s == 1, + i = 0; + var run = function run(reaction) { + var handler = ok ? reaction.ok : reaction.fail, + resolve = reaction.resolve, + reject = reaction.reject, + domain = reaction.domain, + result, + then; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value;else { + if (domain) domain.enter(); + result = handler(value); + if (domain) domain.exit(); + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + reject(e); + } + }; + while (chain.length > i) { + run(chain[i++]); + } // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); +}; +var onUnhandled = function onUnhandled(promise) { + task.call(global, function () { + var value = promise._v, + abrupt, + handler, + console; + if (isUnhandled(promise)) { + abrupt = perform(function () { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if (handler = global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + }promise._a = undefined; + if (abrupt) throw abrupt.error; + }); +}; +var isUnhandled = function isUnhandled(promise) { + if (promise._h == 1) return false; + var chain = promise._a || promise._c, + i = 0, + reaction; + while (chain.length > i) { + reaction = chain[i++]; + if (reaction.fail || !isUnhandled(reaction.promise)) return false; + }return true; +}; +var onHandleUnhandled = function onHandleUnhandled(promise) { + task.call(global, function () { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if (handler = global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); +}; +var $reject = function $reject(value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function $resolve(value) { + var promise = this, + then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } +}; + +// constructor polyfill +if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = require('./_redefine-all')($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function _catch(onRejected) { + return this.then(undefined, onRejected); + } + }); + PromiseCapability = function PromiseCapability() { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); +require('./_set-to-string-tag')($Promise, PROMISE); +require('./_set-species')(PROMISE); +Wrapper = require('./_core')[PROMISE]; + +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this), + $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + // instanceof instead of internal slot check because we should fix it without replacement native Promise core + if (x instanceof $Promise && sameConstructor(x.constructor, this)) return x; + var capability = newPromiseCapability(this), + $$resolve = capability.resolve; + $$resolve(x); + return capability.promise; + } +}); +$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) { + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this, + capability = newPromiseCapability(C), + resolve = capability.resolve, + reject = capability.reject; + var abrupt = perform(function () { + var values = [], + index = 0, + remaining = 1; + forOf(iterable, false, function (promise) { + var $index = index++, + alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (abrupt) reject(abrupt.error); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this, + capability = newPromiseCapability(C), + reject = capability.reject; + var abrupt = perform(function () { + forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (abrupt) reject(abrupt.error); + return capability.promise; + } +}); + +},{"./_a-function":79,"./_an-instance":81,"./_classof":84,"./_core":86,"./_ctx":88,"./_export":94,"./_for-of":96,"./_global":97,"./_is-object":106,"./_iter-detect":110,"./_library":114,"./_microtask":116,"./_redefine-all":130,"./_set-species":133,"./_set-to-string-tag":134,"./_species-constructor":137,"./_task":139,"./_wks":149}],169:[function(require,module,exports){ +'use strict'; + +var _fromCodePoint = require('babel-runtime/core-js/string/from-code-point'); + +var _fromCodePoint2 = _interopRequireDefault(_fromCodePoint); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var $export = require('./_export'), + toIndex = require('./_to-index'), + fromCharCode = String.fromCharCode, + $fromCodePoint = _fromCodePoint2.default; + +// length should be 1, old FF problem +$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x) { + // eslint-disable-line no-unused-vars + var res = [], + aLen = arguments.length, + i = 0, + code; + while (aLen > i) { + code = +arguments[i++]; + if (toIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); + res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)); + }return res.join(''); + } +}); + +},{"./_export":94,"./_to-index":140,"babel-runtime/core-js/string/from-code-point":35}],170:[function(require,module,exports){ +'use strict'; + +var $at = require('./_string-at')(true); + +// 21.1.3.27 String.prototype[@@iterator]() +require('./_iter-define')(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t, + index = this._i, + point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + +},{"./_iter-define":109,"./_string-at":138}],171:[function(require,module,exports){ +'use strict'; +// ECMAScript 6 symbols shim + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var global = require('./_global'), + has = require('./_has'), + DESCRIPTORS = require('./_descriptors'), + $export = require('./_export'), + redefine = require('./_redefine'), + META = require('./_meta').KEY, + $fails = require('./_fails'), + shared = require('./_shared'), + setToStringTag = require('./_set-to-string-tag'), + uid = require('./_uid'), + wks = require('./_wks'), + wksExt = require('./_wks-ext'), + wksDefine = require('./_wks-define'), + keyOf = require('./_keyof'), + enumKeys = require('./_enum-keys'), + isArray = require('./_is-array'), + anObject = require('./_an-object'), + toIObject = require('./_to-iobject'), + toPrimitive = require('./_to-primitive'), + createDesc = require('./_property-desc'), + _create = require('./_object-create'), + gOPNExt = require('./_object-gopn-ext'), + $GOPD = require('./_object-gopd'), + $DP = require('./_object-dp'), + $keys = require('./_object-keys'), + gOPD = $GOPD.f, + dP = $DP.f, + gOPN = gOPNExt.f, + $Symbol = global.Symbol, + $JSON = global.JSON, + _stringify = $JSON && $JSON.stringify, + PROTOTYPE = 'prototype', + HIDDEN = wks('_hidden'), + TO_PRIMITIVE = wks('toPrimitive'), + isEnum = {}.propertyIsEnumerable, + SymbolRegistry = shared('symbol-registry'), + AllSymbols = shared('symbols'), + OPSymbols = shared('op-symbols'), + ObjectProto = Object[PROTOTYPE], + USE_NATIVE = typeof $Symbol == 'function', + QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function get() { + return dP(this, 'a', { value: 7 }).a; + } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); +} : dP; + +var wrap = function wrap(tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && (0, _typeof3.default)($Symbol.iterator) == 'symbol' ? function (it) { + return (typeof it === 'undefined' ? 'undefined' : (0, _typeof3.default)(it)) == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + }return setSymbolDesc(it, key, D); + }return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)), + i = 0, + l = keys.length, + key; + while (l > i) { + $defineProperty(it, key = keys[i++], P[key]); + }return it; +}; +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + }return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto, + names = gOPN(IS_OP ? OPSymbols : toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + }return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function _Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function $set(value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames; + require('./_object-pie').f = $propertyIsEnumerable; + require('./_object-gops').f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !require('./_library')) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function (name) { + return wrap(wks(name)); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + +for (var symbols = +// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 +'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), i = 0; symbols.length > i;) { + wks(symbols[i++]); +}for (var symbols = $keys(wks.store), i = 0; symbols.length > i;) { + wksDefine(symbols[i++]); +}$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function _for(key) { + return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(key) { + if (isSymbol(key)) return keyOf(SymbolRegistry, key); + throw TypeError(key + ' is not a symbol!'); + }, + useSetter: function useSetter() { + setter = true; + }, + useSimple: function useSimple() { + setter = false; + } +}); + +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + var args = [it], + i = 1, + replacer, + $replacer; + while (arguments.length > i) { + args.push(arguments[i++]); + }replacer = args[1]; + if (typeof replacer == 'function') $replacer = replacer; + if ($replacer || !isArray(replacer)) replacer = function replacer(key, value) { + if ($replacer) value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); + +},{"./_an-object":82,"./_descriptors":90,"./_enum-keys":93,"./_export":94,"./_fails":95,"./_global":97,"./_has":98,"./_hide":99,"./_is-array":105,"./_keyof":113,"./_library":114,"./_meta":115,"./_object-create":117,"./_object-dp":118,"./_object-gopd":120,"./_object-gopn":122,"./_object-gopn-ext":121,"./_object-gops":123,"./_object-keys":126,"./_object-pie":127,"./_property-desc":129,"./_redefine":131,"./_set-to-string-tag":134,"./_shared":136,"./_to-iobject":142,"./_to-primitive":145,"./_uid":146,"./_wks":149,"./_wks-define":147,"./_wks-ext":148,"babel-runtime/helpers/typeof":39}],172:[function(require,module,exports){ +'use strict'; + +require('./_wks-define')('asyncIterator'); + +},{"./_wks-define":147}],173:[function(require,module,exports){ +'use strict'; + +require('./_wks-define')('observable'); + +},{"./_wks-define":147}],174:[function(require,module,exports){ +'use strict'; + +require('./es6.array.iterator'); +var global = require('./_global'), + hide = require('./_hide'), + Iterators = require('./_iterators'), + TO_STRING_TAG = require('./_wks')('toStringTag'); + +for (var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++) { + var NAME = collections[i], + Collection = global[NAME], + proto = Collection && Collection.prototype; + if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; +} + +},{"./_global":97,"./_hide":99,"./_iterators":112,"./_wks":149,"./es6.array.iterator":153}],175:[function(require,module,exports){ +'use strict'; + +var $export = require('./_export'), + $task = require('./_task'); +$export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear +}); + +},{"./_export":94,"./_task":139}],176:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return objectToString(e) === '[object Error]' || e instanceof Error; +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) +},{"../../is-buffer/index.js":199,"babel-runtime/helpers/typeof":39}],177:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +var intSize = 4; +var zeroBuffer = new Buffer(intSize);zeroBuffer.fill(0); +var chrsz = 8; + +function toArray(buf, bigEndian) { + if (buf.length % intSize !== 0) { + var len = buf.length + (intSize - buf.length % intSize); + buf = Buffer.concat([buf, zeroBuffer], len); + } + + var arr = []; + var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; + for (var i = 0; i < buf.length; i += intSize) { + arr.push(fn.call(buf, i)); + } + return arr; +} + +function toBuffer(arr, size, bigEndian) { + var buf = new Buffer(size); + var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; + for (var i = 0; i < arr.length; i++) { + fn.call(buf, arr[i], i * 4, true); + } + return buf; +} + +function hash(buf, fn, hashSize, bigEndian) { + if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); + var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); + return toBuffer(arr, hashSize, bigEndian); +} + +module.exports = { hash: hash }; + +},{"buffer":45}],178:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +var sha = require('./sha'); +var sha256 = require('./sha256'); +var rng = require('./rng'); +var md5 = require('./md5'); + +var algorithms = { + sha1: sha, + sha256: sha256, + md5: md5 +}; + +var blocksize = 64; +var zeroBuffer = new Buffer(blocksize);zeroBuffer.fill(0); +function hmac(fn, key, data) { + if (!Buffer.isBuffer(key)) key = new Buffer(key); + if (!Buffer.isBuffer(data)) data = new Buffer(data); + + if (key.length > blocksize) { + key = fn(key); + } else if (key.length < blocksize) { + key = Buffer.concat([key, zeroBuffer], blocksize); + } + + var ipad = new Buffer(blocksize), + opad = new Buffer(blocksize); + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36; + opad[i] = key[i] ^ 0x5C; + } + + var hash = fn(Buffer.concat([ipad, data])); + return fn(Buffer.concat([opad, hash])); +} + +function hash(alg, key) { + alg = alg || 'sha1'; + var fn = algorithms[alg]; + var bufs = []; + var length = 0; + if (!fn) error('algorithm:', alg, 'is not yet supported'); + return { + update: function update(data) { + if (!Buffer.isBuffer(data)) data = new Buffer(data); + + bufs.push(data); + length += data.length; + return this; + }, + digest: function digest(enc) { + var buf = Buffer.concat(bufs); + var r = key ? hmac(fn, key, buf) : fn(buf); + bufs = null; + return enc ? r.toString(enc) : r; + } + }; +} + +function error() { + var m = [].slice.call(arguments).join(' '); + throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n')); +} + +exports.createHash = function (alg) { + return hash(alg); +}; +exports.createHmac = function (alg, key) { + return hash(alg, key); +}; +exports.randomBytes = function (size, callback) { + if (callback && callback.call) { + try { + callback.call(this, undefined, new Buffer(rng(size))); + } catch (err) { + callback(err); + } + } else { + return new Buffer(rng(size)); + } +}; + +function each(a, f) { + for (var i in a) { + f(a[i], i); + } +} + +// the least I can do is make error messages for the rest of the node.js/crypto api. +each(['createCredentials', 'createCipher', 'createCipheriv', 'createDecipher', 'createDecipheriv', 'createSign', 'createVerify', 'createDiffieHellman', 'pbkdf2'], function (name) { + exports[name] = function () { + error('sorry,', name, 'is not implemented yet'); + }; +}); + +},{"./md5":179,"./rng":180,"./sha":181,"./sha256":182,"buffer":45}],179:[function(require,module,exports){ +"use strict"; + +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +var helpers = require('./helpers'); + +/* + * Perform a simple self-test to see if the VM is working + */ +function md5_vm_test() { + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << len % 32; + x[(len + 64 >>> 9 << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for (var i = 0; i < x.length; i += 16) { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); + d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); + d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) { + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); +} +function md5_ff(a, b, c, d, x, s, t) { + return md5_cmn(b & c | ~b & d, a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) { + return md5_cmn(b & d | c & ~d, a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) { + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) { + return md5_cmn(c ^ (b | ~d), a, b, x, s, t); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xFFFF; +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) { + return num << cnt | num >>> 32 - cnt; +} + +module.exports = function md5(buf) { + return helpers.hash(buf, core_md5, 16); +}; + +},{"./helpers":177}],180:[function(require,module,exports){ +"use strict"; + +// Original code adapted from Robert Kieffer. +// details at https://github.com/broofa/node-uuid +(function () { + var _global = this; + + var mathRNG, whatwgRNG; + + // NOTE: Math.random() does not guarantee "cryptographic quality" + mathRNG = function mathRNG(size) { + var bytes = new Array(size); + var r; + + for (var i = 0, r; i < size; i++) { + if ((i & 0x03) == 0) r = Math.random() * 0x100000000; + bytes[i] = r >>> ((i & 0x03) << 3) & 0xff; + } + + return bytes; + }; + + if (_global.crypto && crypto.getRandomValues) { + whatwgRNG = function whatwgRNG(size) { + var bytes = new Uint8Array(size); + crypto.getRandomValues(bytes); + return bytes; + }; + } + + module.exports = whatwgRNG || mathRNG; +})(); + +},{}],181:[function(require,module,exports){ +'use strict'; + +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +var helpers = require('./helpers'); + +/* + * Calculate the SHA-1 of an array of big-endian words, and a bit length + */ +function core_sha1(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << 24 - len % 32; + x[(len + 64 >> 9 << 4) + 15] = len; + + var w = Array(80); + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var e = -1009589776; + + for (var i = 0; i < x.length; i += 16) { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + var olde = e; + + for (var j = 0; j < 80; j++) { + if (j < 16) w[j] = x[i + j];else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); + var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + e = safe_add(e, olde); + } + return Array(a, b, c, d, e); +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1_ft(t, b, c, d) { + if (t < 20) return b & c | ~b & d; + if (t < 40) return b ^ c ^ d; + if (t < 60) return b & c | b & d | c & d; + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1_kt(t) { + return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514; +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xFFFF; +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) { + return num << cnt | num >>> 32 - cnt; +} + +module.exports = function sha1(buf) { + return helpers.hash(buf, core_sha1, 20, true); +}; + +},{"./helpers":177}],182:[function(require,module,exports){ +'use strict'; + +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var helpers = require('./helpers'); + +var safe_add = function safe_add(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xFFFF; +}; + +var S = function S(X, n) { + return X >>> n | X << 32 - n; +}; + +var R = function R(X, n) { + return X >>> n; +}; + +var Ch = function Ch(x, y, z) { + return x & y ^ ~x & z; +}; + +var Maj = function Maj(x, y, z) { + return x & y ^ x & z ^ y & z; +}; + +var Sigma0256 = function Sigma0256(x) { + return S(x, 2) ^ S(x, 13) ^ S(x, 22); +}; + +var Sigma1256 = function Sigma1256(x) { + return S(x, 6) ^ S(x, 11) ^ S(x, 25); +}; + +var Gamma0256 = function Gamma0256(x) { + return S(x, 7) ^ S(x, 18) ^ R(x, 3); +}; + +var Gamma1256 = function Gamma1256(x) { + return S(x, 17) ^ S(x, 19) ^ R(x, 10); +}; + +var core_sha256 = function core_sha256(m, l) { + var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2); + var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); + var W = new Array(64); + var a, b, c, d, e, f, g, h, i, j; + var T1, T2; + /* append padding */ + m[l >> 5] |= 0x80 << 24 - l % 32; + m[(l + 64 >> 9 << 4) + 15] = l; + for (var i = 0; i < m.length; i += 16) { + a = HASH[0];b = HASH[1];c = HASH[2];d = HASH[3];e = HASH[4];f = HASH[5];g = HASH[6];h = HASH[7]; + for (var j = 0; j < 64; j++) { + if (j < 16) { + W[j] = m[j + i]; + } else { + W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]); + } + T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]); + T2 = safe_add(Sigma0256(a), Maj(a, b, c)); + h = g;g = f;f = e;e = safe_add(d, T1);d = c;c = b;b = a;a = safe_add(T1, T2); + } + HASH[0] = safe_add(a, HASH[0]);HASH[1] = safe_add(b, HASH[1]);HASH[2] = safe_add(c, HASH[2]);HASH[3] = safe_add(d, HASH[3]); + HASH[4] = safe_add(e, HASH[4]);HASH[5] = safe_add(f, HASH[5]);HASH[6] = safe_add(g, HASH[6]);HASH[7] = safe_add(h, HASH[7]); + } + return HASH; +}; + +module.exports = function sha256(buf) { + return helpers.hash(buf, core_sha256, 32, true); +}; + +},{"./helpers":177}],183:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* + * Date Format 1.2.3 + * (c) 2007-2009 Steven Levithan + * MIT license + * + * Includes enhancements by Scott Trenda + * and Kris Kowal + * + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + */ + +(function (global) { + 'use strict'; + + var dateFormat = function () { + var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g; + var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g; + var timezoneClip = /[^-+\dA-Z]/g; + + // Regexes and supporting functions are cached through closure + return function (date, mask, utc, gmt) { + + // You can't provide utc if you skip other args (use the 'UTC:' mask prefix) + if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) { + mask = date; + date = undefined; + } + + date = date || new Date(); + + if (!(date instanceof Date)) { + date = new Date(date); + } + + if (isNaN(date)) { + throw TypeError('Invalid date'); + } + + mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']); + + // Allow setting the utc/gmt argument via the mask + var maskSlice = mask.slice(0, 4); + if (maskSlice === 'UTC:' || maskSlice === 'GMT:') { + mask = mask.slice(4); + utc = true; + if (maskSlice === 'GMT:') { + gmt = true; + } + } + + var _ = utc ? 'getUTC' : 'get'; + var d = date[_ + 'Date'](); + var D = date[_ + 'Day'](); + var m = date[_ + 'Month'](); + var y = date[_ + 'FullYear'](); + var H = date[_ + 'Hours'](); + var M = date[_ + 'Minutes'](); + var s = date[_ + 'Seconds'](); + var L = date[_ + 'Milliseconds'](); + var o = utc ? 0 : date.getTimezoneOffset(); + var W = getWeek(date); + var N = getDayOfWeek(date); + var flags = { + d: d, + dd: pad(d), + ddd: dateFormat.i18n.dayNames[D], + dddd: dateFormat.i18n.dayNames[D + 7], + m: m + 1, + mm: pad(m + 1), + mmm: dateFormat.i18n.monthNames[m], + mmmm: dateFormat.i18n.monthNames[m + 12], + yy: String(y).slice(2), + yyyy: y, + h: H % 12 || 12, + hh: pad(H % 12 || 12), + H: H, + HH: pad(H), + M: M, + MM: pad(M), + s: s, + ss: pad(s), + l: pad(L, 3), + L: pad(Math.round(L / 10)), + t: H < 12 ? 'a' : 'p', + tt: H < 12 ? 'am' : 'pm', + T: H < 12 ? 'A' : 'P', + TT: H < 12 ? 'AM' : 'PM', + Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''), + o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), + S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10], + W: W, + N: N + }; + + return mask.replace(token, function (match) { + if (match in flags) { + return flags[match]; + } + return match.slice(1, match.length - 1); + }); + }; + }(); + + dateFormat.masks = { + 'default': 'ddd mmm dd yyyy HH:MM:ss', + 'shortDate': 'm/d/yy', + 'mediumDate': 'mmm d, yyyy', + 'longDate': 'mmmm d, yyyy', + 'fullDate': 'dddd, mmmm d, yyyy', + 'shortTime': 'h:MM TT', + 'mediumTime': 'h:MM:ss TT', + 'longTime': 'h:MM:ss TT Z', + 'isoDate': 'yyyy-mm-dd', + 'isoTime': 'HH:MM:ss', + 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso', + 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'', + 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z' + }; + + // Internationalization strings + dateFormat.i18n = { + dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] + }; + + function pad(val, len) { + val = String(val); + len = len || 2; + while (val.length < len) { + val = '0' + val; + } + return val; + } + + /** + * Get the ISO 8601 week number + * Based on comments from + * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html + * + * @param {Object} `date` + * @return {Number} + */ + function getWeek(date) { + // Remove time components of date + var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate()); + + // Change date to Thursday same week + targetThursday.setDate(targetThursday.getDate() - (targetThursday.getDay() + 6) % 7 + 3); + + // Take January 4th as it is always in week 1 (see ISO 8601) + var firstThursday = new Date(targetThursday.getFullYear(), 0, 4); + + // Change date to Thursday same week + firstThursday.setDate(firstThursday.getDate() - (firstThursday.getDay() + 6) % 7 + 3); + + // Check if daylight-saving-time-switch occured and correct for it + var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset(); + targetThursday.setHours(targetThursday.getHours() - ds); + + // Number of weeks between target Thursday and first Thursday + var weekDiff = (targetThursday - firstThursday) / (86400000 * 7); + return 1 + Math.floor(weekDiff); + } + + /** + * Get ISO-8601 numeric representation of the day of the week + * 1 (for Monday) through 7 (for Sunday) + * + * @param {Object} `date` + * @return {Number} + */ + function getDayOfWeek(date) { + var dow = date.getDay(); + if (dow === 0) { + dow = 7; + } + return dow; + } + + /** + * kind-of shortcut + * @param {*} val + * @return {String} + */ + function kindOf(val) { + if (val === null) { + return 'null'; + } + + if (val === undefined) { + return 'undefined'; + } + + if ((typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val)) !== 'object') { + return typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val); + } + + if (Array.isArray(val)) { + return 'array'; + } + + return {}.toString.call(val).slice(8, -1).toLowerCase(); + }; + + if (typeof define === 'function' && define.amd) { + define(function () { + return dateFormat; + }); + } else if ((typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)) === 'object') { + module.exports = dateFormat; + } else { + global.dateFormat = dateFormat; + } +})(undefined); + +},{"babel-runtime/helpers/typeof":39}],184:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _stringify = require('babel-runtime/core-js/json/stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); + +/** + * Colors. + */ + +exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson']; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return 'WebkitAppearance' in document.documentElement.style || + // is firebug? http://stackoverflow.com/a/398120/376773 + window.console && (console.firebug || console.exception && console.table) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31; +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function (v) { + return (0, _stringify2.default)(v); +}; + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function (match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === 'undefined' ? 'undefined' : (0, _typeof3.default)(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch (e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch (e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} + +},{"./debug":185,"babel-runtime/core-js/json/stringify":18,"babel-runtime/helpers/typeof":39}],185:[function(require,module,exports){ +'use strict'; + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() {} + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function (match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + +},{"ms":338}],186:[function(require,module,exports){ +(function (process){ +/**! + * default-user-agent - index.js + * + * Copyright(c) fengmk2 and other contributors. + * MIT Licensed + * + * Authors: + * fengmk2 (http://fengmk2.com) + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var osName = require('os-name'); + +var USER_AGENT = 'Node.js/' + process.version.slice(1) + ' (' + osName() + '; ' + process.arch + ')'; + +module.exports = function ua(name, version) { + if (arguments.length !== 2) { + return USER_AGENT; + } + return name + '/' + version + ' ' + USER_AGENT; +}; + +}).call(this,require('_process')) +},{"_process":345,"os-name":340}],187:[function(require,module,exports){ +/*! + * destroy + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var ReadStream = require('fs').ReadStream; +var Stream = require('stream'); + +/** + * Module exports. + * @public + */ + +module.exports = destroy; + +/** + * Destroy a stream. + * + * @param {object} stream + * @public + */ + +function destroy(stream) { + if (stream instanceof ReadStream) { + return destroyReadStream(stream); + } + + if (!(stream instanceof Stream)) { + return stream; + } + + if (typeof stream.destroy === 'function') { + stream.destroy(); + } + + return stream; +} + +/** + * Destroy a ReadStream. + * + * @param {object} stream + * @private + */ + +function destroyReadStream(stream) { + stream.destroy(); + + if (typeof stream.close === 'function') { + // node.js core bug work-around + stream.on('open', onOpenClose); + } + + return stream; +} + +/** + * On open handler to close stream. + * @private + */ + +function onOpenClose() { + if (typeof this.fd === 'number') { + // actually close down the fd + this.close(); + } +} + +},{"fs":43,"stream":369}],188:[function(require,module,exports){ +/**! + * digest-header - index.js + * + * Copyright(c) fengmk2 and other contributors. + * MIT Licensed + * + * Authors: + * fengmk2 (http://fengmk2.github.com) + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var crypto = require('./../../shims/crypto.js'); +var utility = require('utility'); + +var AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]+)["']?/; +var NC = 0; +var NC_PAD = '00000000'; + +function digestAuthHeader(method, uri, wwwAuthenticate, userpass) { + var parts = wwwAuthenticate.split(','); + var opts = {}; + for (var i = 0; i < parts.length; i++) { + var m = parts[i].match(AUTH_KEY_VALUE_RE); + if (m) { + opts[m[1]] = m[2].replace(/["']/g, ''); + } + } + + if (!opts.realm || !opts.nonce) { + return ''; + } + + var qop = opts.qop || ''; + + // WWW-Authenticate: Digest realm="testrealm@host.com", + // qop="auth,auth-int", + // nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", + // opaque="5ccc069c403ebaf9f0171e9517f40e41" + // Authorization: Digest username="Mufasa", + // realm="testrealm@host.com", + // nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", + // uri="/dir/index.html", + // qop=auth, + // nc=00000001, + // cnonce="0a4f113b", + // response="6629fae49393a05397450978507c4ef1", + // opaque="5ccc069c403ebaf9f0171e9517f40e41" + // HA1 = MD5( "Mufasa:testrealm@host.com:Circle Of Life" ) + // = 939e7578ed9e3c518a452acee763bce9 + // + // HA2 = MD5( "GET:/dir/index.html" ) + // = 39aff3a2bab6126f332b942af96d3366 + // + // Response = MD5( "939e7578ed9e3c518a452acee763bce9:\ + // dcd98b7102dd2f0e8b11d0f600bfb0c093:\ + // 00000001:0a4f113b:auth:\ + // 39aff3a2bab6126f332b942af96d3366" ) + // = 6629fae49393a05397450978507c4ef1 + userpass = userpass.split(':'); + + var nc = String(++NC); + nc = NC_PAD.substring(nc.length) + nc; + var cnonce = crypto.randomBytes(8).toString('hex'); + + var ha1 = utility.md5(userpass[0] + ':' + opts.realm + ':' + userpass[1]); + var ha2 = utility.md5(method.toUpperCase() + ':' + uri); + var s = ha1 + ':' + opts.nonce; + if (qop) { + qop = qop.split(',')[0]; + s += ':' + nc + ':' + cnonce + ':' + qop; + } + s += ':' + ha2; + var response = utility.md5(s); + var authstring = 'Digest username="' + userpass[0] + '", realm="' + opts.realm + '", nonce="' + opts.nonce + '", uri="' + uri + '", response="' + response + '"'; + if (opts.opaque) { + authstring += ', opaque="' + opts.opaque + '"'; + } + if (qop) { + authstring += ', qop=' + qop + ', nc=' + nc + ', cnonce="' + cnonce + '"'; + } + return authstring; +} + +module.exports = digestAuthHeader; + +},{"./../../shims/crypto.js":420,"utility":189}],189:[function(require,module,exports){ +'use strict'; + +module.exports = require('./lib/utility'); + +},{"./lib/utility":190}],190:[function(require,module,exports){ +(function (process,Buffer){ +/*! + * utility - lib/utility.js + * + * Copyright(c) 2012 - 2013 fengmk2 + * MIT Licensed + */ + +"use strict"; + +/** + * Module dependencies. + */ + +var _setImmediate3 = require('babel-runtime/core-js/set-immediate'); + +var _setImmediate4 = _interopRequireDefault(_setImmediate3); + +var _stringify = require('babel-runtime/core-js/json/stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var crypto = require('./../../../../../shims/crypto.js'); +var address = require('address'); + +/** + * A empty function. + * + * @return {Function} + * @public + */ +exports.noop = function () {}; + +function sortObject(o) { + if (!o || Array.isArray(o) || (typeof o === 'undefined' ? 'undefined' : (0, _typeof3.default)(o)) !== 'object') { + return o; + } + var keys = (0, _keys2.default)(o); + keys.sort(); + var values = []; + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; + values.push([k, sortObject(o[k])]); + } + return values; +} + +/** + * hash + * + * @param {String} method hash method, e.g.: 'md5', 'sha1' + * @param {String|Buffer} s + * @param {String} [format] output string format, could be 'hex' or 'base64'. default is 'hex'. + * @return {String} md5 hash string + * @public + */ +exports.hash = function hash(method, s, format) { + var sum = crypto.createHash(method); + var isBuffer = Buffer.isBuffer(s); + if (!isBuffer && (typeof s === 'undefined' ? 'undefined' : (0, _typeof3.default)(s)) === 'object') { + s = (0, _stringify2.default)(sortObject(s)); + } + sum.update(s, isBuffer ? 'binary' : 'utf8'); + return sum.digest(format || 'hex'); +}; + +/** + * md5 hash + * + * @param {String|Buffer} s + * @param {String} [format] output string format, could be 'hex' or 'base64'. default is 'hex'. + * @return {String} md5 hash string + * @public + */ +exports.md5 = function (s, format) { + return exports.hash('md5', s, format); +}; + +/** + * sha1 hash + * + * @param {String|Buffer} s + * @param {String} [format] output string format, could be 'hex' or 'base64'. default is 'hex'. + * @return {String} sha1 hash string + * @public + */ +exports.sha1 = function (s, format) { + return exports.hash('sha1', s, format); +}; + +/** + * HMAC algorithm. + * + * Equal bash: + * + * ```bash + * $ echo -n "$data" | openssl dgst -binary -$algorithm -hmac "$key" | openssl $encoding + * ``` + * + * @param {String} algorithm, dependent on the available algorithms supported by the version of OpenSSL on the platform. + * Examples are 'sha1', 'md5', 'sha256', 'sha512', etc. + * On recent releases, `openssl list-message-digest-algorithms` will display the available digest algorithms. + * @param {String} key, the hmac key to be used. + * @param {String|Buffer} data, content string. + * @param {String} [encoding='base64'] + * @return {String} digest string. + */ +exports.hmac = function (algorithm, key, data, encoding) { + encoding = encoding || 'base64'; + var hmac = crypto.createHmac(algorithm, key); + hmac.update(data, Buffer.isBuffer(data) ? 'binary' : 'utf8'); + return hmac.digest(encoding); +}; + +/** + * Base64 encode string. + * + * @param {String|Buffer} s + * @param {Boolean} [urlsafe=false] Encode string s using a URL-safe alphabet, + * which substitutes - instead of + and _ instead of / in the standard Base64 alphabet. + * @return {String} base64 encode format string. + */ +exports.base64encode = function (s, urlsafe) { + if (!Buffer.isBuffer(s)) { + s = new Buffer(s); + } + var encode = s.toString('base64'); + if (urlsafe) { + encode = encode.replace(/\+/g, '-').replace(/\//g, '_'); + } + return encode; +}; + +/** + * Base64 string decode. + * + * @param {String} encode, base64 encoding string. + * @param {Boolean} [urlsafe=false] Decode string s using a URL-safe alphabet, + * which substitutes - instead of + and _ instead of / in the standard Base64 alphabet. + * @return {String} plain text. + */ +exports.base64decode = function (encode, urlsafe) { + if (urlsafe) { + encode = encode.replace(/\-/g, '+').replace(/_/g, '/'); + } + encode = new Buffer(encode, 'base64'); + return encode.toString(); +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @public + */ +exports.escape = function (html) { + return String(html).replace(/&(?!\w+;)/g, '&').replace(//g, '>').replace(/"/g, '"'); +}; + +/** + * Array random slice with items count. + * @param {Array} arr + * @param {Number} num, number of sub items. + * @return {Array} + */ +exports.randomSlice = function (arr, num) { + if (!num || num >= arr.length) { + return arr.slice(); + } + var index = Math.floor(Math.random() * arr.length); + var a = []; + for (var i = 0, j = index; i < num; i++) { + a.push(arr[j++]); + if (j === arr.length) { + j = 0; + } + } + return a; +}; + +/** + * Safe encodeURIComponent, won't throw any error. + * If `encodeURIComponent` error happen, just return the original value. + * + * @param {String} text + * @return {String} URL encode string. + */ +exports.encodeURIComponent = function (text) { + try { + return encodeURIComponent(text); + } catch (e) { + return text; + } +}; + +/** + * Safe decodeURIComponent, won't throw any error. + * If `decodeURIComponent` error happen, just return the original value. + * + * @param {String} encodeText + * @return {String} URL decode original string. + */ +exports.decodeURIComponent = function (encodeText) { + try { + return decodeURIComponent(encodeText); + } catch (e) { + return encodeText; + } +}; + +var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + +// only set once. +var TIMEZONE = ' '; +var _hourOffset = parseInt(-new Date().getTimezoneOffset() / 60, 10); +if (_hourOffset >= 0) { + TIMEZONE += '+'; +} else { + TIMEZONE += '-'; +} +_hourOffset = Math.abs(_hourOffset); +if (_hourOffset < 10) { + _hourOffset = '0' + _hourOffset; +} +TIMEZONE += _hourOffset + '00'; + +/** + * Access log format date. format: `moment().format('DD/MMM/YYYY:HH:mm:ss ZZ')` + * + * @return {String} + */ +exports.accessLogDate = function (d) { + // 16/Apr/2013:16:40:09 +0800 + d = d || new Date(); + var date = d.getDate(); + if (date < 10) { + date = '0' + date; + } + var hours = d.getHours(); + if (hours < 10) { + hours = '0' + hours; + } + var mintues = d.getMinutes(); + if (mintues < 10) { + mintues = '0' + mintues; + } + var seconds = d.getSeconds(); + if (seconds < 10) { + seconds = '0' + seconds; + } + return date + '/' + MONTHS[d.getMonth()] + '/' + d.getFullYear() + ':' + hours + ':' + mintues + ':' + seconds + TIMEZONE; +}; + +/** + * Normal log format date. format: `moment().format('YYYY-MM-DD HH:mm:ss.SSS')` + * + * @return {String} + */ +exports.logDate = exports.YYYYMMDDHHmmssSSS = function (d) { + d = d || new Date(); + var date = d.getDate(); + if (date < 10) { + date = '0' + date; + } + var month = d.getMonth() + 1; + if (month < 10) { + month = '0' + month; + } + var hours = d.getHours(); + if (hours < 10) { + hours = '0' + hours; + } + var mintues = d.getMinutes(); + if (mintues < 10) { + mintues = '0' + mintues; + } + var seconds = d.getSeconds(); + if (seconds < 10) { + seconds = '0' + seconds; + } + var milliseconds = d.getMilliseconds(); + if (milliseconds < 10) { + milliseconds = '00' + milliseconds; + } else if (milliseconds < 100) { + milliseconds = '0' + milliseconds; + } + return d.getFullYear() + '-' + month + '-' + date + ' ' + hours + ':' + mintues + ':' + seconds + '.' + milliseconds; +}; + +/** + * `moment().format('YYYY-MM-DD HH:mm:ss')` format date string. + * + * @return {String} + */ +exports.YYYYMMDDHHmmss = function (d) { + d = d || new Date(); + var date = d.getDate(); + if (date < 10) { + date = '0' + date; + } + var month = d.getMonth() + 1; + if (month < 10) { + month = '0' + month; + } + var hours = d.getHours(); + if (hours < 10) { + hours = '0' + hours; + } + var mintues = d.getMinutes(); + if (mintues < 10) { + mintues = '0' + mintues; + } + var seconds = d.getSeconds(); + if (seconds < 10) { + seconds = '0' + seconds; + } + return d.getFullYear() + '-' + month + '-' + date + ' ' + hours + ':' + mintues + ':' + seconds; +}; + +/** + * `moment().format('YYYY-MM-DD')` format date string. + * + * @return {String} + */ +exports.YYYYMMDD = function YYYYMMDD(d) { + d = d || new Date(); + var date = d.getDate(); + if (date < 10) { + date = '0' + date; + } + var month = d.getMonth() + 1; + if (month < 10) { + month = '0' + month; + } + return d.getFullYear() + '-' + month + '-' + date; +}; + +/** + * return datetime struct. + * + * @return {Object} date + * - {Number} YYYYMMDD, 20130401 + * - {Number} H, 0, 1, 9, 12, 23 + */ +exports.datestruct = function (now) { + now = now || new Date(); + return { + YYYYMMDD: now.getFullYear() * 10000 + (now.getMonth() + 1) * 100 + now.getDate(), + H: now.getHours() + }; +}; + +var _showWarnning = false; + +/** + * Get current machine IPv4 + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @return {String} IP address + */ +exports.getIP = exports.getIPv4 = function (interfaceName) { + if (!_showWarnning) { + _showWarnning = true; + console.warn('[WARNNING] getIP() remove, PLEASE use `https://github.com/fengmk2/address` module instead'); + } + return address.ip(interfaceName); +}; + +/** + * Get current machine IPv6 + * + * @param {String} [interfaceName] interface name, default is 'eth' on linux, 'en' on mac os. + * @return {String} IP address + */ +exports.getIPv6 = function (interfaceName) { + return address.ipv6(interfaceName); +}; + +/** + * Get a function parameter's names. + * + * @param {Function} func + * @param {Boolean} [useCache], default is true + * @return {Array} names + */ +exports.getParamNames = function (func, cache) { + cache = cache !== false; + if (cache && func.__cache_names) { + return func.__cache_names; + } + var str = func.toString(); + var names = str.slice(str.indexOf('(') + 1, str.indexOf(')')).match(/([^\s,]+)/g) || []; + func.__cache_names = names; + return names; +}; + +// http://www.2ality.com/2013/10/safe-integers.html +exports.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; +exports.MIN_SAFE_INTEGER = -exports.MAX_SAFE_INTEGER; +var MAX_SAFE_INTEGER_STR = exports.MAX_SAFE_INTEGER_STR = String(exports.MAX_SAFE_INTEGER); +var MAX_SAFE_INTEGER_STR_LENGTH = MAX_SAFE_INTEGER_STR.length; + +/** + * Detect a number string can safe convert to Javascript Number. + * + * @param {String} s number format string, like `"123"`, `"-1000123123123123123123"` + * @return {Boolean} + */ +exports.isSafeNumberString = function (s) { + if (s[0] === '-') { + s = s.substring(1); + } + if (s.length < MAX_SAFE_INTEGER_STR_LENGTH || s.length === MAX_SAFE_INTEGER_STR_LENGTH && s <= MAX_SAFE_INTEGER_STR) { + return true; + } + return false; +}; + +/** + * Convert string to Number if string in safe Number scope. + * + * @param {String} s number format string. + * @return {Number|String} success will return Number, otherise return the original string. + */ +exports.toSafeNumber = function (s) { + if (typeof s === 'number') { + return s; + } + + return exports.isSafeNumberString(s) ? Number(s) : s; +}; + +/** + * Get Unix's timestamp in seconds. + * @return {Number} + */ +exports.timestamp = function (t) { + if (t) { + var v = t; + if (typeof v === 'string') { + v = Number(v); + } + if (String(t).length === 10) { + v *= 1000; + } + return new Date(v); + } + return Math.round(Date.now() / 1000); +}; + +var _setImmediate = typeof _setImmediate4.default === 'function' ? _setImmediate4.default : process.nextTick; + +exports.setImmediate = function (callback) { + _setImmediate(callback); +}; + +exports.randomString = function (length, charSet) { + var result = []; + length = length || 16; + charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + + while (length--) { + result.push(charSet[Math.floor(Math.random() * charSet.length)]); + } + return result.join(''); +}; + +exports.has = function (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +}; + +}).call(this,require('_process'),require("buffer").Buffer) +},{"./../../../../../shims/crypto.js":420,"_process":345,"address":10,"babel-runtime/core-js/json/stringify":18,"babel-runtime/core-js/object/keys":30,"babel-runtime/core-js/set-immediate":34,"babel-runtime/helpers/typeof":39,"buffer":45}],191:[function(require,module,exports){ +/**! + * end-or-error - index.js + * + * Copyright(c) stream-utils and other contributors. + * MIT Licensed + * + * Authors: + * fengmk2 (http://fengmk2.com) + */ + +'use strict'; + +/** + * Module dependencies. + */ + +module.exports = function eoe(stream, cb) { + if (!stream.readable) { + return cb(); + } + + stream.on('error', onerror); + stream.on('end', onend); + + function onerror(err) { + cleanup(); + cb(err); + } + + function onend(data) { + cleanup(); + cb(null, data); + } + + function cleanup() { + stream.removeListener('error', onerror); + stream.removeListener('end', onend); + } +}; + +},{}],192:[function(require,module,exports){ +/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */ + +'use strict'; + +/** + * Module variables. + * @private + */ + +var matchHtmlRegExp = /["'&<>]/; + +/** + * Module exports. + * @public + */ + +module.exports = escapeHtml; + +/** + * Escape special characters in the given string of html. + * + * @param {string} string The string to escape for inserting into HTML + * @return {string} + * @public + */ + +function escapeHtml(string) { + var str = '' + string; + var match = matchHtmlRegExp.exec(str); + + if (!match) { + return str; + } + + var escape; + var html = ''; + var index = 0; + var lastIndex = 0; + + for (index = match.index; index < str.length; index++) { + switch (str.charCodeAt(index)) { + case 34: + // " + escape = '"'; + break; + case 38: + // & + escape = '&'; + break; + case 39: + // ' + escape = '''; + break; + case 60: + // < + escape = '<'; + break; + case 62: + // > + escape = '>'; + break; + default: + continue; + } + + if (lastIndex !== index) { + html += str.substring(lastIndex, index); + } + + lastIndex = index + 1; + html += escape; + } + + return lastIndex !== index ? html + str.substring(lastIndex, index) : html; +} + +},{}],193:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function (n) { + if (!isNumber(n) || n < 0 || isNaN(n)) throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function (type) { + var er, handler, len, args, i, listeners; + + if (!this._events) this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) { + listeners[i].apply(this, args); + } + } + + return true; +}; + +EventEmitter.prototype.addListener = function (type, listener) { + var m; + + if (!isFunction(listener)) throw TypeError('listener must be a function'); + + if (!this._events) this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) this.emit('newListener', type, isFunction(listener.listener) ? listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener;else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener);else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function (type, listener) { + if (!isFunction(listener)) throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function (type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || isFunction(list.listener) && list.listener === listener) { + delete this._events[type]; + if (this._events.removeListener) this.emit('removeListener', type, listener); + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || list[i].listener && list[i].listener === listener) { + position = i; + break; + } + } + + if (position < 0) return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function (type) { + var key, listeners; + + if (!this._events) return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) this._events = {};else if (this._events[type]) delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) { + this.removeListener(type, listeners[listeners.length - 1]); + } + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function (type) { + var ret; + if (!this._events || !this._events[type]) ret = [];else if (isFunction(this._events[type])) ret = [this._events[type]];else ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.prototype.listenerCount = function (type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) return 1;else if (evlistener) return evlistener.length; + } + return 0; +}; + +EventEmitter.listenerCount = function (emitter, type) { + return emitter.listenerCount(type); +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{"babel-runtime/helpers/typeof":39}],194:[function(require,module,exports){ +(function (process){ +'use strict'; + +var _promise = require('babel-runtime/core-js/promise'); + +var _promise2 = _interopRequireDefault(_promise); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ready(flagOrFunction) { + this._ready = !!this._ready; + this._readyCallbacks = this._readyCallbacks || []; + + if (arguments.length === 0) { + // return a promise + // support `this.ready().then(onready);` and `yield this.ready()`; + return new _promise2.default(function (resolve) { + if (this._ready) { + return resolve(); + } + this._readyCallbacks.push(resolve); + }.bind(this)); + } else if (typeof flagOrFunction === 'function') { + this._readyCallbacks.push(flagOrFunction); + } else { + this._ready = !!flagOrFunction; + } + + if (this._ready) { + this._readyCallbacks.splice(0, Infinity).forEach(function (callback) { + process.nextTick(callback); + }); + } +} + +function mixin(object) { + object.ready = ready; +} + +module.exports = mixin; +module.exports.mixin = mixin; + +}).call(this,require('_process')) +},{"_process":345,"babel-runtime/core-js/promise":33}],195:[function(require,module,exports){ +'use strict'; + +var http = require('http'); + +var https = module.exports; + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; +}; + +https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + params.protocol = 'https:'; + return http.request.call(this, params, cb); +}; + +},{"http":370}],196:[function(require,module,exports){ +/*! + * humanize-ms - index.js + * Copyright(c) 2014 dead_horse + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var util = require('util'); +var ms = require('ms'); + +module.exports = function (t) { + if (typeof t === 'number') return t; + var r = ms(t); + if (r === undefined) { + var err = new Error(util.format('humanize-ms(%j) result undefined', t)); + console.warn(err.stack); + } + return r; +}; + +},{"ms":338,"util":384}],197:[function(require,module,exports){ +"use strict"; + +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; +}; + +},{}],198:[function(require,module,exports){ +'use strict'; + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +if (typeof _create2.default === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = (0, _create2.default)(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function TempCtor() {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + }; +} + +},{"babel-runtime/core-js/object/create":22}],199:[function(require,module,exports){ +'use strict'; + +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer); +}; + +function isBuffer(obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj); +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer(obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)); +} + +},{}],200:[function(require,module,exports){ +'use strict'; + +(function (root) { + var toString = Function.prototype.toString; + + function fnBody(fn) { + return toString.call(fn).replace(/^[^{]*{\s*/, '').replace(/\s*}[^}]*$/, ''); + } + + function isClass(fn) { + return typeof fn === 'function' && (/^class\s/.test(toString.call(fn)) || /^.*classCallCheck\(/.test(fnBody(fn))) // babel.js + ; + } + + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + exports = module.exports = isClass; + } + exports.isClass = isClass; + } else if (typeof define === 'function' && define.amd) { + define([], function () { + return isClass; + }); + } else { + root.isClass = isClass; + } +})(undefined); + +},{}],201:[function(require,module,exports){ +/*! + * is-type-of - index.js + * Copyright(c) 2014 dead_horse + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var _isNan = require('babel-runtime/core-js/number/is-nan'); + +var _isNan2 = _interopRequireDefault(_isNan); + +var _isFinite = require('babel-runtime/core-js/number/is-finite'); + +var _isFinite2 = _interopRequireDefault(_isFinite); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var utils = require('core-util-is'); +var isStearm = require('isstream'); +var isClass = require('is-class'); + +/** + * Expose all methods in core-util-is + */ + +(0, _keys2.default)(utils).map(function (name) { + exports[transform(name)] = utils[name]; +}); + +/** + * Stream detected by isstream + */ + +exports.stream = isStearm; +exports.readableStream = isStearm.isReadable; +exports.writableStream = isStearm.isWritable; +exports.duplexStream = isStearm.isDuplex; + +/** + * Class detected by is-class + */ +exports.class = isClass; + +/** + * Extend method + */ + +exports.finite = function (obj) { + return (0, _isFinite2.default)(obj); +}; + +exports.NaN = function (obj) { + return (0, _isNan2.default)(obj); +}; + +exports.generator = function (obj) { + return obj && 'function' === typeof obj.next && 'function' === typeof obj.throw; +}; + +exports.generatorFunction = function (obj) { + return obj && obj.constructor && 'GeneratorFunction' === obj.constructor.name; +}; + +exports.promise = function (obj) { + return obj && 'function' === typeof obj.then; +}; + +var MAX_INT_31 = Math.pow(2, 31); + +exports.int = function (obj) { + return utils.isNumber(obj) && obj % 1 === 0; +}; + +exports.int32 = function (obj) { + return exports.int(obj) && obj < MAX_INT_31 && obj >= -MAX_INT_31; +}; + +exports.long = function (obj) { + return exports.int(obj) && (obj >= MAX_INT_31 || obj < -MAX_INT_31); +}; + +exports.Long = function (obj) { + return exports.object(obj) && exports.number(obj.high) && exports.number(obj.low); +}; + +exports.double = function (obj) { + return utils.isNumber(obj) && !isNaN(obj) && obj % 1 !== 0; +}; + +/** + * transform isNull type to null + * @param {[type]} m [description] + * @return {[type]} [description] + */ + +function transform(m) { + var name = m.slice(2); + name = name[0].toLowerCase() + name.slice(1); + return name; +} + +},{"babel-runtime/core-js/number/is-finite":19,"babel-runtime/core-js/number/is-nan":20,"babel-runtime/core-js/object/keys":30,"core-util-is":176,"is-class":200,"isstream":202}],202:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var stream = require('stream'); + +function isStream(obj) { + return obj instanceof stream.Stream; +} + +function isReadable(obj) { + return isStream(obj) && typeof obj._read == 'function' && (0, _typeof3.default)(obj._readableState) == 'object'; +} + +function isWritable(obj) { + return isStream(obj) && typeof obj._write == 'function' && (0, _typeof3.default)(obj._writableState) == 'object'; +} + +function isDuplex(obj) { + return isReadable(obj) && isWritable(obj); +} + +module.exports = isStream; +module.exports.isReadable = isReadable; +module.exports.isWritable = isWritable; +module.exports.isDuplex = isDuplex; + +},{"babel-runtime/helpers/typeof":39,"stream":369}],203:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); + +module.exports = DataView; + +},{"./_getNative":263,"./_root":297}],204:[function(require,module,exports){ +'use strict'; + +var hashClear = require('./_hashClear'), + hashDelete = require('./_hashDelete'), + hashGet = require('./_hashGet'), + hashHas = require('./_hashHas'), + hashSet = require('./_hashSet'); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +module.exports = Hash; + +},{"./_hashClear":267,"./_hashDelete":268,"./_hashGet":269,"./_hashHas":270,"./_hashSet":271}],205:[function(require,module,exports){ +'use strict'; + +var listCacheClear = require('./_listCacheClear'), + listCacheDelete = require('./_listCacheDelete'), + listCacheGet = require('./_listCacheGet'), + listCacheHas = require('./_listCacheHas'), + listCacheSet = require('./_listCacheSet'); + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +module.exports = ListCache; + +},{"./_listCacheClear":279,"./_listCacheDelete":280,"./_listCacheGet":281,"./_listCacheHas":282,"./_listCacheSet":283}],206:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +module.exports = Map; + +},{"./_getNative":263,"./_root":297}],207:[function(require,module,exports){ +'use strict'; + +var mapCacheClear = require('./_mapCacheClear'), + mapCacheDelete = require('./_mapCacheDelete'), + mapCacheGet = require('./_mapCacheGet'), + mapCacheHas = require('./_mapCacheHas'), + mapCacheSet = require('./_mapCacheSet'); + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +module.exports = MapCache; + +},{"./_mapCacheClear":284,"./_mapCacheDelete":285,"./_mapCacheGet":286,"./_mapCacheHas":287,"./_mapCacheSet":288}],208:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Promise = getNative(root, 'Promise'); + +module.exports = Promise; + +},{"./_getNative":263,"./_root":297}],209:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); + +module.exports = Set; + +},{"./_getNative":263,"./_root":297}],210:[function(require,module,exports){ +'use strict'; + +var MapCache = require('./_MapCache'), + setCacheAdd = require('./_setCacheAdd'), + setCacheHas = require('./_setCacheHas'); + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +module.exports = SetCache; + +},{"./_MapCache":207,"./_setCacheAdd":298,"./_setCacheHas":299}],211:[function(require,module,exports){ +'use strict'; + +var ListCache = require('./_ListCache'), + stackClear = require('./_stackClear'), + stackDelete = require('./_stackDelete'), + stackGet = require('./_stackGet'), + stackHas = require('./_stackHas'), + stackSet = require('./_stackSet'); + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +module.exports = Stack; + +},{"./_ListCache":205,"./_stackClear":303,"./_stackDelete":304,"./_stackGet":305,"./_stackHas":306,"./_stackSet":307}],212:[function(require,module,exports){ +'use strict'; + +var root = require('./_root'); + +/** Built-in value references. */ +var _Symbol = root.Symbol; + +module.exports = _Symbol; + +},{"./_root":297}],213:[function(require,module,exports){ +'use strict'; + +var root = require('./_root'); + +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; + +module.exports = Uint8Array; + +},{"./_root":297}],214:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); + +module.exports = WeakMap; + +},{"./_getNative":263,"./_root":297}],215:[function(require,module,exports){ +"use strict"; + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +module.exports = apply; + +},{}],216:[function(require,module,exports){ +"use strict"; + +/** + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ +function arrayEvery(array, predicate) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; +} + +module.exports = arrayEvery; + +},{}],217:[function(require,module,exports){ +'use strict'; + +var baseTimes = require('./_baseTimes'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isIndex = require('./_isIndex'), + isTypedArray = require('./isTypedArray'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == 'offset' || key == 'parent') || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || + // Skip index properties. + isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + +module.exports = arrayLikeKeys; + +},{"./_baseTimes":246,"./_isIndex":272,"./isArguments":319,"./isArray":320,"./isBuffer":322,"./isTypedArray":329}],218:[function(require,module,exports){ +"use strict"; + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array ? array.length : 0, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + +},{}],219:[function(require,module,exports){ +"use strict"; + +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +module.exports = arraySome; + +},{}],220:[function(require,module,exports){ +'use strict'; + +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) { + baseAssignValue(object, key, value); + } +} + +module.exports = assignValue; + +},{"./_baseAssignValue":223,"./eq":314}],221:[function(require,module,exports){ +'use strict'; + +var eq = require('./eq'); + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +module.exports = assocIndexOf; + +},{"./eq":314}],222:[function(require,module,exports){ +'use strict'; + +var copyObject = require('./_copyObject'), + keys = require('./keys'); + +/** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ +function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); +} + +module.exports = baseAssign; + +},{"./_copyObject":251,"./keys":330}],223:[function(require,module,exports){ +'use strict'; + +var defineProperty = require('./_defineProperty'); + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +module.exports = baseAssignValue; + +},{"./_defineProperty":256}],224:[function(require,module,exports){ +'use strict'; + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isObject = require('./isObject'); + +/** Built-in value references. */ +var objectCreate = _create2.default; + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ +var baseCreate = function () { + function object() {} + return function (proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object(); + object.prototype = undefined; + return result; + }; +}(); + +module.exports = baseCreate; + +},{"./isObject":326,"babel-runtime/core-js/object/create":22}],225:[function(require,module,exports){ +'use strict'; + +var baseForOwn = require('./_baseForOwn'), + createBaseEach = require('./_createBaseEach'); + +/** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +module.exports = baseEach; + +},{"./_baseForOwn":228,"./_createBaseEach":254}],226:[function(require,module,exports){ +'use strict'; + +var baseEach = require('./_baseEach'); + +/** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ +function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function (value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; +} + +module.exports = baseEvery; + +},{"./_baseEach":225}],227:[function(require,module,exports){ +'use strict'; + +var createBaseFor = require('./_createBaseFor'); + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +module.exports = baseFor; + +},{"./_createBaseFor":255}],228:[function(require,module,exports){ +'use strict'; + +var baseFor = require('./_baseFor'), + keys = require('./keys'); + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} + +module.exports = baseForOwn; + +},{"./_baseFor":227,"./keys":330}],229:[function(require,module,exports){ +'use strict'; + +var castPath = require('./_castPath'), + isKey = require('./_isKey'), + toKey = require('./_toKey'); + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path] : castPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return index && index == length ? object : undefined; +} + +module.exports = baseGet; + +},{"./_castPath":250,"./_isKey":274,"./_toKey":309}],230:[function(require,module,exports){ +"use strict"; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * The base implementation of `getTag`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + return objectToString.call(value); +} + +module.exports = baseGetTag; + +},{}],231:[function(require,module,exports){ +"use strict"; + +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} + +module.exports = baseHasIn; + +},{}],232:[function(require,module,exports){ +'use strict'; + +var isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && objectToString.call(value) == argsTag; +} + +module.exports = baseIsArguments; + +},{"./isObjectLike":327}],233:[function(require,module,exports){ +'use strict'; + +var baseIsEqualDeep = require('./_baseIsEqualDeep'), + isObject = require('./isObject'), + isObjectLike = require('./isObjectLike'); + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || !isObject(value) && !isObjectLike(other)) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); +} + +module.exports = baseIsEqual; + +},{"./_baseIsEqualDeep":234,"./isObject":326,"./isObjectLike":327}],234:[function(require,module,exports){ +'use strict'; + +var Stack = require('./_Stack'), + equalArrays = require('./_equalArrays'), + equalByTag = require('./_equalByTag'), + equalObjects = require('./_equalObjects'), + getTag = require('./_getTag'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isTypedArray = require('./isTypedArray'); + +/** Used to compose bitmasks for comparison styles. */ +var PARTIAL_COMPARE_FLAG = 2; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + objectTag = '[object Object]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = getTag(object); + objTag = objTag == argsTag ? objectTag : objTag; + } + if (!othIsArr) { + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; + } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); +} + +module.exports = baseIsEqualDeep; + +},{"./_Stack":211,"./_equalArrays":257,"./_equalByTag":258,"./_equalObjects":259,"./_getTag":264,"./isArray":320,"./isBuffer":322,"./isTypedArray":329}],235:[function(require,module,exports){ +'use strict'; + +var Stack = require('./_Stack'), + baseIsEqual = require('./_baseIsEqual'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { + return false; + } + } + } + return true; +} + +module.exports = baseIsMatch; + +},{"./_Stack":211,"./_baseIsEqual":233}],236:[function(require,module,exports){ +'use strict'; + +var isFunction = require('./isFunction'), + isMasked = require('./_isMasked'), + isObject = require('./isObject'), + toSource = require('./_toSource'); + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +module.exports = baseIsNative; + +},{"./_isMasked":276,"./_toSource":310,"./isFunction":324,"./isObject":326}],237:[function(require,module,exports){ +'use strict'; + +var isLength = require('./isLength'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} + +module.exports = baseIsTypedArray; + +},{"./isLength":325,"./isObjectLike":327}],238:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var baseMatches = require('./_baseMatches'), + baseMatchesProperty = require('./_baseMatchesProperty'), + identity = require('./identity'), + isArray = require('./isArray'), + property = require('./property'); + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) == 'object') { + return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); + } + return property(value); +} + +module.exports = baseIteratee; + +},{"./_baseMatches":240,"./_baseMatchesProperty":241,"./identity":318,"./isArray":320,"./property":332,"babel-runtime/helpers/typeof":39}],239:[function(require,module,exports){ +'use strict'; + +var isPrototype = require('./_isPrototype'), + nativeKeys = require('./_nativeKeys'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +module.exports = baseKeys; + +},{"./_isPrototype":277,"./_nativeKeys":293}],240:[function(require,module,exports){ +'use strict'; + +var baseIsMatch = require('./_baseIsMatch'), + getMatchData = require('./_getMatchData'), + matchesStrictComparable = require('./_matchesStrictComparable'); + +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function (object) { + return object === source || baseIsMatch(object, source, matchData); + }; +} + +module.exports = baseMatches; + +},{"./_baseIsMatch":235,"./_getMatchData":262,"./_matchesStrictComparable":290}],241:[function(require,module,exports){ +'use strict'; + +var baseIsEqual = require('./_baseIsEqual'), + get = require('./get'), + hasIn = require('./hasIn'), + isKey = require('./_isKey'), + isStrictComparable = require('./_isStrictComparable'), + matchesStrictComparable = require('./_matchesStrictComparable'), + toKey = require('./_toKey'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function (object) { + var objValue = get(object, path); + return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); + }; +} + +module.exports = baseMatchesProperty; + +},{"./_baseIsEqual":233,"./_isKey":274,"./_isStrictComparable":278,"./_matchesStrictComparable":290,"./_toKey":309,"./get":316,"./hasIn":317}],242:[function(require,module,exports){ +"use strict"; + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function (object) { + return object == null ? undefined : object[key]; + }; +} + +module.exports = baseProperty; + +},{}],243:[function(require,module,exports){ +'use strict'; + +var baseGet = require('./_baseGet'); + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyDeep(path) { + return function (object) { + return baseGet(object, path); + }; +} + +module.exports = basePropertyDeep; + +},{"./_baseGet":229}],244:[function(require,module,exports){ +'use strict'; + +var identity = require('./identity'), + overRest = require('./_overRest'), + setToString = require('./_setToString'); + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} + +module.exports = baseRest; + +},{"./_overRest":296,"./_setToString":301,"./identity":318}],245:[function(require,module,exports){ +'use strict'; + +var constant = require('./constant'), + defineProperty = require('./_defineProperty'), + identity = require('./identity'); + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function (func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +module.exports = baseSetToString; + +},{"./_defineProperty":256,"./constant":312,"./identity":318}],246:[function(require,module,exports){ +"use strict"; + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +module.exports = baseTimes; + +},{}],247:[function(require,module,exports){ +'use strict'; + +var _Symbol = require('./_Symbol'), + arrayMap = require('./_arrayMap'), + isArray = require('./isArray'), + isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = value + ''; + return result == '0' && 1 / value == -INFINITY ? '-0' : result; +} + +module.exports = baseToString; + +},{"./_Symbol":212,"./_arrayMap":218,"./isArray":320,"./isSymbol":328}],248:[function(require,module,exports){ +"use strict"; + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function (value) { + return func(value); + }; +} + +module.exports = baseUnary; + +},{}],249:[function(require,module,exports){ +"use strict"; + +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +module.exports = cacheHas; + +},{}],250:[function(require,module,exports){ +'use strict'; + +var isArray = require('./isArray'), + stringToPath = require('./_stringToPath'); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +module.exports = castPath; + +},{"./_stringToPath":308,"./isArray":320}],251:[function(require,module,exports){ +'use strict'; + +var assignValue = require('./_assignValue'), + baseAssignValue = require('./_baseAssignValue'); + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; +} + +module.exports = copyObject; + +},{"./_assignValue":220,"./_baseAssignValue":223}],252:[function(require,module,exports){ +'use strict'; + +var root = require('./_root'); + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +module.exports = coreJsData; + +},{"./_root":297}],253:[function(require,module,exports){ +'use strict'; + +var baseRest = require('./_baseRest'), + isIterateeCall = require('./_isIterateeCall'); + +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function (object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} + +module.exports = createAssigner; + +},{"./_baseRest":244,"./_isIterateeCall":273}],254:[function(require,module,exports){ +'use strict'; + +var isArrayLike = require('./isArrayLike'); + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function (collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while (fromRight ? index-- : ++index < length) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} + +module.exports = createBaseEach; + +},{"./isArrayLike":321}],255:[function(require,module,exports){ +"use strict"; + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function (object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +module.exports = createBaseFor; + +},{}],256:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'); + +var defineProperty = function () { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}(); + +module.exports = defineProperty; + +},{"./_getNative":263}],257:[function(require,module,exports){ +'use strict'; + +var SetCache = require('./_SetCache'), + arraySome = require('./_arraySome'), + cacheHas = require('./_cacheHas'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function (othValue, othIndex) { + if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; +} + +module.exports = equalArrays; + +},{"./_SetCache":210,"./_arraySome":219,"./_cacheHas":249}],258:[function(require,module,exports){ +'use strict'; + +var _Symbol = require('./_Symbol'), + Uint8Array = require('./_Uint8Array'), + eq = require('./eq'), + equalArrays = require('./_equalArrays'), + mapToArray = require('./_mapToArray'), + setToArray = require('./_setToArray'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]'; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { + switch (tag) { + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ''; + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; +} + +module.exports = equalByTag; + +},{"./_Symbol":212,"./_Uint8Array":213,"./_equalArrays":257,"./_mapToArray":289,"./_setToArray":300,"./eq":314}],259:[function(require,module,exports){ +'use strict'; + +var keys = require('./keys'); + +/** Used to compose bitmasks for comparison styles. */ +var PARTIAL_COMPARE_FLAG = 2; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; +} + +module.exports = equalObjects; + +},{"./keys":330}],260:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = (typeof global === 'undefined' ? 'undefined' : (0, _typeof3.default)(global)) == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"babel-runtime/helpers/typeof":39}],261:[function(require,module,exports){ +'use strict'; + +var isKeyable = require('./_isKeyable'); + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; +} + +module.exports = getMapData; + +},{"./_isKeyable":275}],262:[function(require,module,exports){ +'use strict'; + +var isStrictComparable = require('./_isStrictComparable'), + keys = require('./keys'); + +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; +} + +module.exports = getMatchData; + +},{"./_isStrictComparable":278,"./keys":330}],263:[function(require,module,exports){ +'use strict'; + +var baseIsNative = require('./_baseIsNative'), + getValue = require('./_getValue'); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +module.exports = getNative; + +},{"./_baseIsNative":236,"./_getValue":265}],264:[function(require,module,exports){ +'use strict'; + +var DataView = require('./_DataView'), + Map = require('./_Map'), + Promise = require('./_Promise'), + Set = require('./_Set'), + WeakMap = require('./_WeakMap'), + baseGetTag = require('./_baseGetTag'), + toSource = require('./_toSource'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + setTag = '[object Set]', + weakMapTag = '[object WeakMap]'; + +var dataViewTag = '[object DataView]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +var getTag = baseGetTag; + +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. +if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { + getTag = function getTag(value) { + var result = objectToString.call(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : undefined; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result; + }; +} + +module.exports = getTag; + +},{"./_DataView":203,"./_Map":206,"./_Promise":208,"./_Set":209,"./_WeakMap":214,"./_baseGetTag":230,"./_toSource":310}],265:[function(require,module,exports){ +"use strict"; + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +module.exports = getValue; + +},{}],266:[function(require,module,exports){ +'use strict'; + +var castPath = require('./_castPath'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isIndex = require('./_isIndex'), + isKey = require('./_isKey'), + isLength = require('./isLength'), + toKey = require('./_toKey'); + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + path = isKey(path, object) ? [path] : castPath(path); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); +} + +module.exports = hasPath; + +},{"./_castPath":250,"./_isIndex":272,"./_isKey":274,"./_toKey":309,"./isArguments":319,"./isArray":320,"./isLength":325}],267:[function(require,module,exports){ +'use strict'; + +var nativeCreate = require('./_nativeCreate'); + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +module.exports = hashClear; + +},{"./_nativeCreate":292}],268:[function(require,module,exports){ +"use strict"; + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +module.exports = hashDelete; + +},{}],269:[function(require,module,exports){ +'use strict'; + +var nativeCreate = require('./_nativeCreate'); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +module.exports = hashGet; + +},{"./_nativeCreate":292}],270:[function(require,module,exports){ +'use strict'; + +var nativeCreate = require('./_nativeCreate'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +module.exports = hashHas; + +},{"./_nativeCreate":292}],271:[function(require,module,exports){ +'use strict'; + +var nativeCreate = require('./_nativeCreate'); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; +} + +module.exports = hashSet; + +},{"./_nativeCreate":292}],272:[function(require,module,exports){ +'use strict'; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; +} + +module.exports = isIndex; + +},{}],273:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var eq = require('./eq'), + isArrayLike = require('./isArrayLike'), + isIndex = require('./_isIndex'), + isObject = require('./isObject'); + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index === 'undefined' ? 'undefined' : (0, _typeof3.default)(index); + if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) { + return eq(object[index], value); + } + return false; +} + +module.exports = isIterateeCall; + +},{"./_isIndex":272,"./eq":314,"./isArrayLike":321,"./isObject":326,"babel-runtime/helpers/typeof":39}],274:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isArray = require('./isArray'), + isSymbol = require('./isSymbol'); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value); + if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); +} + +module.exports = isKey; + +},{"./isArray":320,"./isSymbol":328,"babel-runtime/helpers/typeof":39}],275:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value); + return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; +} + +module.exports = isKeyable; + +},{"babel-runtime/helpers/typeof":39}],276:[function(require,module,exports){ +'use strict'; + +var coreJsData = require('./_coreJsData'); + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = function () { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? 'Symbol(src)_1.' + uid : ''; +}(); + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} + +module.exports = isMasked; + +},{"./_coreJsData":252}],277:[function(require,module,exports){ +'use strict'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = typeof Ctor == 'function' && Ctor.prototype || objectProto; + + return value === proto; +} + +module.exports = isPrototype; + +},{}],278:[function(require,module,exports){ +'use strict'; + +var isObject = require('./isObject'); + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); +} + +module.exports = isStrictComparable; + +},{"./isObject":326}],279:[function(require,module,exports){ +"use strict"; + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +module.exports = listCacheClear; + +},{}],280:[function(require,module,exports){ +'use strict'; + +var assocIndexOf = require('./_assocIndexOf'); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +module.exports = listCacheDelete; + +},{"./_assocIndexOf":221}],281:[function(require,module,exports){ +'use strict'; + +var assocIndexOf = require('./_assocIndexOf'); + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +module.exports = listCacheGet; + +},{"./_assocIndexOf":221}],282:[function(require,module,exports){ +'use strict'; + +var assocIndexOf = require('./_assocIndexOf'); + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +module.exports = listCacheHas; + +},{"./_assocIndexOf":221}],283:[function(require,module,exports){ +'use strict'; + +var assocIndexOf = require('./_assocIndexOf'); + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +module.exports = listCacheSet; + +},{"./_assocIndexOf":221}],284:[function(require,module,exports){ +'use strict'; + +var Hash = require('./_Hash'), + ListCache = require('./_ListCache'), + Map = require('./_Map'); + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash(), + 'map': new (Map || ListCache)(), + 'string': new Hash() + }; +} + +module.exports = mapCacheClear; + +},{"./_Hash":204,"./_ListCache":205,"./_Map":206}],285:[function(require,module,exports){ +'use strict'; + +var getMapData = require('./_getMapData'); + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +module.exports = mapCacheDelete; + +},{"./_getMapData":261}],286:[function(require,module,exports){ +'use strict'; + +var getMapData = require('./_getMapData'); + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +module.exports = mapCacheGet; + +},{"./_getMapData":261}],287:[function(require,module,exports){ +'use strict'; + +var getMapData = require('./_getMapData'); + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +module.exports = mapCacheHas; + +},{"./_getMapData":261}],288:[function(require,module,exports){ +'use strict'; + +var getMapData = require('./_getMapData'); + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +module.exports = mapCacheSet; + +},{"./_getMapData":261}],289:[function(require,module,exports){ +"use strict"; + +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ +function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function (value, key) { + result[++index] = [key, value]; + }); + return result; +} + +module.exports = mapToArray; + +},{}],290:[function(require,module,exports){ +"use strict"; + +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function (object) { + if (object == null) { + return false; + } + return object[key] === srcValue && (srcValue !== undefined || key in Object(object)); + }; +} + +module.exports = matchesStrictComparable; + +},{}],291:[function(require,module,exports){ +'use strict'; + +var memoize = require('./memoize'); + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function (key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +module.exports = memoizeCapped; + +},{"./memoize":331}],292:[function(require,module,exports){ +'use strict'; + +var getNative = require('./_getNative'); + +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); + +module.exports = nativeCreate; + +},{"./_getNative":263}],293:[function(require,module,exports){ +'use strict'; + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var overArg = require('./_overArg'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(_keys2.default, Object); + +module.exports = nativeKeys; + +},{"./_overArg":295,"babel-runtime/core-js/object/keys":30}],294:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var freeGlobal = require('./_freeGlobal'); + +/** Detect free variable `exports`. */ +var freeExports = (typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)) == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && (typeof module === 'undefined' ? 'undefined' : (0, _typeof3.default)(module)) == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = function () { + try { + return freeProcess && freeProcess.binding('util'); + } catch (e) {} +}(); + +module.exports = nodeUtil; + +},{"./_freeGlobal":260,"babel-runtime/helpers/typeof":39}],295:[function(require,module,exports){ +"use strict"; + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function (arg) { + return func(transform(arg)); + }; +} + +module.exports = overArg; + +},{}],296:[function(require,module,exports){ +'use strict'; + +var apply = require('./_apply'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? func.length - 1 : start, 0); + return function () { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +module.exports = overRest; + +},{"./_apply":215}],297:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var freeGlobal = require('./_freeGlobal'); + +/** Detect free variable `self`. */ +var freeSelf = (typeof self === 'undefined' ? 'undefined' : (0, _typeof3.default)(self)) == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +module.exports = root; + +},{"./_freeGlobal":260,"babel-runtime/helpers/typeof":39}],298:[function(require,module,exports){ +'use strict'; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +module.exports = setCacheAdd; + +},{}],299:[function(require,module,exports){ +"use strict"; + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +module.exports = setCacheHas; + +},{}],300:[function(require,module,exports){ +"use strict"; + +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function (value) { + result[++index] = value; + }); + return result; +} + +module.exports = setToArray; + +},{}],301:[function(require,module,exports){ +'use strict'; + +var baseSetToString = require('./_baseSetToString'), + shortOut = require('./_shortOut'); + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +module.exports = setToString; + +},{"./_baseSetToString":245,"./_shortOut":302}],302:[function(require,module,exports){ +"use strict"; + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 500, + HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function () { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +module.exports = shortOut; + +},{}],303:[function(require,module,exports){ +'use strict'; + +var ListCache = require('./_ListCache'); + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache(); + this.size = 0; +} + +module.exports = stackClear; + +},{"./_ListCache":205}],304:[function(require,module,exports){ +'use strict'; + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; +} + +module.exports = stackDelete; + +},{}],305:[function(require,module,exports){ +"use strict"; + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +module.exports = stackGet; + +},{}],306:[function(require,module,exports){ +"use strict"; + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +module.exports = stackHas; + +},{}],307:[function(require,module,exports){ +'use strict'; + +var ListCache = require('./_ListCache'), + Map = require('./_Map'), + MapCache = require('./_MapCache'); + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} + +module.exports = stackSet; + +},{"./_ListCache":205,"./_Map":206,"./_MapCache":207}],308:[function(require,module,exports){ +'use strict'; + +var memoizeCapped = require('./_memoizeCapped'), + toString = require('./toString'); + +/** Used to match property names within property paths. */ +var reLeadingDot = /^\./, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoizeCapped(function (string) { + string = toString(string); + + var result = []; + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function (match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : number || match); + }); + return result; +}); + +module.exports = stringToPath; + +},{"./_memoizeCapped":291,"./toString":334}],309:[function(require,module,exports){ +'use strict'; + +var isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = value + ''; + return result == '0' && 1 / value == -INFINITY ? '-0' : result; +} + +module.exports = toKey; + +},{"./isSymbol":328}],310:[function(require,module,exports){ +'use strict'; + +/** Used for built-in method references. */ +var funcProto = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ''; + } catch (e) {} + } + return ''; +} + +module.exports = toSource; + +},{}],311:[function(require,module,exports){ +'use strict'; + +var assignValue = require('./_assignValue'), + copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + isArrayLike = require('./isArrayLike'), + isPrototype = require('./_isPrototype'), + keys = require('./keys'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ +var assign = createAssigner(function (object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } +}); + +module.exports = assign; + +},{"./_assignValue":220,"./_copyObject":251,"./_createAssigner":253,"./_isPrototype":277,"./isArrayLike":321,"./keys":330}],312:[function(require,module,exports){ +"use strict"; + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function () { + return value; + }; +} + +module.exports = constant; + +},{}],313:[function(require,module,exports){ +'use strict'; + +var baseAssign = require('./_baseAssign'), + baseCreate = require('./_baseCreate'); + +/** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ +function create(prototype, properties) { + var result = baseCreate(prototype); + return properties ? baseAssign(result, properties) : result; +} + +module.exports = create; + +},{"./_baseAssign":222,"./_baseCreate":224}],314:[function(require,module,exports){ +"use strict"; + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || value !== value && other !== other; +} + +module.exports = eq; + +},{}],315:[function(require,module,exports){ +'use strict'; + +var arrayEvery = require('./_arrayEvery'), + baseEvery = require('./_baseEvery'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'), + isIterateeCall = require('./_isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ +function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, baseIteratee(predicate, 3)); +} + +module.exports = every; + +},{"./_arrayEvery":216,"./_baseEvery":226,"./_baseIteratee":238,"./_isIterateeCall":273,"./isArray":320}],316:[function(require,module,exports){ +'use strict'; + +var baseGet = require('./_baseGet'); + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +module.exports = get; + +},{"./_baseGet":229}],317:[function(require,module,exports){ +'use strict'; + +var baseHasIn = require('./_baseHasIn'), + hasPath = require('./_hasPath'); + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); +} + +module.exports = hasIn; + +},{"./_baseHasIn":231,"./_hasPath":266}],318:[function(require,module,exports){ +"use strict"; + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; + +},{}],319:[function(require,module,exports){ +'use strict'; + +var baseIsArguments = require('./_baseIsArguments'), + isObjectLike = require('./isObjectLike'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function () { + return arguments; +}()) ? baseIsArguments : function (value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); +}; + +module.exports = isArguments; + +},{"./_baseIsArguments":232,"./isObjectLike":327}],320:[function(require,module,exports){ +"use strict"; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + +},{}],321:[function(require,module,exports){ +'use strict'; + +var isFunction = require('./isFunction'), + isLength = require('./isLength'); + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +module.exports = isArrayLike; + +},{"./isFunction":324,"./isLength":325}],322:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var root = require('./_root'), + stubFalse = require('./stubFalse'); + +/** Detect free variable `exports`. */ +var freeExports = (typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)) == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && (typeof module === 'undefined' ? 'undefined' : (0, _typeof3.default)(module)) == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +module.exports = isBuffer; + +},{"./_root":297,"./stubFalse":333,"babel-runtime/helpers/typeof":39}],323:[function(require,module,exports){ +'use strict'; + +var baseKeys = require('./_baseKeys'), + getTag = require('./_getTag'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isArrayLike = require('./isArrayLike'), + isBuffer = require('./isBuffer'), + isPrototype = require('./_isPrototype'), + isTypedArray = require('./isTypedArray'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + setTag = '[object Set]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ +function isEmpty(value) { + if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; +} + +module.exports = isEmpty; + +},{"./_baseKeys":239,"./_getTag":264,"./_isPrototype":277,"./isArguments":319,"./isArray":320,"./isArrayLike":321,"./isBuffer":322,"./isTypedArray":329}],324:[function(require,module,exports){ +'use strict'; + +var isObject = require('./isObject'); + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag || tag == proxyTag; +} + +module.exports = isFunction; + +},{"./isObject":326}],325:[function(require,module,exports){ +'use strict'; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = isLength; + +},{}],326:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value); + return value != null && (type == 'object' || type == 'function'); +} + +module.exports = isObject; + +},{"babel-runtime/helpers/typeof":39}],327:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) == 'object'; +} + +module.exports = isObjectLike; + +},{"babel-runtime/helpers/typeof":39}],328:[function(require,module,exports){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag; +} + +module.exports = isSymbol; + +},{"./isObjectLike":327,"babel-runtime/helpers/typeof":39}],329:[function(require,module,exports){ +'use strict'; + +var baseIsTypedArray = require('./_baseIsTypedArray'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +module.exports = isTypedArray; + +},{"./_baseIsTypedArray":237,"./_baseUnary":248,"./_nodeUtil":294}],330:[function(require,module,exports){ +'use strict'; + +var arrayLikeKeys = require('./_arrayLikeKeys'), + baseKeys = require('./_baseKeys'), + isArrayLike = require('./isArrayLike'); + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} + +module.exports = keys; + +},{"./_arrayLikeKeys":217,"./_baseKeys":239,"./isArrayLike":321}],331:[function(require,module,exports){ +'use strict'; + +var MapCache = require('./_MapCache'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize(func, resolver) { + if (typeof func != 'function' || resolver && typeof resolver != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function memoized() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache)(); + return memoized; +} + +// Expose `MapCache`. +memoize.Cache = MapCache; + +module.exports = memoize; + +},{"./_MapCache":207}],332:[function(require,module,exports){ +'use strict'; + +var baseProperty = require('./_baseProperty'), + basePropertyDeep = require('./_basePropertyDeep'), + isKey = require('./_isKey'), + toKey = require('./_toKey'); + +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); +} + +module.exports = property; + +},{"./_baseProperty":242,"./_basePropertyDeep":243,"./_isKey":274,"./_toKey":309}],333:[function(require,module,exports){ +"use strict"; + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +module.exports = stubFalse; + +},{}],334:[function(require,module,exports){ +'use strict'; + +var baseToString = require('./_baseToString'); + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +module.exports = toString; + +},{"./_baseToString":247}],335:[function(require,module,exports){ +/*! + * merge-descriptors + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +var _defineProperty = require('babel-runtime/core-js/object/define-property'); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor'); + +var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); + +var _getOwnPropertyNames = require('babel-runtime/core-js/object/get-own-property-names'); + +var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = merge; + +/** + * Module variables. + * @private + */ + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * Merge the property descriptors of `src` into `dest` + * + * @param {object} dest Object to add descriptors to + * @param {object} src Object to clone descriptors from + * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties + * @returns {object} Reference to dest + * @public + */ + +function merge(dest, src, redefine) { + if (!dest) { + throw new TypeError('argument dest is required'); + } + + if (!src) { + throw new TypeError('argument src is required'); + } + + if (redefine === undefined) { + // Default to true + redefine = true; + } + + (0, _getOwnPropertyNames2.default)(src).forEach(function forEachOwnPropertyName(name) { + if (!redefine && hasOwnProperty.call(dest, name)) { + // Skip desriptor + return; + } + + // Copy descriptor + var descriptor = (0, _getOwnPropertyDescriptor2.default)(src, name); + (0, _defineProperty2.default)(dest, name, descriptor); + }); + + return dest; +} + +},{"babel-runtime/core-js/object/define-property":24,"babel-runtime/core-js/object/get-own-property-descriptor":25,"babel-runtime/core-js/object/get-own-property-names":26}],336:[function(require,module,exports){ +(function (process){ +'use strict'; + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var path = require('path'); +var fs = require('fs'); + +function Mime() { + // Map of extension -> mime type + this.types = (0, _create2.default)(null); + + // Map of mime type -> extension + this.extensions = (0, _create2.default)(null); +} + +/** + * Define mimetype -> extension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * @param map (Object) type definitions + */ +Mime.prototype.define = function (map) { + for (var type in map) { + var exts = map[type]; + for (var i = 0; i < exts.length; i++) { + if (process.env.DEBUG_MIME && this.types[exts]) { + console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' + this.types[exts] + ' to ' + type); + } + + this.types[exts[i]] = type; + } + + // Default extension is the first one we encounter + if (!this.extensions[type]) { + this.extensions[type] = exts[0]; + } + } +}; + +/** + * Load an Apache2-style ".types" file + * + * This may be called multiple times (it's expected). Where files declare + * overlapping types/extensions, the last file wins. + * + * @param file (String) path of file to load. + */ +Mime.prototype.load = function (file) { + this._loading = file; + // Read file and split into lines + var map = {}, + content = fs.readFileSync(file, 'ascii'), + lines = content.split(/[\r\n]+/); + + lines.forEach(function (line) { + // Clean up whitespace/comments, and split into fields + var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); + map[fields.shift()] = fields; + }); + + this.define(map); + + this._loading = null; +}; + +/** + * Lookup a mime type based on extension + */ +Mime.prototype.lookup = function (path, fallback) { + var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase(); + + return this.types[ext] || fallback || this.default_type; +}; + +/** + * Return file extension associated with a mime type + */ +Mime.prototype.extension = function (mimeType) { + var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); + return this.extensions[type]; +}; + +// Default instance +var mime = new Mime(); + +// Define built-in types +mime.define(require('./types.json')); + +// Default type +mime.default_type = mime.lookup('bin'); + +// +// Additional API specific to the default instance +// + +mime.Mime = Mime; + +/** + * Lookup a charset based on mime type. + */ +mime.charsets = { + lookup: function lookup(mimeType, fallback) { + // Assume text types are utf8 + return (/^text\//.test(mimeType) ? 'UTF-8' : fallback + ); + } +}; + +module.exports = mime; + +}).call(this,require('_process')) +},{"./types.json":337,"_process":345,"babel-runtime/core-js/object/create":22,"fs":43,"path":342}],337:[function(require,module,exports){ +module.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mdp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":["woff"],"application/font-woff2":["woff2"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["dmg"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-otf":["otf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-ttf":["ttf","ttc"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["iso"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdownload":["exe","dll","com","bat","msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","wmz","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-nzb":["nzb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-research-info-systems":["ris"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl","xsd"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp4":["mp4a","m4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-wav":["wav"],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"font/opentype":["otf"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/g3fax":["g3"],"image/gif":["gif"],"image/ief":["ief"],"image/jpeg":["jpeg","jpg","jpe"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-mrsid-image":["sid"],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee"],"text/css":["css"],"text/csv":["csv"],"text/hjson":["hjson"],"text/html":["html","htm"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/sgml":["sgml","sgm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/vtt":["vtt"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["markdown","md","mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-pascal":["p","pas"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]} + +},{}],338:[function(require,module,exports){ +'use strict'; + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long ? long(val) : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} + +},{}],339:[function(require,module,exports){ +'use strict'; + +exports.endianness = function () { + return 'LE'; +}; + +exports.hostname = function () { + if (typeof location !== 'undefined') { + return location.hostname; + } else return ''; +}; + +exports.loadavg = function () { + return []; +}; + +exports.uptime = function () { + return 0; +}; + +exports.freemem = function () { + return Number.MAX_VALUE; +}; + +exports.totalmem = function () { + return Number.MAX_VALUE; +}; + +exports.cpus = function () { + return []; +}; + +exports.type = function () { + return 'Browser'; +}; + +exports.release = function () { + if (typeof navigator !== 'undefined') { + return navigator.appVersion; + } + return ''; +}; + +exports.networkInterfaces = exports.getNetworkInterfaces = function () { + return {}; +}; + +exports.arch = function () { + return 'javascript'; +}; + +exports.platform = function () { + return 'browser'; +}; + +exports.tmpdir = exports.tmpDir = function () { + return '/tmp'; +}; + +exports.EOL = '\n'; + +},{}],340:[function(require,module,exports){ +'use strict'; + +var os = require('os'); +var osxRelease = require('osx-release'); +var winRelease = require('win-release'); + +module.exports = function (platform, release) { + if (!platform && release) { + throw new Error('You can\'t specify a `release` without specfying `platform`'); + } + + platform = platform || os.platform(); + release = release || os.release(); + + var id; + + if (platform === 'darwin') { + id = osxRelease(release).name; + return 'OS X' + (id ? ' ' + id : ''); + } + + if (platform === 'linux') { + id = release.replace(/^(\d+\.\d+).*/, '$1'); + return 'Linux' + (id ? ' ' + id : ''); + } + + if (platform === 'win32') { + id = winRelease(release); + return 'Windows' + (id ? ' ' + id : ''); + } + + return platform; +}; + +},{"os":339,"osx-release":341,"win-release":397}],341:[function(require,module,exports){ +'use strict'; + +var os = require('os'); + +var nameMap = { + '15': 'El Capitan', + '14': 'Yosemite', + '13': 'Mavericks', + '12': 'Mountain Lion', + '11': 'Lion', + '10': 'Snow Leopard', + '9': 'Leopard', + '8': 'Tiger', + '7': 'Panther', + '6': 'Jaguar', + '5': 'Puma' +}; + +module.exports = function (release) { + release = (release || os.release()).split('.')[0]; + return { + name: nameMap[release], + version: '10.' + (Number(release) - 4) + }; +}; + +},{"os":339}],342:[function(require,module,exports){ +(function (process){ +'use strict'; + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function splitPath(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function () { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function (path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function (p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function (path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function () { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function (p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + +// path.relative(from, to) +// posix version +exports.relative = function (from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function (path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + +exports.basename = function (path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + +exports.extname = function (path) { + return splitPath(path)[3]; +}; + +function filter(xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) { + return str.substr(start, len); +} : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); +}; + +}).call(this,require('_process')) +},{"_process":345}],343:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/*! + * Platform.js v1.3.1 + * Copyright 2014-2016 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ +;(function () { + 'use strict'; + + /** Used to determine if values are of the language type `Object` */ + + var objectTypes = { + 'function': true, + 'object': true + }; + + /** Used as a reference to the global object */ + var root = objectTypes[typeof window === 'undefined' ? 'undefined' : (0, _typeof3.default)(window)] && window || this; + + /** Backup possible global object */ + var oldRoot = root; + + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module === 'undefined' ? 'undefined' : (0, _typeof3.default)(module)] && module && !module.nodeType && module; + + /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ + var freeGlobal = freeExports && freeModule && (typeof global === 'undefined' ? 'undefined' : (0, _typeof3.default)(global)) == 'object' && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } + + /** + * Used as the maximum length of an array-like object. + * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + */ + var maxSafeInteger = Math.pow(2, 53) - 1; + + /** Opera regexp */ + var reOpera = /\bOpera/; + + /** Possible global object */ + var thisBinding = this; + + /** Used for native method references */ + var objectProto = Object.prototype; + + /** Used to check for own properties of an object */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to resolve the internal `[[Class]]` of values */ + var toString = objectProto.toString; + + /*--------------------------------------------------------------------------*/ + + /** + * Capitalizes a string value. + * + * @private + * @param {string} string The string to capitalize. + * @returns {string} The capitalized string. + */ + function capitalize(string) { + string = String(string); + return string.charAt(0).toUpperCase() + string.slice(1); + } + + /** + * A utility function to clean up the OS name. + * + * @private + * @param {string} os The OS name to clean up. + * @param {string} [pattern] A `RegExp` pattern matching the OS name. + * @param {string} [label] A label for the OS. + */ + function cleanupOS(os, pattern, label) { + // platform tokens defined at + // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx + // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx + var data = { + '6.4': '10', + '6.3': '8.1', + '6.2': '8', + '6.1': 'Server 2008 R2 / 7', + '6.0': 'Server 2008 / Vista', + '5.2': 'Server 2003 / XP 64-bit', + '5.1': 'XP', + '5.01': '2000 SP1', + '5.0': '2000', + '4.0': 'NT', + '4.90': 'ME' + }; + // detect Windows version from platform tokens + if (pattern && label && /^Win/i.test(os) && (data = data[(0 /*Opera 9.25 fix*/, /[\d.]+$/.exec(os))])) { + os = 'Windows ' + data; + } + // correct character case and cleanup + os = String(os); + + if (pattern && label) { + os = os.replace(RegExp(pattern, 'i'), label); + } + + os = format(os.replace(/ ce$/i, ' CE').replace(/\bhpw/i, 'web').replace(/\bMacintosh\b/, 'Mac OS').replace(/_PowerPC\b/i, ' OS').replace(/\b(OS X) [^ \d]+/i, '$1').replace(/\bMac (OS X)\b/, '$1').replace(/\/(\d)/, ' $1').replace(/_/g, '.').replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '').replace(/\bx86\.64\b/gi, 'x86_64').replace(/\b(Windows Phone) OS\b/, '$1').split(' on ')[0]); + + return os; + } + + /** + * An iteration utility for arrays and objects. + * + * @private + * @param {Array|Object} object The object to iterate over. + * @param {Function} callback The function called per iteration. + */ + function each(object, callback) { + var index = -1, + length = object ? object.length : 0; + + if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) { + while (++index < length) { + callback(object[index], index, object); + } + } else { + forOwn(object, callback); + } + } + + /** + * Trim and conditionally capitalize string values. + * + * @private + * @param {string} string The string to format. + * @returns {string} The formatted string. + */ + function format(string) { + string = trim(string); + return (/^(?:webOS|i(?:OS|P))/.test(string) ? string : capitalize(string) + ); + } + + /** + * Iterates over an object's own properties, executing the `callback` for each. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} callback The function executed per own property. + */ + function forOwn(object, callback) { + for (var key in object) { + if (hasOwnProperty.call(object, key)) { + callback(object[key], key, object); + } + } + } + + /** + * Gets the internal `[[Class]]` of a value. + * + * @private + * @param {*} value The value. + * @returns {string} The `[[Class]]`. + */ + function getClassOf(value) { + return value == null ? capitalize(value) : toString.call(value).slice(8, -1); + } + + /** + * Host objects can return type values that are different from their actual + * data type. The objects we are concerned with usually return non-primitive + * types of "object", "function", or "unknown". + * + * @private + * @param {*} object The owner of the property. + * @param {string} property The property to check. + * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`. + */ + function isHostType(object, property) { + var type = object != null ? (0, _typeof3.default)(object[property]) : 'number'; + return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true); + } + + /** + * Prepares a string for use in a `RegExp` by making hyphens and spaces optional. + * + * @private + * @param {string} string The string to qualify. + * @returns {string} The qualified string. + */ + function qualify(string) { + return String(string).replace(/([ -])(?!$)/g, '$1?'); + } + + /** + * A bare-bones `Array#reduce` like utility function. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function called per iteration. + * @returns {*} The accumulated result. + */ + function reduce(array, callback) { + var accumulator = null; + each(array, function (value, index) { + accumulator = callback(accumulator, value, index, array); + }); + return accumulator; + } + + /** + * Removes leading and trailing whitespace from a string. + * + * @private + * @param {string} string The string to trim. + * @returns {string} The trimmed string. + */ + function trim(string) { + return String(string).replace(/^ +| +$/g, ''); + } + + /*--------------------------------------------------------------------------*/ + + /** + * Creates a new platform object. + * + * @memberOf platform + * @param {Object|string} [ua=navigator.userAgent] The user agent string or + * context object. + * @returns {Object} A platform object. + */ + function parse(ua) { + + /** The environment context object */ + var context = root; + + /** Used to flag when a custom context is provided */ + var isCustomContext = ua && (typeof ua === 'undefined' ? 'undefined' : (0, _typeof3.default)(ua)) == 'object' && getClassOf(ua) != 'String'; + + // juggle arguments + if (isCustomContext) { + context = ua; + ua = null; + } + + /** Browser navigator object */ + var nav = context.navigator || {}; + + /** Browser user agent string */ + var userAgent = nav.userAgent || ''; + + ua || (ua = userAgent); + + /** Used to flag when `thisBinding` is the [ModuleScope] */ + var isModuleScope = isCustomContext || thisBinding == oldRoot; + + /** Used to detect if browser is like Chrome */ + var likeChrome = isCustomContext ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString()); + + /** Internal `[[Class]]` value shortcuts */ + var objectClass = 'Object', + airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject', + enviroClass = isCustomContext ? objectClass : 'Environment', + javaClass = isCustomContext && context.java ? 'JavaPackage' : getClassOf(context.java), + phantomClass = isCustomContext ? objectClass : 'RuntimeObject'; + + /** Detect Java environment */ + var java = /\bJava/.test(javaClass) && context.java; + + /** Detect Rhino */ + var rhino = java && getClassOf(context.environment) == enviroClass; + + /** A character to represent alpha */ + var alpha = java ? 'a' : '\u03B1'; + + /** A character to represent beta */ + var beta = java ? 'b' : '\u03B2'; + + /** Browser document object */ + var doc = context.document || {}; + + /** + * Detect Opera browser (Presto-based) + * http://www.howtocreate.co.uk/operaStuff/operaObject.html + * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini + */ + var opera = context.operamini || context.opera; + + /** Opera `[[Class]]` */ + var operaClass = reOpera.test(operaClass = isCustomContext && opera ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : opera = null; + + /*------------------------------------------------------------------------*/ + + /** Temporary variable used over the script's lifetime */ + var data; + + /** The CPU architecture */ + var arch = ua; + + /** Platform description array */ + var description = []; + + /** Platform alpha/beta indicator */ + var prerelease = null; + + /** A flag to indicate that environment features should be used to resolve the platform */ + var useFeatures = ua == userAgent; + + /** The browser/environment version */ + var version = useFeatures && opera && typeof opera.version == 'function' && opera.version(); + + /** A flag to indicate if the OS ends with "/ Version" */ + var isSpecialCasedOS; + + /* Detectable layout engines (order is important) */ + var layout = getLayout(['Trident', { 'label': 'WebKit', 'pattern': 'AppleWebKit' }, 'iCab', 'Presto', 'NetFront', 'Tasman', 'KHTML', 'Gecko']); + + /* Detectable browser names (order is important) */ + var name = getName(['Adobe AIR', 'Arora', 'Avant Browser', 'Breach', 'Camino', 'Epiphany', 'Fennec', 'Flock', 'Galeon', 'GreenBrowser', 'iCab', 'Iceweasel', { 'label': 'SRWare Iron', 'pattern': 'Iron' }, 'K-Meleon', 'Konqueror', 'Lunascape', 'Maxthon', 'Midori', 'Nook Browser', 'PhantomJS', 'Raven', 'Rekonq', 'RockMelt', 'SeaMonkey', { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Sleipnir', 'SlimBrowser', 'Sunrise', 'Swiftfox', 'WebPositive', 'Opera Mini', { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, 'Opera', { 'label': 'Opera', 'pattern': 'OPR' }, 'Chrome', { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, { 'label': 'IE', 'pattern': 'IEMobile' }, { 'label': 'IE', 'pattern': 'MSIE' }, 'Safari']); + + /* Detectable products (order is important) */ + var product = getProduct([{ 'label': 'BlackBerry', 'pattern': 'BB10' }, 'BlackBerry', { 'label': 'Galaxy S', 'pattern': 'GT-I9000' }, { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' }, { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' }, { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' }, 'Google TV', 'Lumia', 'iPad', 'iPod', 'iPhone', 'Kindle', { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Nook', 'PlayBook', 'PlayStation 4', 'PlayStation 3', 'PlayStation Vita', 'TouchPad', 'Transformer', { 'label': 'Wii U', 'pattern': 'WiiU' }, 'Wii', 'Xbox One', { 'label': 'Xbox 360', 'pattern': 'Xbox' }, 'Xoom']); + + /* Detectable manufacturers */ + var manufacturer = getManufacturer({ + 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, + 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, + 'Asus': { 'Transformer': 1 }, + 'Barnes & Noble': { 'Nook': 1 }, + 'BlackBerry': { 'PlayBook': 1 }, + 'Google': { 'Google TV': 1 }, + 'HP': { 'TouchPad': 1 }, + 'HTC': {}, + 'LG': {}, + 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, + 'Motorola': { 'Xoom': 1 }, + 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, + 'Nokia': { 'Lumia': 1 }, + 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, + 'Sony': { 'PlayStation 4': 1, 'PlayStation 3': 1, 'PlayStation Vita': 1 } + }); + + /* Detectable OSes (order is important) */ + var os = getOS(['Windows Phone ', 'Android', 'CentOS', 'Debian', 'Fedora', 'FreeBSD', 'Gentoo', 'Haiku', 'Kubuntu', 'Linux Mint', 'Red Hat', 'SuSE', 'Ubuntu', 'Xubuntu', 'Cygwin', 'Symbian OS', 'hpwOS', 'webOS ', 'webOS', 'Tablet OS', 'Linux', 'Mac OS X', 'Macintosh', 'Mac', 'Windows 98;', 'Windows ']); + + /*------------------------------------------------------------------------*/ + + /** + * Picks the layout engine from an array of guesses. + * + * @private + * @param {Array} guesses An array of guesses. + * @returns {null|string} The detected layout engine. + */ + function getLayout(guesses) { + return reduce(guesses, function (result, guess) { + return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess); + }); + } + + /** + * Picks the manufacturer from an array of guesses. + * + * @private + * @param {Array} guesses An object of guesses. + * @returns {null|string} The detected manufacturer. + */ + function getManufacturer(guesses) { + return reduce(guesses, function (result, value, key) { + // lookup the manufacturer by product or scan the UA for the manufacturer + return result || (value[product] || value[(0 /*Opera 9.25 fix*/, /^[a-z]+(?: +[a-z]+\b)*/i.exec(product))] || RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)) && key; + }); + } + + /** + * Picks the browser name from an array of guesses. + * + * @private + * @param {Array} guesses An array of guesses. + * @returns {null|string} The detected browser name. + */ + function getName(guesses) { + return reduce(guesses, function (result, guess) { + return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess); + }); + } + + /** + * Picks the OS name from an array of guesses. + * + * @private + * @param {Array} guesses An array of guesses. + * @returns {null|string} The detected OS name. + */ + function getOS(guesses) { + return reduce(guesses, function (result, guess) { + var pattern = guess.pattern || qualify(guess); + if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua))) { + result = cleanupOS(result, pattern, guess.label || guess); + } + return result; + }); + } + + /** + * Picks the product name from an array of guesses. + * + * @private + * @param {Array} guesses An array of guesses. + * @returns {null|string} The detected product name. + */ + function getProduct(guesses) { + return reduce(guesses, function (result, guess) { + var pattern = guess.pattern || qualify(guess); + if (!result && (result = RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) || RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua))) { + // split by forward slash and append product version if needed + if ((result = String(guess.label && !RegExp(pattern, 'i').test(guess.label) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) { + result[0] += ' ' + result[1]; + } + // correct character case and cleanup + guess = guess.label || guess; + result = format(result[0].replace(RegExp(pattern, 'i'), guess).replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ').replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2')); + } + return result; + }); + } + + /** + * Resolves the version using an array of UA patterns. + * + * @private + * @param {Array} patterns An array of UA patterns. + * @returns {null|string} The detected version. + */ + function getVersion(patterns) { + return reduce(patterns, function (result, pattern) { + return result || (RegExp(pattern + '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null; + }); + } + + /** + * Returns `platform.description` when the platform object is coerced to a string. + * + * @name toString + * @memberOf platform + * @returns {string} Returns `platform.description` if available, else an empty string. + */ + function toStringPlatform() { + return this.description || ''; + } + + /*------------------------------------------------------------------------*/ + + // convert layout to an array so we can add extra details + layout && (layout = [layout]); + + // detect product names that contain their manufacturer's name + if (manufacturer && !product) { + product = getProduct([manufacturer]); + } + // clean up Google TV + if (data = /\bGoogle TV\b/.exec(product)) { + product = data[0]; + } + // detect simulators + if (/\bSimulator\b/i.test(ua)) { + product = (product ? product + ' ' : '') + 'Simulator'; + } + // detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS + if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) { + description.push('running in Turbo/Uncompressed mode'); + } + // detect iOS + if (/^iP/.test(product)) { + name || (name = 'Safari'); + os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) ? ' ' + data[1].replace(/_/g, '.') : ''); + } + // detect Kubuntu + else if (name == 'Konqueror' && !/buntu/i.test(os)) { + os = 'Kubuntu'; + } + // detect Android browsers + else if (manufacturer && manufacturer != 'Google' && (/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua) || /\bVita\b/.test(product))) { + name = 'Android Browser'; + os = /\bAndroid\b/.test(os) ? os : 'Android'; + } + // detect false positives for Firefox/Safari + else if (!name || (data = !/\bMinefield\b|\(Android;/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) { + // escape the `/` for Firefox 1 + if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) { + // clear name of false positives + name = null; + } + // reassign a generic name + if ((data = product || manufacturer || os) && (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) { + name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser'; + } + } + // detect Firefox OS + if ((data = /\((Mobile|Tablet).*?Firefox\b/i.exec(ua)) && data[1]) { + os = 'Firefox OS'; + if (!product) { + product = data[1]; + } + } + // detect non-Opera versions (order is important) + if (!version) { + version = getVersion(['(?:Cloud9|CriOS|CrMo|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|Silk(?!/[\\d.]+$))', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)']); + } + // detect stubborn layout engines + if (layout == 'iCab' && parseFloat(version) > 3) { + layout = ['WebKit']; + } else if (layout != 'Trident' && (data = /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' || !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident'))) { + layout = [data]; + } + // detect NetFront on PlayStation + else if (/\bPlayStation\b(?! Vita\b)/i.test(name) && layout == 'WebKit') { + layout = ['NetFront']; + } + // detect Windows Phone 7 desktop mode + if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) { + name += ' Mobile'; + os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x'); + description.unshift('desktop mode'); + } + // detect Windows Phone 8+ desktop mode + else if (/\bWPDesktop\b/i.test(ua)) { + name = 'IE Mobile'; + os = 'Windows Phone 8+'; + description.unshift('desktop mode'); + version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]); + } + // detect IE 11 and above + else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) { + if (!/\bWPDesktop\b/i.test(ua)) { + if (name) { + description.push('identifying as ' + name + (version ? ' ' + version : '')); + } + name = 'IE'; + } + version = data[1]; + } + // detect Microsoft Edge + else if ((name == 'Chrome' || name != 'IE') && (data = /\bEdge\/([\d.]+)/.exec(ua))) { + name = 'Microsoft Edge'; + version = data[1]; + layout = ['Trident']; + } + // leverage environment features + if (useFeatures) { + // detect server-side environments + // Rhino has a global function while others have a global object + if (isHostType(context, 'global')) { + if (java) { + data = java.lang.System; + arch = data.getProperty('os.arch'); + os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); + } + if (isModuleScope && isHostType(context, 'system') && (data = [context.system])[0]) { + os || (os = data[0].os || null); + try { + data[1] = context.require('ringo/engine').version; + version = data[1].join('.'); + name = 'RingoJS'; + } catch (e) { + if (data[0].global.system == context.system) { + name = 'Narwhal'; + } + } + } else if ((0, _typeof3.default)(context.process) == 'object' && (data = context.process)) { + name = 'Node.js'; + arch = data.arch; + os = data.platform; + version = /[\d.]+/.exec(data.version)[0]; + } else if (rhino) { + name = 'Rhino'; + } + } + // detect Adobe AIR + else if (getClassOf(data = context.runtime) == airRuntimeClass) { + name = 'Adobe AIR'; + os = data.flash.system.Capabilities.os; + } + // detect PhantomJS + else if (getClassOf(data = context.phantom) == phantomClass) { + name = 'PhantomJS'; + version = (data = data.version || null) && data.major + '.' + data.minor + '.' + data.patch; + } + // detect IE compatibility modes + else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) { + // we're in compatibility mode when the Trident version + 4 doesn't + // equal the document mode + version = [version, doc.documentMode]; + if ((data = +data[1] + 4) != version[1]) { + description.push('IE ' + version[1] + ' mode'); + layout && (layout[1] = ''); + version[1] = data; + } + version = name == 'IE' ? String(version[1].toFixed(1)) : version[0]; + } + os = os && format(os); + } + // detect prerelease phases + if (version && (data = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || /\bMinefield\b/i.test(ua) && 'a')) { + prerelease = /b/i.test(data) ? 'beta' : 'alpha'; + version = version.replace(RegExp(data + '\\+?$'), '') + (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); + } + // detect Firefox Mobile + if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) { + name = 'Firefox Mobile'; + } + // obscure Maxthon's unreliable version + else if (name == 'Maxthon' && version) { + version = version.replace(/\.[\d.]+/, '.x'); + } + // detect Silk desktop/accelerated modes + else if (name == 'Silk') { + if (!/\bMobi/i.test(ua)) { + os = 'Android'; + description.unshift('desktop mode'); + } + if (/Accelerated *= *true/i.test(ua)) { + description.unshift('accelerated'); + } + } + // detect Xbox 360 and Xbox One + else if (/\bXbox\b/i.test(product)) { + os = null; + if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) { + description.unshift('mobile mode'); + } + } + // add mobile postfix + else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) { + name += ' Mobile'; + } + // detect IE platform preview + else if (name == 'IE' && useFeatures && context.external === null) { + description.unshift('platform preview'); + } + // detect BlackBerry OS version + // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp + else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || version)) { + data = [data, /BB10/.test(ua)]; + os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0]; + version = null; + } + // detect Opera identifying/masking itself as another browser + // http://www.opera.com/support/kb/view/843/ + else if (this != forOwn && product != 'Wii' && (useFeatures && opera || /Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua) || name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os) || name == 'IE' && (os && !/^Win/.test(os) && version > 5.5 || /\bWindows XP\b/.test(os) && version > 8 || version == 8 && !/\bTrident\b/.test(ua))) && !reOpera.test(data = parse.call(forOwn, ua.replace(reOpera, '') + ';')) && data.name) { + + // when "indentifying", the UA contains both Opera and the other browser's name + data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : ''); + if (reOpera.test(name)) { + if (/\bIE\b/.test(data) && os == 'Mac OS') { + os = null; + } + data = 'identify' + data; + } + // when "masking", the UA contains only the other browser's name + else { + data = 'mask' + data; + if (operaClass) { + name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2')); + } else { + name = 'Opera'; + } + if (/\bIE\b/.test(data)) { + os = null; + } + if (!useFeatures) { + version = null; + } + } + layout = ['Presto']; + description.push(data); + } + // detect WebKit Nightly and approximate Chrome/Safari versions + if (data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1]) { + // correct build for numeric comparison + // (e.g. "532.5" becomes "532.05") + data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data]; + // nightly builds are postfixed with a `+` + if (name == 'Safari' && data[1].slice(-1) == '+') { + name = 'WebKit Nightly'; + prerelease = 'alpha'; + version = data[1].slice(0, -1); + } + // clear incorrect browser versions + else if (version == data[1] || version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { + version = null; + } + // use the full Chrome version when available + data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1]; + // detect Blink layout engine + if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && name != 'IE' && name != 'Microsoft Edge') { + layout = ['Blink']; + } + // detect JavaScriptCore + // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi + if (!useFeatures || !likeChrome && !data[1]) { + layout && (layout[1] = 'like Safari'); + data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8'); + } else { + layout && (layout[1] = 'like Chrome'); + data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28'); + } + // add the postfix of ".x" or "+" for approximate versions + layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+')); + // obscure version for some Safari 1-2 releases + if (name == 'Safari' && (!version || parseInt(version) > 45)) { + version = data; + } + } + // detect Opera desktop modes + if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) { + name += ' '; + description.unshift('desktop mode'); + if (data == 'zvav') { + name += 'Mini'; + version = null; + } else { + name += 'Mobile'; + } + os = os.replace(RegExp(' *' + data + '$'), ''); + } + // detect Chrome desktop mode + else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) { + description.unshift('desktop mode'); + name = 'Chrome Mobile'; + version = null; + + if (/\bOS X\b/.test(os)) { + manufacturer = 'Apple'; + os = 'iOS 4.3+'; + } else { + os = null; + } + } + // strip incorrect OS versions + if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 && ua.indexOf('/' + data + '-') > -1) { + os = trim(os.replace(data, '')); + } + // add layout engine + if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (/Browser|Lunascape|Maxthon/.test(name) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Sleipnir|Web)/.test(name) && layout[1])) { + // don't add layout details to description if they are falsey + (data = layout[layout.length - 1]) && description.push(data); + } + // combine contextual information + if (description.length) { + description = ['(' + description.join('; ') + ')']; + } + // append manufacturer + if (manufacturer && product && product.indexOf(manufacturer) < 0) { + description.push('on ' + manufacturer); + } + // append product + if (product) { + description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product); + } + // parse OS into an object + if (os) { + data = / ([\d.+]+)$/.exec(os); + isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/'; + os = { + 'architecture': 32, + 'family': data && !isSpecialCasedOS ? os.replace(data[0], '') : os, + 'version': data ? data[1] : null, + 'toString': function toString() { + var version = this.version; + return this.family + (version && !isSpecialCasedOS ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); + } + }; + } + // add browser/OS architecture + if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) { + if (os) { + os.architecture = 64; + os.family = os.family.replace(RegExp(' *' + data), ''); + } + if (name && (/\bWOW64\b/i.test(ua) || useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) { + description.unshift('32-bit'); + } + } + + ua || (ua = null); + + /*------------------------------------------------------------------------*/ + + /** + * The platform object. + * + * @name platform + * @type Object + */ + var platform = {}; + + /** + * The platform description. + * + * @memberOf platform + * @type string|null + */ + platform.description = ua; + + /** + * The name of the browser's layout engine. + * + * @memberOf platform + * @type string|null + */ + platform.layout = layout && layout[0]; + + /** + * The name of the product's manufacturer. + * + * @memberOf platform + * @type string|null + */ + platform.manufacturer = manufacturer; + + /** + * The name of the browser/environment. + * + * @memberOf platform + * @type string|null + */ + platform.name = name; + + /** + * The alpha/beta release indicator. + * + * @memberOf platform + * @type string|null + */ + platform.prerelease = prerelease; + + /** + * The name of the product hosting the browser. + * + * @memberOf platform + * @type string|null + */ + platform.product = product; + + /** + * The browser's user agent string. + * + * @memberOf platform + * @type string|null + */ + platform.ua = ua; + + /** + * The browser/environment version. + * + * @memberOf platform + * @type string|null + */ + platform.version = name && version; + + /** + * The name of the operating system. + * + * @memberOf platform + * @type Object + */ + platform.os = os || { + + /** + * The CPU architecture the OS is built for. + * + * @memberOf platform.os + * @type number|null + */ + 'architecture': null, + + /** + * The family of the OS. + * + * Common values include: + * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", + * "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE", + * "Android", "iOS" and "Windows Phone" + * + * @memberOf platform.os + * @type string|null + */ + 'family': null, + + /** + * The version of the OS. + * + * @memberOf platform.os + * @type string|null + */ + 'version': null, + + /** + * Returns the OS string. + * + * @memberOf platform.os + * @returns {string} The OS string. + */ + 'toString': function toString() { + return 'null'; + } + }; + + platform.parse = parse; + platform.toString = toStringPlatform; + + if (platform.version) { + description.unshift(version); + } + if (platform.name) { + description.unshift(name); + } + if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) { + description.push(product ? '(' + os + ')' : 'on ' + os); + } + if (description.length) { + platform.description = description.join(' '); + } + return platform; + } + + /*--------------------------------------------------------------------------*/ + + // export platform + // some AMD build optimizers, like r.js, check for condition patterns like the following: + if (typeof define == 'function' && (0, _typeof3.default)(define.amd) == 'object' && define.amd) { + // define as an anonymous module so, through path mapping, it can be aliased + define(function () { + return parse(); + }); + } + // check for `exports` after `define` in case a build optimizer adds an `exports` object + else if (freeExports && freeModule) { + // in Narwhal, Node.js, Rhino -require, or RingoJS + forOwn(parse(), function (value, key) { + freeExports[key] = value; + }); + } + // in a browser or Rhino + else { + root.platform = parse(); + } +}).call(undefined); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"babel-runtime/helpers/typeof":39}],344:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (!process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + +}).call(this,require('_process')) +},{"_process":345}],345:[function(require,module,exports){ +'use strict'; + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +})(); +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +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'); +}; + +process.cwd = function () { + return '/'; +}; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function () { + return 0; +}; + +},{}],346:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function (root) { + + /** Detect free variables */ + var freeExports = (typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)) == 'object' && exports && !exports.nodeType && exports; + var freeModule = (typeof module === 'undefined' ? 'undefined' : (0, _typeof3.default)(module)) == 'object' && module && !module.nodeType && module; + var freeGlobal = (typeof global === 'undefined' ? 'undefined' : (0, _typeof3.default)(global)) == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, + // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, + // 0x80 + delimiter = '-', + // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, + // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, + // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { + // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function (value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{ + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base;; /* no condition */k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base;; /* no condition */k += base) { + t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function (string) { + return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function (string) { + return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if (typeof define == 'function' && (0, _typeof3.default)(define.amd) == 'object' && define.amd) { + define('punycode', function () { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } +})(undefined); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"babel-runtime/helpers/typeof":39}],347:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function (qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, + vstr, + k, + v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],348:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var stringifyPrimitive = function stringifyPrimitive(v) { + switch (typeof v === 'undefined' ? 'undefined' : (0, _typeof3.default)(v)) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function (obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if ((typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) === 'object') { + return map(objectKeys(obj), function (k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function (v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map(xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = _keys2.default || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{"babel-runtime/core-js/object/keys":30,"babel-runtime/helpers/typeof":39}],349:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":347,"./encode":348}],350:[function(require,module,exports){ +"use strict"; + +module.exports = require("./lib/_stream_duplex.js"); + +},{"./lib/_stream_duplex.js":351}],351:[function(require,module,exports){ +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var objectKeys = _keys2.default || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +},{"./_stream_readable":353,"./_stream_writable":355,"babel-runtime/core-js/object/keys":30,"core-util-is":176,"inherits":198,"process-nextick-args":344}],352:[function(require,module,exports){ +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +},{"./_stream_transform":354,"core-util-is":176,"inherits":198}],353:[function(require,module,exports){ +(function (process){ +'use strict'; + +module.exports = Readable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var isArray = require('isarray'); +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = require('./internal/streams/BufferList'); +var StringDecoder; + +util.inherits(Readable, Stream); + +function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === 'function') { + return emitter.prependListener(event, fn); + } else { + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + } +} + +var Duplex; +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +var Duplex; +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options && typeof options.read === 'function') this._read = options.read; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = bufferShim.from(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); + } else { + var skipAdd; + if (state.decoder && !addToFront && !encoding) { + chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } + + if (!addToFront) state.reading = false; + + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var _i = 0; _i < len; _i++) { + dests[_i].emit('unpipe', this); + }return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function (ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = bufferShim.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +}).call(this,require('_process')) +},{"./_stream_duplex":351,"./internal/streams/BufferList":356,"_process":345,"buffer":45,"buffer-shims":44,"core-util-is":176,"events":193,"inherits":198,"isarray":357,"process-nextick-args":344,"string_decoder/":374,"util":42}],354:[function(require,module,exports){ +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) stream.push(data); + + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er) { + done(stream, er); + });else done(stream); + }); +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('Not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +function done(stream, er) { + if (er) return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +},{"./_stream_duplex":351,"core-util-is":176,"inherits":198}],355:[function(require,module,exports){ +(function (process){ +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +var _setImmediate2 = require('babel-runtime/core-js/set-immediate'); + +var _setImmediate3 = _interopRequireDefault(_setImmediate2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = Writable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? _setImmediate3.default : processNextTick; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +util.inherits(Writable, Stream); + +function nop() {} + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +var Duplex; +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function writableStateGetBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); + +var Duplex; +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + // Always throw error if a null is written + // if we are not in object mode then throw + // if it is not a buffer, string, or undefined. + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = bufferShim.from(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) processNextTick(cb, er);else cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + while (entry) { + buffer[count] = entry; + entry = entry.next; + count += 1; + } + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequestCount = 0; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) processNextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} + +}).call(this,require('_process')) +},{"./_stream_duplex":351,"_process":345,"babel-runtime/core-js/set-immediate":34,"buffer":45,"buffer-shims":44,"core-util-is":176,"events":193,"inherits":198,"process-nextick-args":344,"util-deprecate":381}],356:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +module.exports = BufferList; + +function BufferList() { + this.head = null; + this.tail = null; + this.length = 0; +} + +BufferList.prototype.push = function (v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; +}; + +BufferList.prototype.unshift = function (v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; +}; + +BufferList.prototype.shift = function () { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; +}; + +BufferList.prototype.clear = function () { + this.head = this.tail = null; + this.length = 0; +}; + +BufferList.prototype.join = function (s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; +}; + +BufferList.prototype.concat = function (n) { + if (this.length === 0) return bufferShim.alloc(0); + if (this.length === 1) return this.head.data; + var ret = bufferShim.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + p.data.copy(ret, i); + i += p.data.length; + p = p.next; + } + return ret; +}; + +},{"buffer":45,"buffer-shims":44}],357:[function(require,module,exports){ +arguments[4][46][0].apply(exports,arguments) +},{"dup":46}],358:[function(require,module,exports){ +"use strict"; + +module.exports = require("./lib/_stream_passthrough.js"); + +},{"./lib/_stream_passthrough.js":352}],359:[function(require,module,exports){ +(function (process){ +'use strict'; + +var Stream = function () { + try { + return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify + } catch (_) {} +}(); +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream || exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); + +if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; +} + +}).call(this,require('_process')) +},{"./lib/_stream_duplex.js":351,"./lib/_stream_passthrough.js":352,"./lib/_stream_readable.js":353,"./lib/_stream_transform.js":354,"./lib/_stream_writable.js":355,"_process":345}],360:[function(require,module,exports){ +"use strict"; + +module.exports = require("./lib/_stream_transform.js"); + +},{"./lib/_stream_transform.js":354}],361:[function(require,module,exports){ +"use strict"; + +module.exports = require("./lib/_stream_writable.js"); + +},{"./lib/_stream_writable.js":355}],362:[function(require,module,exports){ +(function (global){ +"use strict"; + +var _getOwnPropertyNames = require("babel-runtime/core-js/object/get-own-property-names"); + +var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames); + +var _typeof2 = require("babel-runtime/helpers/typeof"); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (typeof global === "undefined" ? "undefined" : (0, _typeof3.default)(global)) === "object" ? global : (typeof window === "undefined" ? "undefined" : (0, _typeof3.default)(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : (0, _typeof3.default)(self)) === "object" ? self : undefined; + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && (0, _getOwnPropertyNames2.default)(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = require("./runtime"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch (e) { + g.regeneratorRuntime = undefined; + } +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./runtime":363,"babel-runtime/core-js/object/get-own-property-names":26,"babel-runtime/helpers/typeof":39}],363:[function(require,module,exports){ +(function (process,global){ +"use strict"; + +var _promise = require("babel-runtime/core-js/promise"); + +var _promise2 = _interopRequireDefault(_promise); + +var _setPrototypeOf = require("babel-runtime/core-js/object/set-prototype-of"); + +var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); + +var _create = require("babel-runtime/core-js/object/create"); + +var _create2 = _interopRequireDefault(_create); + +var _typeof2 = require("babel-runtime/helpers/typeof"); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _symbol = require("babel-runtime/core-js/symbol"); + +var _symbol2 = _interopRequireDefault(_symbol); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + +!function (global) { + "use strict"; + + var hasOwn = Object.prototype.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof _symbol2.default === "function" ? _symbol2.default : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = (typeof module === "undefined" ? "undefined" : (0, _typeof3.default)(module)) === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided, then outerFn.prototype instanceof Generator. + var generator = (0, _create2.default)((outerFn || Generator).prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype; + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function (method) { + prototype[method] = function (arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function (genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" : false; + }; + + runtime.mark = function (genFun) { + if (_setPrototypeOf2.default) { + (0, _setPrototypeOf2.default)(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = (0, _create2.default)(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `value instanceof AwaitArgument` to determine if the yielded value is + // meant to be awaited. Some may consider the name of this method too + // cutesy, but they are curmudgeons. + runtime.awrap = function (arg) { + return new AwaitArgument(arg); + }; + + function AwaitArgument(arg) { + this.arg = arg; + } + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value instanceof AwaitArgument) { + return _promise2.default.resolve(value.arg).then(function (value) { + invoke("next", value, resolve, reject); + }, function (err) { + invoke("throw", err, resolve, reject); + }); + } + + return _promise2.default.resolve(value).then(function (unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + if ((typeof process === "undefined" ? "undefined" : (0, _typeof3.default)(process)) === "object" && process.domain) { + invoke = process.domain.bind(invoke); + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new _promise2.default(function (resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function (innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); + + return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function (result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + while (true) { + var delegate = context.delegate; + if (delegate) { + if (method === "return" || method === "throw" && delegate.iterator[method] === undefined) { + // A return or throw (when the delegate iterator has no throw + // method) always terminates the yield* loop. + context.delegate = null; + + // If the delegate iterator has a return method, give it a + // chance to clean up. + var returnMethod = delegate.iterator["return"]; + if (returnMethod) { + var record = tryCatch(returnMethod, delegate.iterator, arg); + if (record.type === "throw") { + // If the return method threw an exception, let that + // exception prevail over the original return or throw. + method = "throw"; + arg = record.arg; + continue; + } + } + + if (method === "return") { + // Continue with the outer return, now that the delegate + // iterator has been terminated. + continue; + } + } + + var record = tryCatch(delegate.iterator[method], delegate.iterator, arg); + + if (record.type === "throw") { + context.delegate = null; + + // Like returning generator.throw(uncaught), but without the + // overhead of an extra function call. + method = "throw"; + arg = record.arg; + continue; + } + + // Delegate generator ran and handled its own exceptions so + // regardless of what the method was, we continue as if it is + // "next" with an undefined arg. + method = "next"; + arg = undefined; + + var info = record.arg; + if (info.done) { + context[delegate.resultName] = info.value; + context.next = delegate.nextLoc; + } else { + state = GenStateSuspendedYield; + return info; + } + + context.delegate = null; + } + + if (method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = arg; + } else if (method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw arg; + } + + if (context.dispatchException(arg)) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + method = "next"; + arg = undefined; + } + } else if (method === "return") { + context.abrupt("return", arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done ? GenStateCompleted : GenStateSuspendedYield; + + var info = { + value: record.arg, + done: context.done + }; + + if (record.arg === ContinueSentinel) { + if (context.delegate && method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + arg = undefined; + } + } else { + return info; + } + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(arg) call above. + method = "throw"; + arg = record.arg; + } + } + }; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[iteratorSymbol] = function () { + return this; + }; + + Gp[toStringTagSymbol] = "Generator"; + + Gp.toString = function () { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function (object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function reset(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function stop() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function dispatchException(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + return !!caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function abrupt(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.next = finallyEntry.finallyLoc; + } else { + this.complete(record); + } + + return ContinueSentinel; + }, + + complete: function complete(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = record.arg; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + }, + + finish: function finish(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function _catch(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function delegateYield(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + return ContinueSentinel; + } + }; +}( +// Among the various tricks for obtaining a reference to the global +// object, this seems to be the most reliable technique that does not +// use indirect eval (which violates Content Security Policy). +(typeof global === "undefined" ? "undefined" : (0, _typeof3.default)(global)) === "object" ? global : (typeof window === "undefined" ? "undefined" : (0, _typeof3.default)(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : (0, _typeof3.default)(self)) === "object" ? self : undefined); + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":345,"babel-runtime/core-js/object/create":22,"babel-runtime/core-js/object/set-prototype-of":32,"babel-runtime/core-js/promise":33,"babel-runtime/core-js/symbol":36,"babel-runtime/helpers/typeof":39}],364:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var _fromCodePoint = require('babel-runtime/core-js/string/from-code-point'); + +var _fromCodePoint2 = _interopRequireDefault(_fromCodePoint); + +var _stringify = require('babel-runtime/core-js/json/stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _defineProperty = require('babel-runtime/core-js/object/define-property'); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +var _keys = require('babel-runtime/core-js/object/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _create = require('babel-runtime/core-js/object/create'); + +var _create2 = _interopRequireDefault(_create); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +;(function (sax) { + // wrapper for non-node envs + sax.parser = function (strict, opt) { + return new SAXParser(strict, opt); + }; + sax.SAXParser = SAXParser; + sax.SAXStream = SAXStream; + sax.createStream = createStream; + + // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. + // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), + // since that's the earliest that a buffer overrun could occur. This way, checks are + // as rare as required, but as often as necessary to ensure never crossing this bound. + // Furthermore, buffers are only tested at most once per write(), so passing a very + // large string into write() might have undesirable effects, but this is manageable by + // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme + // edge case, result in creating at most one complete copy of the string passed in. + // Set to Infinity to have unlimited buffers. + sax.MAX_BUFFER_LENGTH = 64 * 1024; + + var buffers = ['comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', 'procInstName', 'procInstBody', 'entity', 'attribName', 'attribValue', 'cdata', 'script']; + + sax.EVENTS = ['text', 'processinginstruction', 'sgmldeclaration', 'doctype', 'comment', 'opentagstart', 'attribute', 'opentag', 'closetag', 'opencdata', 'cdata', 'closecdata', 'error', 'end', 'ready', 'script', 'opennamespace', 'closenamespace']; + + function SAXParser(strict, opt) { + if (!(this instanceof SAXParser)) { + return new SAXParser(strict, opt); + } + + var parser = this; + clearBuffers(parser); + parser.q = parser.c = ''; + parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH; + parser.opt = opt || {}; + parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags; + parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'; + parser.tags = []; + parser.closed = parser.closedRoot = parser.sawRoot = false; + parser.tag = parser.error = null; + parser.strict = !!strict; + parser.noscript = !!(strict || parser.opt.noscript); + parser.state = S.BEGIN; + parser.strictEntities = parser.opt.strictEntities; + parser.ENTITIES = parser.strictEntities ? (0, _create2.default)(sax.XML_ENTITIES) : (0, _create2.default)(sax.ENTITIES); + parser.attribList = []; + + // namespaces form a prototype chain. + // it always points at the current tag, + // which protos to its parent tag. + if (parser.opt.xmlns) { + parser.ns = (0, _create2.default)(rootNS); + } + + // mostly just for error reporting + parser.trackPosition = parser.opt.position !== false; + if (parser.trackPosition) { + parser.position = parser.line = parser.column = 0; + } + emit(parser, 'onready'); + } + + if (!_create2.default) { + Object.create = function (o) { + function F() {} + F.prototype = o; + var newf = new F(); + return newf; + }; + } + + if (!_keys2.default) { + Object.keys = function (o) { + var a = []; + for (var i in o) { + if (o.hasOwnProperty(i)) a.push(i); + }return a; + }; + } + + function checkBufferLength(parser) { + var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10); + var maxActual = 0; + for (var i = 0, l = buffers.length; i < l; i++) { + var len = parser[buffers[i]].length; + if (len > maxAllowed) { + // Text/cdata nodes can get big, and since they're buffered, + // we can get here under normal conditions. + // Avoid issues by emitting the text node now, + // so at least it won't get any bigger. + switch (buffers[i]) { + case 'textNode': + closeText(parser); + break; + + case 'cdata': + emitNode(parser, 'oncdata', parser.cdata); + parser.cdata = ''; + break; + + case 'script': + emitNode(parser, 'onscript', parser.script); + parser.script = ''; + break; + + default: + error(parser, 'Max buffer length exceeded: ' + buffers[i]); + } + } + maxActual = Math.max(maxActual, len); + } + // schedule the next check for the earliest possible buffer overrun. + var m = sax.MAX_BUFFER_LENGTH - maxActual; + parser.bufferCheckPosition = m + parser.position; + } + + function clearBuffers(parser) { + for (var i = 0, l = buffers.length; i < l; i++) { + parser[buffers[i]] = ''; + } + } + + function flushBuffers(parser) { + closeText(parser); + if (parser.cdata !== '') { + emitNode(parser, 'oncdata', parser.cdata); + parser.cdata = ''; + } + if (parser.script !== '') { + emitNode(parser, 'onscript', parser.script); + parser.script = ''; + } + } + + SAXParser.prototype = { + end: function end() { + _end(this); + }, + write: write, + resume: function resume() { + this.error = null;return this; + }, + close: function close() { + return this.write(null); + }, + flush: function flush() { + flushBuffers(this); + } + }; + + var Stream; + try { + Stream = require('stream').Stream; + } catch (ex) { + Stream = function Stream() {}; + } + + var streamWraps = sax.EVENTS.filter(function (ev) { + return ev !== 'error' && ev !== 'end'; + }); + + function createStream(strict, opt) { + return new SAXStream(strict, opt); + } + + function SAXStream(strict, opt) { + if (!(this instanceof SAXStream)) { + return new SAXStream(strict, opt); + } + + Stream.apply(this); + + this._parser = new SAXParser(strict, opt); + this.writable = true; + this.readable = true; + + var me = this; + + this._parser.onend = function () { + me.emit('end'); + }; + + this._parser.onerror = function (er) { + me.emit('error', er); + + // if didn't throw, then means error was handled. + // go ahead and clear error, so we can write again. + me._parser.error = null; + }; + + this._decoder = null; + + streamWraps.forEach(function (ev) { + (0, _defineProperty2.default)(me, 'on' + ev, { + get: function get() { + return me._parser['on' + ev]; + }, + set: function set(h) { + if (!h) { + me.removeAllListeners(ev); + me._parser['on' + ev] = h; + return h; + } + me.on(ev, h); + }, + enumerable: true, + configurable: false + }); + }); + } + + SAXStream.prototype = (0, _create2.default)(Stream.prototype, { + constructor: { + value: SAXStream + } + }); + + SAXStream.prototype.write = function (data) { + if (typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(data)) { + if (!this._decoder) { + var SD = require('string_decoder').StringDecoder; + this._decoder = new SD('utf8'); + } + data = this._decoder.write(data); + } + + this._parser.write(data.toString()); + this.emit('data', data); + return true; + }; + + SAXStream.prototype.end = function (chunk) { + if (chunk && chunk.length) { + this.write(chunk); + } + this._parser.end(); + return true; + }; + + SAXStream.prototype.on = function (ev, handler) { + var me = this; + if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) { + me._parser['on' + ev] = function () { + var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments); + args.splice(0, 0, ev); + me.emit.apply(me, args); + }; + } + + return Stream.prototype.on.call(me, ev, handler); + }; + + // character classes and tokens + var whitespace = '\r\n\t '; + + // this really needs to be replaced with character classes. + // XML allows all manner of ridiculous numbers and digits. + var number = '0124356789'; + var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + // (Letter | "_" | ":") + var quote = '\'"'; + var attribEnd = whitespace + '>'; + var CDATA = '[CDATA['; + var DOCTYPE = 'DOCTYPE'; + var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'; + var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'; + var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }; + + // turn all the string character sets into character class objects. + whitespace = charClass(whitespace); + number = charClass(number); + letter = charClass(letter); + + // http://www.w3.org/TR/REC-xml/#NT-NameStartChar + // This implementation works on strings, a single character at a time + // as such, it cannot ever support astral-plane characters (10000-EFFFF) + // without a significant breaking change to either this parser, or the + // JavaScript language. Implementation of an emoji-capable xml parser + // is left as an exercise for the reader. + var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + + var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/; + + var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/; + + quote = charClass(quote); + attribEnd = charClass(attribEnd); + + function charClass(str) { + return str.split('').reduce(function (s, c) { + s[c] = true; + return s; + }, {}); + } + + function isRegExp(c) { + return Object.prototype.toString.call(c) === '[object RegExp]'; + } + + function is(charclass, c) { + return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]; + } + + function not(charclass, c) { + return !is(charclass, c); + } + + var S = 0; + sax.STATE = { + BEGIN: S++, // leading byte order mark or whitespace + BEGIN_WHITESPACE: S++, // leading whitespace + TEXT: S++, // general stuff + TEXT_ENTITY: S++, // & and such. + OPEN_WAKA: S++, // < + SGML_DECL: S++, // + SCRIPT: S++, //