StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12461 lines
419 KiB
12461 lines
419 KiB
(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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _window = require('../global/window');
|
|
|
|
var _window2 = _interopRequireDefault(_window);
|
|
|
|
var _fileReader = require('../global/fileReader');
|
|
|
|
var _fileReader2 = _interopRequireDefault(_fileReader);
|
|
|
|
var _fileWriterSync = require('./fileWriterSync');
|
|
|
|
var _fileWriterSync2 = _interopRequireDefault(_fileWriterSync);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var FileSystemSync = function () {
|
|
function FileSystemSync() {
|
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _window2.default.TEMPORARY;
|
|
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.pow(1024, 3);
|
|
|
|
_classCallCheck(this, FileSystemSync);
|
|
|
|
this.type = type;
|
|
this.size = size;
|
|
}
|
|
|
|
_createClass(FileSystemSync, [{
|
|
key: 'getFileEntry',
|
|
value: function () {
|
|
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(path, config) {
|
|
var root;
|
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return this.root;
|
|
|
|
case 2:
|
|
root = _context.sent;
|
|
return _context.abrupt('return', new Promise(function (resolve, reject) {
|
|
return root.getFile(path, config, resolve, reject);
|
|
}));
|
|
|
|
case 4:
|
|
case 'end':
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee, this);
|
|
}));
|
|
|
|
function getFileEntry(_x3, _x4) {
|
|
return _ref.apply(this, arguments);
|
|
}
|
|
|
|
return getFileEntry;
|
|
}()
|
|
}, {
|
|
key: 'getDirectoryEntry',
|
|
value: function () {
|
|
var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(path) {
|
|
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
create = _ref3.create,
|
|
_ref3$exclusive = _ref3.exclusive,
|
|
exclusive = _ref3$exclusive === undefined ? true : _ref3$exclusive;
|
|
|
|
var root;
|
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
while (1) {
|
|
switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return this.root;
|
|
|
|
case 2:
|
|
root = _context2.sent;
|
|
return _context2.abrupt('return', new Promise(function (resolve, reject) {
|
|
return root.getDirectory(path, { create: create, exclusive: exclusive }, resolve, reject);
|
|
}));
|
|
|
|
case 4:
|
|
case 'end':
|
|
return _context2.stop();
|
|
}
|
|
}
|
|
}, _callee2, this);
|
|
}));
|
|
|
|
function getDirectoryEntry(_x5) {
|
|
return _ref2.apply(this, arguments);
|
|
}
|
|
|
|
return getDirectoryEntry;
|
|
}()
|
|
}, {
|
|
key: 'getFileReader',
|
|
value: function () {
|
|
var _ref4 = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(path) {
|
|
var entry;
|
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
while (1) {
|
|
switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
_context3.next = 2;
|
|
return this.getFileEntry(path, { create: false });
|
|
|
|
case 2:
|
|
entry = _context3.sent;
|
|
return _context3.abrupt('return', new Promise(function (resolve, reject) {
|
|
entry.file(function (file) {
|
|
var reader = new _fileReader2.default();
|
|
reader.onloadend = function () {
|
|
return resolve(reader);
|
|
};
|
|
reader.readAsText(file);
|
|
}, reject);
|
|
}));
|
|
|
|
case 4:
|
|
case 'end':
|
|
return _context3.stop();
|
|
}
|
|
}
|
|
}, _callee3, this);
|
|
}));
|
|
|
|
function getFileReader(_x7) {
|
|
return _ref4.apply(this, arguments);
|
|
}
|
|
|
|
return getFileReader;
|
|
}()
|
|
}, {
|
|
key: 'getFileWriter',
|
|
value: function () {
|
|
var _ref5 = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(path) {
|
|
var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
_ref6$create = _ref6.create,
|
|
create = _ref6$create === undefined ? true : _ref6$create,
|
|
_ref6$exclusive = _ref6.exclusive,
|
|
exclusive = _ref6$exclusive === undefined ? false : _ref6$exclusive;
|
|
|
|
var entry;
|
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
while (1) {
|
|
switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
_context4.next = 2;
|
|
return this.getFileEntry(path, { create: create, exclusive: exclusive });
|
|
|
|
case 2:
|
|
entry = _context4.sent;
|
|
return _context4.abrupt('return', new Promise(function (resolve, reject) {
|
|
return entry.createWriter(function (writer) {
|
|
return resolve(new _fileWriterSync2.default(writer, path));
|
|
}, reject);
|
|
}));
|
|
|
|
case 4:
|
|
case 'end':
|
|
return _context4.stop();
|
|
}
|
|
}
|
|
}, _callee4, this);
|
|
}));
|
|
|
|
function getFileWriter(_x8) {
|
|
return _ref5.apply(this, arguments);
|
|
}
|
|
|
|
return getFileWriter;
|
|
}()
|
|
}, {
|
|
key: 'root',
|
|
get: function get() {
|
|
var _this = this;
|
|
|
|
if (this._root) return this._root;
|
|
|
|
var request = _window2.default.requestFileSystem || _window2.default.webkitRequestFileSystem;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
return request(_this.type, _this.size, function (fs) {
|
|
return resolve(_this._root = Promise.resolve(fs.root));
|
|
}, reject);
|
|
});
|
|
}
|
|
}]);
|
|
|
|
return FileSystemSync;
|
|
}();
|
|
|
|
exports.default = FileSystemSync;
|
|
|
|
},{"../global/fileReader":328,"../global/window":329,"./fileWriterSync":2}],2:[function(require,module,exports){
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var fileWriterSync = function () {
|
|
function fileWriterSync(writer, path) {
|
|
_classCallCheck(this, fileWriterSync);
|
|
|
|
this.writer = writer;
|
|
this.path = path;
|
|
this._stack = Promise.resolve();
|
|
}
|
|
|
|
_createClass(fileWriterSync, [{
|
|
key: "write",
|
|
value: function write(content) {
|
|
return this._execute(this.writer.write, content);
|
|
}
|
|
}, {
|
|
key: "seek",
|
|
value: function () {
|
|
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(position) {
|
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return this.stack;
|
|
|
|
case 2:
|
|
this.writer.seek(position);
|
|
|
|
case 3:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee, this);
|
|
}));
|
|
|
|
function seek(_x) {
|
|
return _ref.apply(this, arguments);
|
|
}
|
|
|
|
return seek;
|
|
}()
|
|
}, {
|
|
key: "truncate",
|
|
value: function truncate(length) {
|
|
return this._execute(this.writer.truncate, length);
|
|
}
|
|
}, {
|
|
key: "_execute",
|
|
value: function _execute(action, data) {
|
|
var _this = this;
|
|
|
|
this.stack = this.stack.then(function () {
|
|
return new Promise(function (resolve, reject) {
|
|
_this.writer.onwriteend = resolve;
|
|
_this.writer.onerror = function (error) {
|
|
return reject({ path: _this.path, error: error });
|
|
};
|
|
action.call(_this.writer, data);
|
|
});
|
|
});
|
|
|
|
return this.stack;
|
|
}
|
|
}, {
|
|
key: "stack",
|
|
get: function get() {
|
|
return this._stack;
|
|
},
|
|
set: function set(promise) {
|
|
this._stack = promise;
|
|
}
|
|
}]);
|
|
|
|
return fileWriterSync;
|
|
}();
|
|
|
|
exports.default = fileWriterSync;
|
|
|
|
},{}],3:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
require('babel-polyfill');
|
|
|
|
var _fileSystemSync = require('./fileSystemSync');
|
|
|
|
var _fileSystemSync2 = _interopRequireDefault(_fileSystemSync);
|
|
|
|
var _writeStreamEs = require('./writeStreamEs6');
|
|
|
|
var _writeStreamEs2 = _interopRequireDefault(_writeStreamEs);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var FsEs6 = function () {
|
|
function FsEs6(type, size) {
|
|
_classCallCheck(this, FsEs6);
|
|
|
|
this.fs = new _fileSystemSync2.default(type, size);
|
|
}
|
|
|
|
_createClass(FsEs6, [{
|
|
key: 'writeFile',
|
|
value: function writeFile(file, data, callback) {
|
|
var _this = this;
|
|
|
|
this.fs.getFileWriter(file).then(function (writer) {
|
|
_this._write(writer, data);
|
|
callback();
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'writeFileSync',
|
|
value: function writeFileSync(file, data) {
|
|
var _this2 = this;
|
|
|
|
return this.fs.getFileWriter(file).then(function (writer) {
|
|
return _this2._write(writer, data);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'appendFile',
|
|
value: function appendFile(file, data, callback) {
|
|
var _this3 = this;
|
|
|
|
this.fs.getFileWriter(file, { create: false }).then(function (writer) {
|
|
writer.seek(writer.length);
|
|
_this3._write(writer, data);
|
|
callback();
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'appendFileSync',
|
|
value: function appendFileSync(file, data) {
|
|
var _this4 = this;
|
|
|
|
return this.fs.getFileWriter(file, { create: false }).then(function (writer) {
|
|
writer.seek(writer.length);
|
|
_this4._write(writer, data);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'readFile',
|
|
value: function readFile(file, callback) {
|
|
this.fs.getFileReader(file).then(function (reader) {
|
|
return callback(null, reader.result);
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'readFileSync',
|
|
value: function readFileSync(file) {
|
|
return this.fs.getFileReader(file).then(function (reader) {
|
|
return reader.result;
|
|
});
|
|
}
|
|
}, {
|
|
key: 'unlink',
|
|
value: function unlink(path, callback) {
|
|
this.fs.getFileEntry(path).then(function (file) {
|
|
return file.remove(callback, callback);
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'unlinkSync',
|
|
value: function unlinkSync(path) {
|
|
var _this5 = this;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
_this5.fs.getFileEntry(path).then(function (file) {
|
|
return file.remove(resolve, reject);
|
|
}).catch(reject);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'readdir',
|
|
value: function readdir(path, callback) {
|
|
var _this6 = this;
|
|
|
|
this.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return _this6._getFiles(directory.createReader());
|
|
}).then(function (files) {
|
|
return callback(null, files);
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'readdirSync',
|
|
value: function readdirSync(path) {
|
|
var _this7 = this;
|
|
|
|
return this.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return _this7._getFiles(directory.createReader());
|
|
});
|
|
}
|
|
}, {
|
|
key: 'mkdir',
|
|
value: function mkdir(path, callback) {
|
|
this.fs.getDirectoryEntry(path, { create: true }).then(function () {
|
|
return callback();
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'mkdirSync',
|
|
value: function mkdirSync(path) {
|
|
return this.fs.getDirectoryEntry(path, { create: true });
|
|
}
|
|
}, {
|
|
key: 'rmdir',
|
|
value: function rmdir(path, callback) {
|
|
this.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return directory.removeRecursively(callback, callback);
|
|
}).catch(callback);
|
|
}
|
|
}, {
|
|
key: 'rmdirSync',
|
|
value: function rmdirSync(path) {
|
|
var _this8 = this;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
return _this8.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return directory.removeRecursively(resolve, reject);
|
|
}).catch(reject);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'exists',
|
|
value: function exists(path, callback) {
|
|
var _this9 = this;
|
|
|
|
this.fs.getFileEntry(path).then(function () {
|
|
return callback(true);
|
|
}).catch(function () {
|
|
return _this9.fs.getDirectoryEntry(path).then(function () {
|
|
return callback(true);
|
|
}).catch(function () {
|
|
return callback(false);
|
|
});
|
|
});
|
|
}
|
|
}, {
|
|
key: 'existsSync',
|
|
value: function existsSync(path) {
|
|
var _this10 = this;
|
|
|
|
return this.fs.getFileEntry(path).then(function () {
|
|
return true;
|
|
}).catch(function () {
|
|
return _this10.fs.getDirectoryEntry(path).then(function () {
|
|
return true;
|
|
}).catch(function () {
|
|
return false;
|
|
});
|
|
});
|
|
}
|
|
}, {
|
|
key: 'access',
|
|
value: function access(path, callback) {
|
|
var _this11 = this;
|
|
|
|
this.fs.getFileEntry(path).then(function () {
|
|
return callback();
|
|
}).catch(function () {
|
|
return _this11.fs.getDirectoryEntry(path).then(function () {
|
|
return callback();
|
|
}).catch(callback);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'accessSync',
|
|
value: function accessSync(path) {
|
|
var _this12 = this;
|
|
|
|
return this.fs.getFileEntry(path).then(function () {
|
|
return null;
|
|
}).catch(function () {
|
|
return _this12.fs.getDirectoryEntry(path).then(function () {
|
|
return null;
|
|
});
|
|
});
|
|
}
|
|
}, {
|
|
key: 'stat',
|
|
value: function stat(path, callback) {
|
|
var _this13 = this;
|
|
|
|
this.fs.getFileEntry(path).then(function (file) {
|
|
return file.getMetadata(callback.bind(_this13, null), callback);
|
|
}).catch(function () {
|
|
return _this13.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return directory.getMetadata(callback.bind(_this13, null), callback);
|
|
}).catch(callback);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'statSync',
|
|
value: function statSync(path) {
|
|
var _this14 = this;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
_this14.fs.getFileEntry(path).then(function (file) {
|
|
return file.getMetadata(resolve, reject);
|
|
}).catch(function () {
|
|
return _this14.fs.getDirectoryEntry(path).then(function (directory) {
|
|
return directory.getMetadata(resolve, reject);
|
|
}).catch(reject);
|
|
});
|
|
});
|
|
}
|
|
|
|
// Verify if this method works as the same counterpart in node.js
|
|
|
|
}, {
|
|
key: 'createWriteStream',
|
|
value: function createWriteStream(path, options) {
|
|
var promise = this.fs.getFileWriter(path);
|
|
promise.then(function (file) {
|
|
return file.truncate();
|
|
}).catch(function (error) {
|
|
return Promise.reject({ path: path, error: error });
|
|
});
|
|
|
|
return new _writeStreamEs2.default(promise, options);
|
|
}
|
|
}, {
|
|
key: '_write',
|
|
value: function _write(file, data) {
|
|
if (!data) return;
|
|
|
|
if (typeof data === 'string') return file.write(new Blob([data], { type: 'text/plain' }));
|
|
|
|
file.write(data);
|
|
}
|
|
}, {
|
|
key: '_getFiles',
|
|
value: function _getFiles(directory) {
|
|
var files = [];
|
|
var getFiles = function getFiles(resolve, reject) {
|
|
directory.readEntries(function (results) {
|
|
if (!results.length) {
|
|
resolve(files.sort());
|
|
} else {
|
|
files = Array.prototype.slice.call(results, 0).concat(files);
|
|
getFiles(resolve, reject);
|
|
}
|
|
}, reject);
|
|
};
|
|
|
|
return new Promise(getFiles);
|
|
}
|
|
}], [{
|
|
key: 'create',
|
|
value: function create(type, size) {
|
|
return new FsEs6(type, size);
|
|
}
|
|
}]);
|
|
|
|
return FsEs6;
|
|
}();
|
|
|
|
module.exports = new FsEs6();
|
|
|
|
},{"./fileSystemSync":1,"./writeStreamEs6":327,"babel-polyfill":4}],4:[function(require,module,exports){
|
|
(function (global){
|
|
"use strict";
|
|
|
|
require("core-js/shim");
|
|
|
|
require("regenerator-runtime/runtime");
|
|
|
|
require("core-js/fn/regexp/escape");
|
|
|
|
if (global._babelPolyfill) {
|
|
throw new Error("only one instance of babel-polyfill is allowed");
|
|
}
|
|
global._babelPolyfill = true;
|
|
|
|
var DEFINE_PROPERTY = "defineProperty";
|
|
function define(O, key, value) {
|
|
O[key] || Object[DEFINE_PROPERTY](O, key, {
|
|
writable: true,
|
|
configurable: true,
|
|
value: value
|
|
});
|
|
}
|
|
|
|
define(String.prototype, "padLeft", "".padStart);
|
|
define(String.prototype, "padRight", "".padEnd);
|
|
|
|
"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
|
|
[][key] && define(Array, key, Function.call.bind([][key]));
|
|
});
|
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
},{"core-js/fn/regexp/escape":8,"core-js/shim":301,"regenerator-runtime/runtime":322}],5:[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('')
|
|
}
|
|
|
|
},{}],6:[function(require,module,exports){
|
|
|
|
},{}],7:[function(require,module,exports){
|
|
/*!
|
|
* The buffer module from node.js, for the browser.
|
|
*
|
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
* @license MIT
|
|
*/
|
|
/* eslint-disable no-proto */
|
|
|
|
'use strict'
|
|
|
|
var base64 = require('base64-js')
|
|
var ieee754 = require('ieee754')
|
|
|
|
exports.Buffer = Buffer
|
|
exports.SlowBuffer = SlowBuffer
|
|
exports.INSPECT_MAX_BYTES = 50
|
|
|
|
var K_MAX_LENGTH = 0x7fffffff
|
|
exports.kMaxLength = K_MAX_LENGTH
|
|
|
|
/**
|
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
* === true Use Uint8Array implementation (fastest)
|
|
* === false Print warning and recommend using `buffer` v4.x which has an 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+.
|
|
*
|
|
* We report that the browser does not support typed arrays if the are not subclassable
|
|
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
|
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
* for __proto__ and has a buggy typed array implementation.
|
|
*/
|
|
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
|
|
|
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
|
typeof console.error === 'function') {
|
|
console.error(
|
|
'This browser lacks typed array (Uint8Array) support which is required by ' +
|
|
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
|
)
|
|
}
|
|
|
|
function typedArraySupport () {
|
|
// Can typed array instances can be augmented?
|
|
try {
|
|
var arr = new Uint8Array(1)
|
|
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
|
return arr.foo() === 42
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
function createBuffer (length) {
|
|
if (length > K_MAX_LENGTH) {
|
|
throw new RangeError('Invalid typed array length')
|
|
}
|
|
// Return an augmented `Uint8Array` instance
|
|
var buf = new Uint8Array(length)
|
|
buf.__proto__ = Buffer.prototype
|
|
return buf
|
|
}
|
|
|
|
/**
|
|
* 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) {
|
|
// 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(arg)
|
|
}
|
|
return from(arg, encodingOrOffset, length)
|
|
}
|
|
|
|
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
|
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
Buffer[Symbol.species] === Buffer) {
|
|
Object.defineProperty(Buffer, Symbol.species, {
|
|
value: null,
|
|
configurable: true,
|
|
enumerable: false,
|
|
writable: false
|
|
})
|
|
}
|
|
|
|
Buffer.poolSize = 8192 // not used by this implementation
|
|
|
|
function from (value, encodingOrOffset, length) {
|
|
if (typeof value === 'number') {
|
|
throw new TypeError('"value" argument must not be a number')
|
|
}
|
|
|
|
if (value instanceof ArrayBuffer) {
|
|
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
}
|
|
|
|
if (typeof value === 'string') {
|
|
return fromString(value, encodingOrOffset)
|
|
}
|
|
|
|
return fromObject(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(value, encodingOrOffset, length)
|
|
}
|
|
|
|
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
|
// https://github.com/feross/buffer/pull/148
|
|
Buffer.prototype.__proto__ = Uint8Array.prototype
|
|
Buffer.__proto__ = Uint8Array
|
|
|
|
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 (size, fill, encoding) {
|
|
assertSize(size)
|
|
if (size <= 0) {
|
|
return createBuffer(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(size).fill(fill, encoding)
|
|
: createBuffer(size).fill(fill)
|
|
}
|
|
return createBuffer(size)
|
|
}
|
|
|
|
/**
|
|
* Creates a new filled Buffer instance.
|
|
* alloc(size[, fill[, encoding]])
|
|
**/
|
|
Buffer.alloc = function (size, fill, encoding) {
|
|
return alloc(size, fill, encoding)
|
|
}
|
|
|
|
function allocUnsafe (size) {
|
|
assertSize(size)
|
|
return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
|
}
|
|
|
|
/**
|
|
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
* */
|
|
Buffer.allocUnsafe = function (size) {
|
|
return allocUnsafe(size)
|
|
}
|
|
/**
|
|
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
*/
|
|
Buffer.allocUnsafeSlow = function (size) {
|
|
return allocUnsafe(size)
|
|
}
|
|
|
|
function fromString (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
|
|
var buf = createBuffer(length)
|
|
|
|
var actual = buf.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')
|
|
buf = buf.slice(0, actual)
|
|
}
|
|
|
|
return buf
|
|
}
|
|
|
|
function fromArrayLike (array) {
|
|
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
var buf = createBuffer(length)
|
|
for (var i = 0; i < length; i += 1) {
|
|
buf[i] = array[i] & 255
|
|
}
|
|
return buf
|
|
}
|
|
|
|
function fromArrayBuffer (array, byteOffset, length) {
|
|
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')
|
|
}
|
|
|
|
var buf
|
|
if (byteOffset === undefined && length === undefined) {
|
|
buf = new Uint8Array(array)
|
|
} else if (length === undefined) {
|
|
buf = new Uint8Array(array, byteOffset)
|
|
} else {
|
|
buf = new Uint8Array(array, byteOffset, length)
|
|
}
|
|
|
|
// Return an augmented `Uint8Array` instance
|
|
buf.__proto__ = Buffer.prototype
|
|
return buf
|
|
}
|
|
|
|
function fromObject (obj) {
|
|
if (Buffer.isBuffer(obj)) {
|
|
var len = checked(obj.length) | 0
|
|
var buf = createBuffer(len)
|
|
|
|
if (buf.length === 0) {
|
|
return buf
|
|
}
|
|
|
|
obj.copy(buf, 0, 0, len)
|
|
return buf
|
|
}
|
|
|
|
if (obj) {
|
|
if (isArrayBufferView(obj) || 'length' in obj) {
|
|
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
|
return createBuffer(0)
|
|
}
|
|
return fromArrayLike(obj)
|
|
}
|
|
|
|
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
|
return fromArrayLike(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 < K_MAX_LENGTH` here because that fails when
|
|
// length is NaN (which is otherwise coerced to zero.)
|
|
if (length >= K_MAX_LENGTH) {
|
|
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
'size: 0x' + K_MAX_LENGTH.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 === true
|
|
}
|
|
|
|
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 (!Array.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 (isArrayBufferView(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
|
|
}
|
|
}
|
|
}
|
|
|
|
// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
|
|
// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
|
|
// reliably in a browserify context because there could be multiple different
|
|
// copies of the 'buffer' package in use. This method works even for Buffer
|
|
// instances that were created from another copy of the `buffer` package.
|
|
// See: https://github.com/feross/buffer/issues/154
|
|
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
|
|
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 ' + str + '>'
|
|
}
|
|
|
|
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 (numberIsNaN(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 (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 (numberIsNaN(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
|
|
}
|
|
} 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 = this.subarray(start, end)
|
|
// Return an augmented `Uint8Array` instance
|
|
newBuf.__proto__ = Buffer.prototype
|
|
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) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
return this[offset]
|
|
}
|
|
|
|
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
return this[offset] | (this[offset + 1] << 8)
|
|
}
|
|
|
|
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
return (this[offset] << 8) | this[offset + 1]
|
|
}
|
|
|
|
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
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) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
return ieee754.read(this, offset, true, 23, 4)
|
|
}
|
|
|
|
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
return ieee754.read(this, offset, false, 23, 4)
|
|
}
|
|
|
|
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
return ieee754.read(this, offset, true, 52, 8)
|
|
}
|
|
|
|
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
offset = offset >>> 0
|
|
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)
|
|
this[offset] = (value & 0xff)
|
|
return offset + 1
|
|
}
|
|
|
|
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
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)
|
|
this[offset] = (value >>> 8)
|
|
this[offset + 1] = (value & 0xff)
|
|
return offset + 2
|
|
}
|
|
|
|
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset >>> 0
|
|
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
this[offset + 3] = (value >>> 24)
|
|
this[offset + 2] = (value >>> 16)
|
|
this[offset + 1] = (value >>> 8)
|
|
this[offset] = (value & 0xff)
|
|
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)
|
|
this[offset] = (value >>> 24)
|
|
this[offset + 1] = (value >>> 16)
|
|
this[offset + 2] = (value >>> 8)
|
|
this[offset + 3] = (value & 0xff)
|
|
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 (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)
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
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)
|
|
this[offset] = (value >>> 8)
|
|
this[offset + 1] = (value & 0xff)
|
|
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)
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
this[offset + 2] = (value >>> 16)
|
|
this[offset + 3] = (value >>> 24)
|
|
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
|
|
this[offset] = (value >>> 24)
|
|
this[offset + 1] = (value >>> 16)
|
|
this[offset + 2] = (value >>> 8)
|
|
this[offset + 3] = (value & 0xff)
|
|
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) {
|
|
value = +value
|
|
offset = offset >>> 0
|
|
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) {
|
|
value = +value
|
|
offset = offset >>> 0
|
|
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) {
|
|
// 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
|
|
: new Buffer(val, encoding)
|
|
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 = str.trim().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 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
|
|
}
|
|
|
|
// Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView`
|
|
function isArrayBufferView (obj) {
|
|
return (typeof ArrayBuffer.isView === 'function') && ArrayBuffer.isView(obj)
|
|
}
|
|
|
|
function numberIsNaN (obj) {
|
|
return obj !== obj // eslint-disable-line no-self-compare
|
|
}
|
|
|
|
},{"base64-js":5,"ieee754":304}],8:[function(require,module,exports){
|
|
require('../../modules/core.regexp.escape');
|
|
module.exports = require('../../modules/_core').RegExp.escape;
|
|
},{"../../modules/_core":29,"../../modules/core.regexp.escape":125}],9:[function(require,module,exports){
|
|
module.exports = function(it){
|
|
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
|
|
return it;
|
|
};
|
|
},{}],10:[function(require,module,exports){
|
|
var cof = require('./_cof');
|
|
module.exports = function(it, msg){
|
|
if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg);
|
|
return +it;
|
|
};
|
|
},{"./_cof":24}],11:[function(require,module,exports){
|
|
// 22.1.3.31 Array.prototype[@@unscopables]
|
|
var UNSCOPABLES = require('./_wks')('unscopables')
|
|
, ArrayProto = Array.prototype;
|
|
if(ArrayProto[UNSCOPABLES] == undefined)require('./_hide')(ArrayProto, UNSCOPABLES, {});
|
|
module.exports = function(key){
|
|
ArrayProto[UNSCOPABLES][key] = true;
|
|
};
|
|
},{"./_hide":46,"./_wks":123}],12:[function(require,module,exports){
|
|
module.exports = function(it, Constructor, name, forbiddenField){
|
|
if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
|
|
throw TypeError(name + ': incorrect invocation!');
|
|
} return it;
|
|
};
|
|
},{}],13:[function(require,module,exports){
|
|
var isObject = require('./_is-object');
|
|
module.exports = function(it){
|
|
if(!isObject(it))throw TypeError(it + ' is not an object!');
|
|
return it;
|
|
};
|
|
},{"./_is-object":55}],14:[function(require,module,exports){
|
|
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
|
|
'use strict';
|
|
var toObject = require('./_to-object')
|
|
, toIndex = require('./_to-index')
|
|
, toLength = require('./_to-length');
|
|
|
|
module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
|
|
var O = toObject(this)
|
|
, len = toLength(O.length)
|
|
, to = toIndex(target, len)
|
|
, from = toIndex(start, len)
|
|
, end = arguments.length > 2 ? arguments[2] : undefined
|
|
, count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
|
|
, inc = 1;
|
|
if(from < to && to < from + count){
|
|
inc = -1;
|
|
from += count - 1;
|
|
to += count - 1;
|
|
}
|
|
while(count-- > 0){
|
|
if(from in O)O[to] = O[from];
|
|
else delete O[to];
|
|
to += inc;
|
|
from += inc;
|
|
} return O;
|
|
};
|
|
},{"./_to-index":111,"./_to-length":114,"./_to-object":115}],15:[function(require,module,exports){
|
|
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
|
|
'use strict';
|
|
var toObject = require('./_to-object')
|
|
, toIndex = require('./_to-index')
|
|
, toLength = require('./_to-length');
|
|
module.exports = function fill(value /*, start = 0, end = @length */){
|
|
var O = toObject(this)
|
|
, length = toLength(O.length)
|
|
, aLen = arguments.length
|
|
, index = toIndex(aLen > 1 ? arguments[1] : undefined, length)
|
|
, end = aLen > 2 ? arguments[2] : undefined
|
|
, endPos = end === undefined ? length : toIndex(end, length);
|
|
while(endPos > index)O[index++] = value;
|
|
return O;
|
|
};
|
|
},{"./_to-index":111,"./_to-length":114,"./_to-object":115}],16:[function(require,module,exports){
|
|
var forOf = require('./_for-of');
|
|
|
|
module.exports = function(iter, ITERATOR){
|
|
var result = [];
|
|
forOf(iter, false, result.push, result, ITERATOR);
|
|
return result;
|
|
};
|
|
|
|
},{"./_for-of":43}],17:[function(require,module,exports){
|
|
// 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":111,"./_to-iobject":113,"./_to-length":114}],18:[function(require,module,exports){
|
|
// 0 -> Array#forEach
|
|
// 1 -> Array#map
|
|
// 2 -> Array#filter
|
|
// 3 -> Array#some
|
|
// 4 -> Array#every
|
|
// 5 -> Array#find
|
|
// 6 -> Array#findIndex
|
|
var ctx = require('./_ctx')
|
|
, IObject = require('./_iobject')
|
|
, toObject = require('./_to-object')
|
|
, toLength = require('./_to-length')
|
|
, asc = require('./_array-species-create');
|
|
module.exports = function(TYPE, $create){
|
|
var IS_MAP = TYPE == 1
|
|
, IS_FILTER = TYPE == 2
|
|
, IS_SOME = TYPE == 3
|
|
, IS_EVERY = TYPE == 4
|
|
, IS_FIND_INDEX = TYPE == 6
|
|
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX
|
|
, create = $create || asc;
|
|
return function($this, callbackfn, that){
|
|
var O = toObject($this)
|
|
, self = IObject(O)
|
|
, f = ctx(callbackfn, that, 3)
|
|
, length = toLength(self.length)
|
|
, index = 0
|
|
, result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
|
|
, val, res;
|
|
for(;length > index; index++)if(NO_HOLES || index in self){
|
|
val = self[index];
|
|
res = f(val, index, O);
|
|
if(TYPE){
|
|
if(IS_MAP)result[index] = res; // map
|
|
else if(res)switch(TYPE){
|
|
case 3: return true; // some
|
|
case 5: return val; // find
|
|
case 6: return index; // findIndex
|
|
case 2: result.push(val); // filter
|
|
} else if(IS_EVERY)return false; // every
|
|
}
|
|
}
|
|
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
|
|
};
|
|
};
|
|
},{"./_array-species-create":21,"./_ctx":31,"./_iobject":51,"./_to-length":114,"./_to-object":115}],19:[function(require,module,exports){
|
|
var aFunction = require('./_a-function')
|
|
, toObject = require('./_to-object')
|
|
, IObject = require('./_iobject')
|
|
, toLength = require('./_to-length');
|
|
|
|
module.exports = function(that, callbackfn, aLen, memo, isRight){
|
|
aFunction(callbackfn);
|
|
var O = toObject(that)
|
|
, self = IObject(O)
|
|
, length = toLength(O.length)
|
|
, index = isRight ? length - 1 : 0
|
|
, i = isRight ? -1 : 1;
|
|
if(aLen < 2)for(;;){
|
|
if(index in self){
|
|
memo = self[index];
|
|
index += i;
|
|
break;
|
|
}
|
|
index += i;
|
|
if(isRight ? index < 0 : length <= index){
|
|
throw TypeError('Reduce of empty array with no initial value');
|
|
}
|
|
}
|
|
for(;isRight ? index >= 0 : length > index; index += i)if(index in self){
|
|
memo = callbackfn(memo, self[index], index, O);
|
|
}
|
|
return memo;
|
|
};
|
|
},{"./_a-function":9,"./_iobject":51,"./_to-length":114,"./_to-object":115}],20:[function(require,module,exports){
|
|
var isObject = require('./_is-object')
|
|
, isArray = require('./_is-array')
|
|
, SPECIES = require('./_wks')('species');
|
|
|
|
module.exports = function(original){
|
|
var C;
|
|
if(isArray(original)){
|
|
C = original.constructor;
|
|
// cross-realm fallback
|
|
if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
|
|
if(isObject(C)){
|
|
C = C[SPECIES];
|
|
if(C === null)C = undefined;
|
|
}
|
|
} return C === undefined ? Array : C;
|
|
};
|
|
},{"./_is-array":53,"./_is-object":55,"./_wks":123}],21:[function(require,module,exports){
|
|
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
|
|
var speciesConstructor = require('./_array-species-constructor');
|
|
|
|
module.exports = function(original, length){
|
|
return new (speciesConstructor(original))(length);
|
|
};
|
|
},{"./_array-species-constructor":20}],22:[function(require,module,exports){
|
|
'use strict';
|
|
var aFunction = require('./_a-function')
|
|
, isObject = require('./_is-object')
|
|
, invoke = require('./_invoke')
|
|
, arraySlice = [].slice
|
|
, factories = {};
|
|
|
|
var construct = function(F, len, args){
|
|
if(!(len in factories)){
|
|
for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
|
|
factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
|
|
} return factories[len](F, args);
|
|
};
|
|
|
|
module.exports = Function.bind || function bind(that /*, args... */){
|
|
var fn = aFunction(this)
|
|
, partArgs = arraySlice.call(arguments, 1);
|
|
var bound = function(/* args... */){
|
|
var args = partArgs.concat(arraySlice.call(arguments));
|
|
return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
|
|
};
|
|
if(isObject(fn.prototype))bound.prototype = fn.prototype;
|
|
return bound;
|
|
};
|
|
},{"./_a-function":9,"./_invoke":50,"./_is-object":55}],23:[function(require,module,exports){
|
|
// 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(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":24,"./_wks":123}],24:[function(require,module,exports){
|
|
var toString = {}.toString;
|
|
|
|
module.exports = function(it){
|
|
return toString.call(it).slice(8, -1);
|
|
};
|
|
},{}],25:[function(require,module,exports){
|
|
'use strict';
|
|
var dP = require('./_object-dp').f
|
|
, create = require('./_object-create')
|
|
, redefineAll = require('./_redefine-all')
|
|
, ctx = require('./_ctx')
|
|
, anInstance = require('./_an-instance')
|
|
, defined = require('./_defined')
|
|
, forOf = require('./_for-of')
|
|
, $iterDefine = require('./_iter-define')
|
|
, step = require('./_iter-step')
|
|
, setSpecies = require('./_set-species')
|
|
, DESCRIPTORS = require('./_descriptors')
|
|
, fastKey = require('./_meta').fastKey
|
|
, SIZE = DESCRIPTORS ? '_s' : 'size';
|
|
|
|
var getEntry = function(that, key){
|
|
// fast case
|
|
var index = fastKey(key), entry;
|
|
if(index !== 'F')return that._i[index];
|
|
// frozen object case
|
|
for(entry = that._f; entry; entry = entry.n){
|
|
if(entry.k == key)return entry;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
|
|
var C = wrapper(function(that, iterable){
|
|
anInstance(that, C, NAME, '_i');
|
|
that._i = create(null); // index
|
|
that._f = undefined; // first entry
|
|
that._l = undefined; // last entry
|
|
that[SIZE] = 0; // size
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
});
|
|
redefineAll(C.prototype, {
|
|
// 23.1.3.1 Map.prototype.clear()
|
|
// 23.2.3.2 Set.prototype.clear()
|
|
clear: function clear(){
|
|
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
|
|
entry.r = true;
|
|
if(entry.p)entry.p = entry.p.n = undefined;
|
|
delete data[entry.i];
|
|
}
|
|
that._f = that._l = undefined;
|
|
that[SIZE] = 0;
|
|
},
|
|
// 23.1.3.3 Map.prototype.delete(key)
|
|
// 23.2.3.4 Set.prototype.delete(value)
|
|
'delete': function(key){
|
|
var that = this
|
|
, entry = getEntry(that, key);
|
|
if(entry){
|
|
var next = entry.n
|
|
, prev = entry.p;
|
|
delete that._i[entry.i];
|
|
entry.r = true;
|
|
if(prev)prev.n = next;
|
|
if(next)next.p = prev;
|
|
if(that._f == entry)that._f = next;
|
|
if(that._l == entry)that._l = prev;
|
|
that[SIZE]--;
|
|
} return !!entry;
|
|
},
|
|
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
|
|
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
|
|
forEach: function forEach(callbackfn /*, that = undefined */){
|
|
anInstance(this, C, 'forEach');
|
|
var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
|
|
, entry;
|
|
while(entry = entry ? entry.n : this._f){
|
|
f(entry.v, entry.k, this);
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
}
|
|
},
|
|
// 23.1.3.7 Map.prototype.has(key)
|
|
// 23.2.3.7 Set.prototype.has(value)
|
|
has: function has(key){
|
|
return !!getEntry(this, key);
|
|
}
|
|
});
|
|
if(DESCRIPTORS)dP(C.prototype, 'size', {
|
|
get: function(){
|
|
return defined(this[SIZE]);
|
|
}
|
|
});
|
|
return C;
|
|
},
|
|
def: function(that, key, value){
|
|
var entry = getEntry(that, key)
|
|
, prev, index;
|
|
// change existing entry
|
|
if(entry){
|
|
entry.v = value;
|
|
// create new entry
|
|
} else {
|
|
that._l = entry = {
|
|
i: index = fastKey(key, true), // <- index
|
|
k: key, // <- key
|
|
v: value, // <- value
|
|
p: prev = that._l, // <- previous entry
|
|
n: undefined, // <- next entry
|
|
r: false // <- removed
|
|
};
|
|
if(!that._f)that._f = entry;
|
|
if(prev)prev.n = entry;
|
|
that[SIZE]++;
|
|
// add to index
|
|
if(index !== 'F')that._i[index] = entry;
|
|
} return that;
|
|
},
|
|
getEntry: getEntry,
|
|
setStrong: function(C, NAME, IS_MAP){
|
|
// add .keys, .values, .entries, [@@iterator]
|
|
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
|
|
$iterDefine(C, NAME, function(iterated, kind){
|
|
this._t = iterated; // target
|
|
this._k = kind; // kind
|
|
this._l = undefined; // previous
|
|
}, function(){
|
|
var that = this
|
|
, kind = that._k
|
|
, entry = that._l;
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
// get next entry
|
|
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
|
|
// or finish the iteration
|
|
that._t = undefined;
|
|
return step(1);
|
|
}
|
|
// return step by kind
|
|
if(kind == 'keys' )return step(0, entry.k);
|
|
if(kind == 'values')return step(0, entry.v);
|
|
return step(0, [entry.k, entry.v]);
|
|
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
|
|
|
|
// add [@@species], 23.1.2.2, 23.2.2.2
|
|
setSpecies(NAME);
|
|
}
|
|
};
|
|
},{"./_an-instance":12,"./_ctx":31,"./_defined":33,"./_descriptors":34,"./_for-of":43,"./_iter-define":59,"./_iter-step":61,"./_meta":68,"./_object-create":72,"./_object-dp":73,"./_redefine-all":92,"./_set-species":97}],26:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var classof = require('./_classof')
|
|
, from = require('./_array-from-iterable');
|
|
module.exports = function(NAME){
|
|
return function toJSON(){
|
|
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
|
|
return from(this);
|
|
};
|
|
};
|
|
},{"./_array-from-iterable":16,"./_classof":23}],27:[function(require,module,exports){
|
|
'use strict';
|
|
var redefineAll = require('./_redefine-all')
|
|
, getWeak = require('./_meta').getWeak
|
|
, anObject = require('./_an-object')
|
|
, isObject = require('./_is-object')
|
|
, anInstance = require('./_an-instance')
|
|
, forOf = require('./_for-of')
|
|
, createArrayMethod = require('./_array-methods')
|
|
, $has = require('./_has')
|
|
, arrayFind = createArrayMethod(5)
|
|
, arrayFindIndex = createArrayMethod(6)
|
|
, id = 0;
|
|
|
|
// fallback for uncaught frozen keys
|
|
var uncaughtFrozenStore = function(that){
|
|
return that._l || (that._l = new UncaughtFrozenStore);
|
|
};
|
|
var UncaughtFrozenStore = function(){
|
|
this.a = [];
|
|
};
|
|
var findUncaughtFrozen = function(store, key){
|
|
return arrayFind(store.a, function(it){
|
|
return it[0] === key;
|
|
});
|
|
};
|
|
UncaughtFrozenStore.prototype = {
|
|
get: function(key){
|
|
var entry = findUncaughtFrozen(this, key);
|
|
if(entry)return entry[1];
|
|
},
|
|
has: function(key){
|
|
return !!findUncaughtFrozen(this, key);
|
|
},
|
|
set: function(key, value){
|
|
var entry = findUncaughtFrozen(this, key);
|
|
if(entry)entry[1] = value;
|
|
else this.a.push([key, value]);
|
|
},
|
|
'delete': function(key){
|
|
var index = arrayFindIndex(this.a, function(it){
|
|
return it[0] === key;
|
|
});
|
|
if(~index)this.a.splice(index, 1);
|
|
return !!~index;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
|
|
var C = wrapper(function(that, iterable){
|
|
anInstance(that, C, NAME, '_i');
|
|
that._i = id++; // collection id
|
|
that._l = undefined; // leak store for uncaught frozen objects
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
});
|
|
redefineAll(C.prototype, {
|
|
// 23.3.3.2 WeakMap.prototype.delete(key)
|
|
// 23.4.3.3 WeakSet.prototype.delete(value)
|
|
'delete': function(key){
|
|
if(!isObject(key))return false;
|
|
var data = getWeak(key);
|
|
if(data === true)return uncaughtFrozenStore(this)['delete'](key);
|
|
return data && $has(data, this._i) && delete data[this._i];
|
|
},
|
|
// 23.3.3.4 WeakMap.prototype.has(key)
|
|
// 23.4.3.4 WeakSet.prototype.has(value)
|
|
has: function has(key){
|
|
if(!isObject(key))return false;
|
|
var data = getWeak(key);
|
|
if(data === true)return uncaughtFrozenStore(this).has(key);
|
|
return data && $has(data, this._i);
|
|
}
|
|
});
|
|
return C;
|
|
},
|
|
def: function(that, key, value){
|
|
var data = getWeak(anObject(key), true);
|
|
if(data === true)uncaughtFrozenStore(that).set(key, value);
|
|
else data[that._i] = value;
|
|
return that;
|
|
},
|
|
ufstore: uncaughtFrozenStore
|
|
};
|
|
},{"./_an-instance":12,"./_an-object":13,"./_array-methods":18,"./_for-of":43,"./_has":45,"./_is-object":55,"./_meta":68,"./_redefine-all":92}],28:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./_global')
|
|
, $export = require('./_export')
|
|
, redefine = require('./_redefine')
|
|
, redefineAll = require('./_redefine-all')
|
|
, meta = require('./_meta')
|
|
, forOf = require('./_for-of')
|
|
, anInstance = require('./_an-instance')
|
|
, isObject = require('./_is-object')
|
|
, fails = require('./_fails')
|
|
, $iterDetect = require('./_iter-detect')
|
|
, setToStringTag = require('./_set-to-string-tag')
|
|
, inheritIfRequired = require('./_inherit-if-required');
|
|
|
|
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
|
|
var Base = global[NAME]
|
|
, C = Base
|
|
, ADDER = IS_MAP ? 'set' : 'add'
|
|
, proto = C && C.prototype
|
|
, O = {};
|
|
var fixMethod = function(KEY){
|
|
var fn = proto[KEY];
|
|
redefine(proto, KEY,
|
|
KEY == 'delete' ? function(a){
|
|
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'has' ? function has(a){
|
|
return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'get' ? function get(a){
|
|
return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
|
|
} : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
|
|
: function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
|
|
);
|
|
};
|
|
if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
|
|
new C().entries().next();
|
|
}))){
|
|
// create collection constructor
|
|
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
|
|
redefineAll(C.prototype, methods);
|
|
meta.NEED = true;
|
|
} else {
|
|
var instance = new C
|
|
// early implementations not supports chaining
|
|
, HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
|
|
// V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
|
|
, THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
|
|
// most early implementations doesn't supports iterables, most modern - not close it correctly
|
|
, ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
|
|
// for early implementations -0 and +0 not the same
|
|
, BUGGY_ZERO = !IS_WEAK && fails(function(){
|
|
// V8 ~ Chromium 42- fails only with 5+ elements
|
|
var $instance = new C()
|
|
, index = 5;
|
|
while(index--)$instance[ADDER](index, index);
|
|
return !$instance.has(-0);
|
|
});
|
|
if(!ACCEPT_ITERABLES){
|
|
C = wrapper(function(target, iterable){
|
|
anInstance(target, C, NAME);
|
|
var that = inheritIfRequired(new Base, target, C);
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
return that;
|
|
});
|
|
C.prototype = proto;
|
|
proto.constructor = C;
|
|
}
|
|
if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
|
|
fixMethod('delete');
|
|
fixMethod('has');
|
|
IS_MAP && fixMethod('get');
|
|
}
|
|
if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
|
|
// weak collections should not contains .clear method
|
|
if(IS_WEAK && proto.clear)delete proto.clear;
|
|
}
|
|
|
|
setToStringTag(C, NAME);
|
|
|
|
O[NAME] = C;
|
|
$export($export.G + $export.W + $export.F * (C != Base), O);
|
|
|
|
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
|
|
|
|
return C;
|
|
};
|
|
},{"./_an-instance":12,"./_export":38,"./_fails":40,"./_for-of":43,"./_global":44,"./_inherit-if-required":49,"./_is-object":55,"./_iter-detect":60,"./_meta":68,"./_redefine":93,"./_redefine-all":92,"./_set-to-string-tag":98}],29:[function(require,module,exports){
|
|
var core = module.exports = {version: '2.4.0'};
|
|
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
|
},{}],30:[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":73,"./_property-desc":91}],31:[function(require,module,exports){
|
|
// 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":9}],32:[function(require,module,exports){
|
|
'use strict';
|
|
var anObject = require('./_an-object')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, NUMBER = 'number';
|
|
|
|
module.exports = function(hint){
|
|
if(hint !== 'string' && hint !== NUMBER && hint !== 'default')throw TypeError('Incorrect hint');
|
|
return toPrimitive(anObject(this), hint != NUMBER);
|
|
};
|
|
},{"./_an-object":13,"./_to-primitive":116}],33:[function(require,module,exports){
|
|
// 7.2.1 RequireObjectCoercible(argument)
|
|
module.exports = function(it){
|
|
if(it == undefined)throw TypeError("Can't call method on " + it);
|
|
return it;
|
|
};
|
|
},{}],34:[function(require,module,exports){
|
|
// Thank's IE8 for his funny defineProperty
|
|
module.exports = !require('./_fails')(function(){
|
|
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
},{"./_fails":40}],35:[function(require,module,exports){
|
|
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":44,"./_is-object":55}],36:[function(require,module,exports){
|
|
// IE 8- don't enum bug keys
|
|
module.exports = (
|
|
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
|
).split(',');
|
|
},{}],37:[function(require,module,exports){
|
|
// 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":79,"./_object-keys":82,"./_object-pie":83}],38:[function(require,module,exports){
|
|
var global = require('./_global')
|
|
, core = require('./_core')
|
|
, hide = require('./_hide')
|
|
, redefine = require('./_redefine')
|
|
, ctx = require('./_ctx')
|
|
, PROTOTYPE = 'prototype';
|
|
|
|
var $export = function(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
|
|
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
|
|
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
|
|
, expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
|
|
, key, own, out, exp;
|
|
if(IS_GLOBAL)source = name;
|
|
for(key in source){
|
|
// contains in native
|
|
own = !IS_FORCED && target && target[key] !== undefined;
|
|
// export native or passed
|
|
out = (own ? target : source)[key];
|
|
// bind timers to global for call from export context
|
|
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
|
// extend global
|
|
if(target)redefine(target, key, out, type & $export.U);
|
|
// export
|
|
if(exports[key] != out)hide(exports, key, exp);
|
|
if(IS_PROTO && expProto[key] != out)expProto[key] = out;
|
|
}
|
|
};
|
|
global.core = core;
|
|
// 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":29,"./_ctx":31,"./_global":44,"./_hide":46,"./_redefine":93}],39:[function(require,module,exports){
|
|
var MATCH = require('./_wks')('match');
|
|
module.exports = function(KEY){
|
|
var re = /./;
|
|
try {
|
|
'/./'[KEY](re);
|
|
} catch(e){
|
|
try {
|
|
re[MATCH] = false;
|
|
return !'/./'[KEY](re);
|
|
} catch(f){ /* empty */ }
|
|
} return true;
|
|
};
|
|
},{"./_wks":123}],40:[function(require,module,exports){
|
|
module.exports = function(exec){
|
|
try {
|
|
return !!exec();
|
|
} catch(e){
|
|
return true;
|
|
}
|
|
};
|
|
},{}],41:[function(require,module,exports){
|
|
'use strict';
|
|
var hide = require('./_hide')
|
|
, redefine = require('./_redefine')
|
|
, fails = require('./_fails')
|
|
, defined = require('./_defined')
|
|
, wks = require('./_wks');
|
|
|
|
module.exports = function(KEY, length, exec){
|
|
var SYMBOL = wks(KEY)
|
|
, fns = exec(defined, SYMBOL, ''[KEY])
|
|
, strfn = fns[0]
|
|
, rxfn = fns[1];
|
|
if(fails(function(){
|
|
var O = {};
|
|
O[SYMBOL] = function(){ return 7; };
|
|
return ''[KEY](O) != 7;
|
|
})){
|
|
redefine(String.prototype, KEY, strfn);
|
|
hide(RegExp.prototype, SYMBOL, length == 2
|
|
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
|
|
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
|
|
? function(string, arg){ return rxfn.call(string, this, arg); }
|
|
// 21.2.5.6 RegExp.prototype[@@match](string)
|
|
// 21.2.5.9 RegExp.prototype[@@search](string)
|
|
: function(string){ return rxfn.call(string, this); }
|
|
);
|
|
}
|
|
};
|
|
},{"./_defined":33,"./_fails":40,"./_hide":46,"./_redefine":93,"./_wks":123}],42:[function(require,module,exports){
|
|
'use strict';
|
|
// 21.2.5.3 get RegExp.prototype.flags
|
|
var anObject = require('./_an-object');
|
|
module.exports = function(){
|
|
var that = anObject(this)
|
|
, result = '';
|
|
if(that.global) result += 'g';
|
|
if(that.ignoreCase) result += 'i';
|
|
if(that.multiline) result += 'm';
|
|
if(that.unicode) result += 'u';
|
|
if(that.sticky) result += 'y';
|
|
return result;
|
|
};
|
|
},{"./_an-object":13}],43:[function(require,module,exports){
|
|
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":13,"./_ctx":31,"./_is-array-iter":52,"./_iter-call":57,"./_to-length":114,"./core.get-iterator-method":124}],44:[function(require,module,exports){
|
|
// 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
|
|
},{}],45:[function(require,module,exports){
|
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
module.exports = function(it, key){
|
|
return hasOwnProperty.call(it, key);
|
|
};
|
|
},{}],46:[function(require,module,exports){
|
|
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":34,"./_object-dp":73,"./_property-desc":91}],47:[function(require,module,exports){
|
|
module.exports = require('./_global').document && document.documentElement;
|
|
},{"./_global":44}],48:[function(require,module,exports){
|
|
module.exports = !require('./_descriptors') && !require('./_fails')(function(){
|
|
return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
},{"./_descriptors":34,"./_dom-create":35,"./_fails":40}],49:[function(require,module,exports){
|
|
var isObject = require('./_is-object')
|
|
, setPrototypeOf = require('./_set-proto').set;
|
|
module.exports = function(that, target, C){
|
|
var P, S = target.constructor;
|
|
if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){
|
|
setPrototypeOf(that, P);
|
|
} return that;
|
|
};
|
|
},{"./_is-object":55,"./_set-proto":96}],50:[function(require,module,exports){
|
|
// 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);
|
|
};
|
|
},{}],51:[function(require,module,exports){
|
|
// 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":24}],52:[function(require,module,exports){
|
|
// 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":62,"./_wks":123}],53:[function(require,module,exports){
|
|
// 7.2.2 IsArray(argument)
|
|
var cof = require('./_cof');
|
|
module.exports = Array.isArray || function isArray(arg){
|
|
return cof(arg) == 'Array';
|
|
};
|
|
},{"./_cof":24}],54:[function(require,module,exports){
|
|
// 20.1.2.3 Number.isInteger(number)
|
|
var isObject = require('./_is-object')
|
|
, floor = Math.floor;
|
|
module.exports = function isInteger(it){
|
|
return !isObject(it) && isFinite(it) && floor(it) === it;
|
|
};
|
|
},{"./_is-object":55}],55:[function(require,module,exports){
|
|
module.exports = function(it){
|
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
};
|
|
},{}],56:[function(require,module,exports){
|
|
// 7.2.8 IsRegExp(argument)
|
|
var isObject = require('./_is-object')
|
|
, cof = require('./_cof')
|
|
, MATCH = require('./_wks')('match');
|
|
module.exports = function(it){
|
|
var isRegExp;
|
|
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
|
|
};
|
|
},{"./_cof":24,"./_is-object":55,"./_wks":123}],57:[function(require,module,exports){
|
|
// 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":13}],58:[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":46,"./_object-create":72,"./_property-desc":91,"./_set-to-string-tag":98,"./_wks":123}],59:[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(){ return this; };
|
|
|
|
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
|
|
$iterCreate(Constructor, NAME, next);
|
|
var getMethod = function(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":38,"./_has":45,"./_hide":46,"./_iter-create":58,"./_iterators":62,"./_library":64,"./_object-gpo":80,"./_redefine":93,"./_set-to-string-tag":98,"./_wks":123}],60:[function(require,module,exports){
|
|
var ITERATOR = require('./_wks')('iterator')
|
|
, SAFE_CLOSING = false;
|
|
|
|
try {
|
|
var riter = [7][ITERATOR]();
|
|
riter['return'] = function(){ SAFE_CLOSING = true; };
|
|
Array.from(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":123}],61:[function(require,module,exports){
|
|
module.exports = function(done, value){
|
|
return {value: value, done: !!done};
|
|
};
|
|
},{}],62:[function(require,module,exports){
|
|
module.exports = {};
|
|
},{}],63:[function(require,module,exports){
|
|
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":82,"./_to-iobject":113}],64:[function(require,module,exports){
|
|
module.exports = false;
|
|
},{}],65:[function(require,module,exports){
|
|
// 20.2.2.14 Math.expm1(x)
|
|
var $expm1 = Math.expm1;
|
|
module.exports = (!$expm1
|
|
// Old FF bug
|
|
|| $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
|
|
// Tor Browser bug
|
|
|| $expm1(-2e-17) != -2e-17
|
|
) ? function expm1(x){
|
|
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
|
|
} : $expm1;
|
|
},{}],66:[function(require,module,exports){
|
|
// 20.2.2.20 Math.log1p(x)
|
|
module.exports = Math.log1p || function log1p(x){
|
|
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
|
|
};
|
|
},{}],67:[function(require,module,exports){
|
|
// 20.2.2.28 Math.sign(x)
|
|
module.exports = Math.sign || function sign(x){
|
|
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
|
|
};
|
|
},{}],68:[function(require,module,exports){
|
|
var META = require('./_uid')('meta')
|
|
, isObject = require('./_is-object')
|
|
, has = require('./_has')
|
|
, setDesc = require('./_object-dp').f
|
|
, id = 0;
|
|
var isExtensible = Object.isExtensible || function(){
|
|
return true;
|
|
};
|
|
var FREEZE = !require('./_fails')(function(){
|
|
return isExtensible(Object.preventExtensions({}));
|
|
});
|
|
var setMeta = function(it){
|
|
setDesc(it, META, {value: {
|
|
i: 'O' + ++id, // object ID
|
|
w: {} // weak collections IDs
|
|
}});
|
|
};
|
|
var fastKey = function(it, create){
|
|
// return primitive with prefix
|
|
if(!isObject(it))return typeof 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(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(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":40,"./_has":45,"./_is-object":55,"./_object-dp":73,"./_uid":120}],69:[function(require,module,exports){
|
|
var Map = require('./es6.map')
|
|
, $export = require('./_export')
|
|
, shared = require('./_shared')('metadata')
|
|
, store = shared.store || (shared.store = new (require('./es6.weak-map')));
|
|
|
|
var getOrCreateMetadataMap = function(target, targetKey, create){
|
|
var targetMetadata = store.get(target);
|
|
if(!targetMetadata){
|
|
if(!create)return undefined;
|
|
store.set(target, targetMetadata = new Map);
|
|
}
|
|
var keyMetadata = targetMetadata.get(targetKey);
|
|
if(!keyMetadata){
|
|
if(!create)return undefined;
|
|
targetMetadata.set(targetKey, keyMetadata = new Map);
|
|
} return keyMetadata;
|
|
};
|
|
var ordinaryHasOwnMetadata = function(MetadataKey, O, P){
|
|
var metadataMap = getOrCreateMetadataMap(O, P, false);
|
|
return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
|
|
};
|
|
var ordinaryGetOwnMetadata = function(MetadataKey, O, P){
|
|
var metadataMap = getOrCreateMetadataMap(O, P, false);
|
|
return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
|
|
};
|
|
var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){
|
|
getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
|
|
};
|
|
var ordinaryOwnMetadataKeys = function(target, targetKey){
|
|
var metadataMap = getOrCreateMetadataMap(target, targetKey, false)
|
|
, keys = [];
|
|
if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); });
|
|
return keys;
|
|
};
|
|
var toMetaKey = function(it){
|
|
return it === undefined || typeof it == 'symbol' ? it : String(it);
|
|
};
|
|
var exp = function(O){
|
|
$export($export.S, 'Reflect', O);
|
|
};
|
|
|
|
module.exports = {
|
|
store: store,
|
|
map: getOrCreateMetadataMap,
|
|
has: ordinaryHasOwnMetadata,
|
|
get: ordinaryGetOwnMetadata,
|
|
set: ordinaryDefineOwnMetadata,
|
|
keys: ordinaryOwnMetadataKeys,
|
|
key: toMetaKey,
|
|
exp: exp
|
|
};
|
|
},{"./_export":38,"./_shared":100,"./es6.map":155,"./es6.weak-map":261}],70:[function(require,module,exports){
|
|
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(){
|
|
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(){
|
|
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(){
|
|
node.data = toggle = !toggle;
|
|
};
|
|
// environments with maybe non-completely correct, but existent Promise
|
|
} else if(Promise && Promise.resolve){
|
|
var promise = Promise.resolve();
|
|
notify = function(){
|
|
promise.then(flush);
|
|
};
|
|
// for other environments - macrotask based on:
|
|
// - setImmediate
|
|
// - MessageChannel
|
|
// - window.postMessag
|
|
// - onreadystatechange
|
|
// - setTimeout
|
|
} else {
|
|
notify = function(){
|
|
// 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":24,"./_global":44,"./_task":110}],71:[function(require,module,exports){
|
|
'use strict';
|
|
// 19.1.2.1 Object.assign(target, source, ...)
|
|
var getKeys = require('./_object-keys')
|
|
, gOPS = require('./_object-gops')
|
|
, pIE = require('./_object-pie')
|
|
, toObject = require('./_to-object')
|
|
, IObject = require('./_iobject')
|
|
, $assign = Object.assign;
|
|
|
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
module.exports = !$assign || require('./_fails')(function(){
|
|
var A = {}
|
|
, B = {}
|
|
, S = Symbol()
|
|
, K = 'abcdefghijklmnopqrst';
|
|
A[S] = 7;
|
|
K.split('').forEach(function(k){ B[k] = k; });
|
|
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
|
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
|
|
var T = toObject(target)
|
|
, aLen = arguments.length
|
|
, index = 1
|
|
, getSymbols = gOPS.f
|
|
, isEnum = pIE.f;
|
|
while(aLen > index){
|
|
var S = IObject(arguments[index++])
|
|
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
|
|
, length = keys.length
|
|
, j = 0
|
|
, key;
|
|
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
|
|
} return T;
|
|
} : $assign;
|
|
},{"./_fails":40,"./_iobject":51,"./_object-gops":79,"./_object-keys":82,"./_object-pie":83,"./_to-object":115}],72:[function(require,module,exports){
|
|
// 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 */ }
|
|
, PROTOTYPE = 'prototype';
|
|
|
|
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
var createDict = function(){
|
|
// 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 = Object.create || 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":13,"./_dom-create":35,"./_enum-bug-keys":36,"./_html":47,"./_object-dps":74,"./_shared-key":99}],73:[function(require,module,exports){
|
|
var anObject = require('./_an-object')
|
|
, IE8_DOM_DEFINE = require('./_ie8-dom-define')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, dP = Object.defineProperty;
|
|
|
|
exports.f = require('./_descriptors') ? Object.defineProperty : 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":13,"./_descriptors":34,"./_ie8-dom-define":48,"./_to-primitive":116}],74:[function(require,module,exports){
|
|
var dP = require('./_object-dp')
|
|
, anObject = require('./_an-object')
|
|
, getKeys = require('./_object-keys');
|
|
|
|
module.exports = require('./_descriptors') ? Object.defineProperties : 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":13,"./_descriptors":34,"./_object-dp":73,"./_object-keys":82}],75:[function(require,module,exports){
|
|
// Forced replacement prototype accessors methods
|
|
module.exports = require('./_library')|| !require('./_fails')(function(){
|
|
var K = Math.random();
|
|
// In FF throws only define methods
|
|
__defineSetter__.call(null, K, function(){ /* empty */});
|
|
delete require('./_global')[K];
|
|
});
|
|
},{"./_fails":40,"./_global":44,"./_library":64}],76:[function(require,module,exports){
|
|
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 = Object.getOwnPropertyDescriptor;
|
|
|
|
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":34,"./_has":45,"./_ie8-dom-define":48,"./_object-pie":83,"./_property-desc":91,"./_to-iobject":113,"./_to-primitive":116}],77:[function(require,module,exports){
|
|
// 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 == 'object' && window && Object.getOwnPropertyNames
|
|
? Object.getOwnPropertyNames(window) : [];
|
|
|
|
var getWindowNames = function(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":78,"./_to-iobject":113}],78:[function(require,module,exports){
|
|
// 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 = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
|
|
return $keys(O, hiddenKeys);
|
|
};
|
|
},{"./_enum-bug-keys":36,"./_object-keys-internal":81}],79:[function(require,module,exports){
|
|
exports.f = Object.getOwnPropertySymbols;
|
|
},{}],80:[function(require,module,exports){
|
|
// 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 = Object.getPrototypeOf || 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":45,"./_shared-key":99,"./_to-object":115}],81:[function(require,module,exports){
|
|
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":17,"./_has":45,"./_shared-key":99,"./_to-iobject":113}],82:[function(require,module,exports){
|
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
var $keys = require('./_object-keys-internal')
|
|
, enumBugKeys = require('./_enum-bug-keys');
|
|
|
|
module.exports = Object.keys || function keys(O){
|
|
return $keys(O, enumBugKeys);
|
|
};
|
|
},{"./_enum-bug-keys":36,"./_object-keys-internal":81}],83:[function(require,module,exports){
|
|
exports.f = {}.propertyIsEnumerable;
|
|
},{}],84:[function(require,module,exports){
|
|
// 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":29,"./_export":38,"./_fails":40}],85:[function(require,module,exports){
|
|
var getKeys = require('./_object-keys')
|
|
, toIObject = require('./_to-iobject')
|
|
, isEnum = require('./_object-pie').f;
|
|
module.exports = function(isEntries){
|
|
return function(it){
|
|
var O = toIObject(it)
|
|
, keys = getKeys(O)
|
|
, length = keys.length
|
|
, i = 0
|
|
, result = []
|
|
, key;
|
|
while(length > i)if(isEnum.call(O, key = keys[i++])){
|
|
result.push(isEntries ? [key, O[key]] : O[key]);
|
|
} return result;
|
|
};
|
|
};
|
|
},{"./_object-keys":82,"./_object-pie":83,"./_to-iobject":113}],86:[function(require,module,exports){
|
|
// all object keys, includes non-enumerable and symbols
|
|
var gOPN = require('./_object-gopn')
|
|
, gOPS = require('./_object-gops')
|
|
, anObject = require('./_an-object')
|
|
, Reflect = require('./_global').Reflect;
|
|
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
|
|
var keys = gOPN.f(anObject(it))
|
|
, getSymbols = gOPS.f;
|
|
return getSymbols ? keys.concat(getSymbols(it)) : keys;
|
|
};
|
|
},{"./_an-object":13,"./_global":44,"./_object-gopn":78,"./_object-gops":79}],87:[function(require,module,exports){
|
|
var $parseFloat = require('./_global').parseFloat
|
|
, $trim = require('./_string-trim').trim;
|
|
|
|
module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str){
|
|
var string = $trim(String(str), 3)
|
|
, result = $parseFloat(string);
|
|
return result === 0 && string.charAt(0) == '-' ? -0 : result;
|
|
} : $parseFloat;
|
|
},{"./_global":44,"./_string-trim":108,"./_string-ws":109}],88:[function(require,module,exports){
|
|
var $parseInt = require('./_global').parseInt
|
|
, $trim = require('./_string-trim').trim
|
|
, ws = require('./_string-ws')
|
|
, hex = /^[\-+]?0[xX]/;
|
|
|
|
module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){
|
|
var string = $trim(String(str), 3);
|
|
return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
|
|
} : $parseInt;
|
|
},{"./_global":44,"./_string-trim":108,"./_string-ws":109}],89:[function(require,module,exports){
|
|
'use strict';
|
|
var path = require('./_path')
|
|
, invoke = require('./_invoke')
|
|
, aFunction = require('./_a-function');
|
|
module.exports = function(/* ...pargs */){
|
|
var fn = aFunction(this)
|
|
, length = arguments.length
|
|
, pargs = Array(length)
|
|
, i = 0
|
|
, _ = path._
|
|
, holder = false;
|
|
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
|
|
return function(/* ...args */){
|
|
var that = this
|
|
, aLen = arguments.length
|
|
, j = 0, k = 0, args;
|
|
if(!holder && !aLen)return invoke(fn, pargs, that);
|
|
args = pargs.slice();
|
|
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
|
|
while(aLen > k)args.push(arguments[k++]);
|
|
return invoke(fn, args, that);
|
|
};
|
|
};
|
|
},{"./_a-function":9,"./_invoke":50,"./_path":90}],90:[function(require,module,exports){
|
|
module.exports = require('./_global');
|
|
},{"./_global":44}],91:[function(require,module,exports){
|
|
module.exports = function(bitmap, value){
|
|
return {
|
|
enumerable : !(bitmap & 1),
|
|
configurable: !(bitmap & 2),
|
|
writable : !(bitmap & 4),
|
|
value : value
|
|
};
|
|
};
|
|
},{}],92:[function(require,module,exports){
|
|
var redefine = require('./_redefine');
|
|
module.exports = function(target, src, safe){
|
|
for(var key in src)redefine(target, key, src[key], safe);
|
|
return target;
|
|
};
|
|
},{"./_redefine":93}],93:[function(require,module,exports){
|
|
var global = require('./_global')
|
|
, hide = require('./_hide')
|
|
, has = require('./_has')
|
|
, SRC = require('./_uid')('src')
|
|
, TO_STRING = 'toString'
|
|
, $toString = Function[TO_STRING]
|
|
, TPL = ('' + $toString).split(TO_STRING);
|
|
|
|
require('./_core').inspectSource = function(it){
|
|
return $toString.call(it);
|
|
};
|
|
|
|
(module.exports = function(O, key, val, safe){
|
|
var isFunction = typeof val == 'function';
|
|
if(isFunction)has(val, 'name') || hide(val, 'name', key);
|
|
if(O[key] === val)return;
|
|
if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
|
|
if(O === global){
|
|
O[key] = val;
|
|
} else {
|
|
if(!safe){
|
|
delete O[key];
|
|
hide(O, key, val);
|
|
} else {
|
|
if(O[key])O[key] = val;
|
|
else hide(O, key, val);
|
|
}
|
|
}
|
|
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
})(Function.prototype, TO_STRING, function toString(){
|
|
return typeof this == 'function' && this[SRC] || $toString.call(this);
|
|
});
|
|
},{"./_core":29,"./_global":44,"./_has":45,"./_hide":46,"./_uid":120}],94:[function(require,module,exports){
|
|
module.exports = function(regExp, replace){
|
|
var replacer = replace === Object(replace) ? function(part){
|
|
return replace[part];
|
|
} : replace;
|
|
return function(it){
|
|
return String(it).replace(regExp, replacer);
|
|
};
|
|
};
|
|
},{}],95:[function(require,module,exports){
|
|
// 7.2.9 SameValue(x, y)
|
|
module.exports = Object.is || function is(x, y){
|
|
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
|
|
};
|
|
},{}],96:[function(require,module,exports){
|
|
// 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(O, proto){
|
|
anObject(O);
|
|
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
|
|
};
|
|
module.exports = {
|
|
set: Object.setPrototypeOf || ('__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":13,"./_ctx":31,"./_is-object":55,"./_object-gopd":76}],97:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./_global')
|
|
, dP = require('./_object-dp')
|
|
, DESCRIPTORS = require('./_descriptors')
|
|
, SPECIES = require('./_wks')('species');
|
|
|
|
module.exports = function(KEY){
|
|
var C = global[KEY];
|
|
if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
|
|
configurable: true,
|
|
get: function(){ return this; }
|
|
});
|
|
};
|
|
},{"./_descriptors":34,"./_global":44,"./_object-dp":73,"./_wks":123}],98:[function(require,module,exports){
|
|
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":45,"./_object-dp":73,"./_wks":123}],99:[function(require,module,exports){
|
|
var shared = require('./_shared')('keys')
|
|
, uid = require('./_uid');
|
|
module.exports = function(key){
|
|
return shared[key] || (shared[key] = uid(key));
|
|
};
|
|
},{"./_shared":100,"./_uid":120}],100:[function(require,module,exports){
|
|
var global = require('./_global')
|
|
, SHARED = '__core-js_shared__'
|
|
, store = global[SHARED] || (global[SHARED] = {});
|
|
module.exports = function(key){
|
|
return store[key] || (store[key] = {});
|
|
};
|
|
},{"./_global":44}],101:[function(require,module,exports){
|
|
// 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":9,"./_an-object":13,"./_wks":123}],102:[function(require,module,exports){
|
|
var fails = require('./_fails');
|
|
|
|
module.exports = function(method, arg){
|
|
return !!method && fails(function(){
|
|
arg ? method.call(null, function(){}, 1) : method.call(null);
|
|
});
|
|
};
|
|
},{"./_fails":40}],103:[function(require,module,exports){
|
|
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":33,"./_to-integer":112}],104:[function(require,module,exports){
|
|
// helper for String#{startsWith, endsWith, includes}
|
|
var isRegExp = require('./_is-regexp')
|
|
, defined = require('./_defined');
|
|
|
|
module.exports = function(that, searchString, NAME){
|
|
if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
|
|
return String(defined(that));
|
|
};
|
|
},{"./_defined":33,"./_is-regexp":56}],105:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, fails = require('./_fails')
|
|
, defined = require('./_defined')
|
|
, quot = /"/g;
|
|
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
|
|
var createHTML = function(string, tag, attribute, value) {
|
|
var S = String(defined(string))
|
|
, p1 = '<' + tag;
|
|
if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"';
|
|
return p1 + '>' + S + '</' + tag + '>';
|
|
};
|
|
module.exports = function(NAME, exec){
|
|
var O = {};
|
|
O[NAME] = exec(createHTML);
|
|
$export($export.P + $export.F * fails(function(){
|
|
var test = ''[NAME]('"');
|
|
return test !== test.toLowerCase() || test.split('"').length > 3;
|
|
}), 'String', O);
|
|
};
|
|
},{"./_defined":33,"./_export":38,"./_fails":40}],106:[function(require,module,exports){
|
|
// https://github.com/tc39/proposal-string-pad-start-end
|
|
var toLength = require('./_to-length')
|
|
, repeat = require('./_string-repeat')
|
|
, defined = require('./_defined');
|
|
|
|
module.exports = function(that, maxLength, fillString, left){
|
|
var S = String(defined(that))
|
|
, stringLength = S.length
|
|
, fillStr = fillString === undefined ? ' ' : String(fillString)
|
|
, intMaxLength = toLength(maxLength);
|
|
if(intMaxLength <= stringLength || fillStr == '')return S;
|
|
var fillLen = intMaxLength - stringLength
|
|
, stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
|
|
if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
|
|
return left ? stringFiller + S : S + stringFiller;
|
|
};
|
|
|
|
},{"./_defined":33,"./_string-repeat":107,"./_to-length":114}],107:[function(require,module,exports){
|
|
'use strict';
|
|
var toInteger = require('./_to-integer')
|
|
, defined = require('./_defined');
|
|
|
|
module.exports = function repeat(count){
|
|
var str = String(defined(this))
|
|
, res = ''
|
|
, n = toInteger(count);
|
|
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
|
|
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
|
|
return res;
|
|
};
|
|
},{"./_defined":33,"./_to-integer":112}],108:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, defined = require('./_defined')
|
|
, fails = require('./_fails')
|
|
, spaces = require('./_string-ws')
|
|
, space = '[' + spaces + ']'
|
|
, non = '\u200b\u0085'
|
|
, ltrim = RegExp('^' + space + space + '*')
|
|
, rtrim = RegExp(space + space + '*$');
|
|
|
|
var exporter = function(KEY, exec, ALIAS){
|
|
var exp = {};
|
|
var FORCE = fails(function(){
|
|
return !!spaces[KEY]() || non[KEY]() != non;
|
|
});
|
|
var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
|
|
if(ALIAS)exp[ALIAS] = fn;
|
|
$export($export.P + $export.F * FORCE, 'String', exp);
|
|
};
|
|
|
|
// 1 -> String#trimLeft
|
|
// 2 -> String#trimRight
|
|
// 3 -> String#trim
|
|
var trim = exporter.trim = function(string, TYPE){
|
|
string = String(defined(string));
|
|
if(TYPE & 1)string = string.replace(ltrim, '');
|
|
if(TYPE & 2)string = string.replace(rtrim, '');
|
|
return string;
|
|
};
|
|
|
|
module.exports = exporter;
|
|
},{"./_defined":33,"./_export":38,"./_fails":40,"./_string-ws":109}],109:[function(require,module,exports){
|
|
module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
|
|
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
},{}],110:[function(require,module,exports){
|
|
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(){
|
|
var id = +this;
|
|
if(queue.hasOwnProperty(id)){
|
|
var fn = queue[id];
|
|
delete queue[id];
|
|
fn();
|
|
}
|
|
};
|
|
var listener = function(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(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(id){
|
|
global.postMessage(id + '', '*');
|
|
};
|
|
global.addEventListener('message', listener, false);
|
|
// IE8-
|
|
} else if(ONREADYSTATECHANGE in cel('script')){
|
|
defer = function(id){
|
|
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
|
|
html.removeChild(this);
|
|
run.call(id);
|
|
};
|
|
};
|
|
// Rest old browsers
|
|
} else {
|
|
defer = function(id){
|
|
setTimeout(ctx(run, id, 1), 0);
|
|
};
|
|
}
|
|
}
|
|
module.exports = {
|
|
set: setTask,
|
|
clear: clearTask
|
|
};
|
|
},{"./_cof":24,"./_ctx":31,"./_dom-create":35,"./_global":44,"./_html":47,"./_invoke":50}],111:[function(require,module,exports){
|
|
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":112}],112:[function(require,module,exports){
|
|
// 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);
|
|
};
|
|
},{}],113:[function(require,module,exports){
|
|
// 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":33,"./_iobject":51}],114:[function(require,module,exports){
|
|
// 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":112}],115:[function(require,module,exports){
|
|
// 7.1.13 ToObject(argument)
|
|
var defined = require('./_defined');
|
|
module.exports = function(it){
|
|
return Object(defined(it));
|
|
};
|
|
},{"./_defined":33}],116:[function(require,module,exports){
|
|
// 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":55}],117:[function(require,module,exports){
|
|
'use strict';
|
|
if(require('./_descriptors')){
|
|
var LIBRARY = require('./_library')
|
|
, global = require('./_global')
|
|
, fails = require('./_fails')
|
|
, $export = require('./_export')
|
|
, $typed = require('./_typed')
|
|
, $buffer = require('./_typed-buffer')
|
|
, ctx = require('./_ctx')
|
|
, anInstance = require('./_an-instance')
|
|
, propertyDesc = require('./_property-desc')
|
|
, hide = require('./_hide')
|
|
, redefineAll = require('./_redefine-all')
|
|
, toInteger = require('./_to-integer')
|
|
, toLength = require('./_to-length')
|
|
, toIndex = require('./_to-index')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, has = require('./_has')
|
|
, same = require('./_same-value')
|
|
, classof = require('./_classof')
|
|
, isObject = require('./_is-object')
|
|
, toObject = require('./_to-object')
|
|
, isArrayIter = require('./_is-array-iter')
|
|
, create = require('./_object-create')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, gOPN = require('./_object-gopn').f
|
|
, getIterFn = require('./core.get-iterator-method')
|
|
, uid = require('./_uid')
|
|
, wks = require('./_wks')
|
|
, createArrayMethod = require('./_array-methods')
|
|
, createArrayIncludes = require('./_array-includes')
|
|
, speciesConstructor = require('./_species-constructor')
|
|
, ArrayIterators = require('./es6.array.iterator')
|
|
, Iterators = require('./_iterators')
|
|
, $iterDetect = require('./_iter-detect')
|
|
, setSpecies = require('./_set-species')
|
|
, arrayFill = require('./_array-fill')
|
|
, arrayCopyWithin = require('./_array-copy-within')
|
|
, $DP = require('./_object-dp')
|
|
, $GOPD = require('./_object-gopd')
|
|
, dP = $DP.f
|
|
, gOPD = $GOPD.f
|
|
, RangeError = global.RangeError
|
|
, TypeError = global.TypeError
|
|
, Uint8Array = global.Uint8Array
|
|
, ARRAY_BUFFER = 'ArrayBuffer'
|
|
, SHARED_BUFFER = 'Shared' + ARRAY_BUFFER
|
|
, BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'
|
|
, PROTOTYPE = 'prototype'
|
|
, ArrayProto = Array[PROTOTYPE]
|
|
, $ArrayBuffer = $buffer.ArrayBuffer
|
|
, $DataView = $buffer.DataView
|
|
, arrayForEach = createArrayMethod(0)
|
|
, arrayFilter = createArrayMethod(2)
|
|
, arraySome = createArrayMethod(3)
|
|
, arrayEvery = createArrayMethod(4)
|
|
, arrayFind = createArrayMethod(5)
|
|
, arrayFindIndex = createArrayMethod(6)
|
|
, arrayIncludes = createArrayIncludes(true)
|
|
, arrayIndexOf = createArrayIncludes(false)
|
|
, arrayValues = ArrayIterators.values
|
|
, arrayKeys = ArrayIterators.keys
|
|
, arrayEntries = ArrayIterators.entries
|
|
, arrayLastIndexOf = ArrayProto.lastIndexOf
|
|
, arrayReduce = ArrayProto.reduce
|
|
, arrayReduceRight = ArrayProto.reduceRight
|
|
, arrayJoin = ArrayProto.join
|
|
, arraySort = ArrayProto.sort
|
|
, arraySlice = ArrayProto.slice
|
|
, arrayToString = ArrayProto.toString
|
|
, arrayToLocaleString = ArrayProto.toLocaleString
|
|
, ITERATOR = wks('iterator')
|
|
, TAG = wks('toStringTag')
|
|
, TYPED_CONSTRUCTOR = uid('typed_constructor')
|
|
, DEF_CONSTRUCTOR = uid('def_constructor')
|
|
, ALL_CONSTRUCTORS = $typed.CONSTR
|
|
, TYPED_ARRAY = $typed.TYPED
|
|
, VIEW = $typed.VIEW
|
|
, WRONG_LENGTH = 'Wrong length!';
|
|
|
|
var $map = createArrayMethod(1, function(O, length){
|
|
return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
|
|
});
|
|
|
|
var LITTLE_ENDIAN = fails(function(){
|
|
return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
|
|
});
|
|
|
|
var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){
|
|
new Uint8Array(1).set({});
|
|
});
|
|
|
|
var strictToLength = function(it, SAME){
|
|
if(it === undefined)throw TypeError(WRONG_LENGTH);
|
|
var number = +it
|
|
, length = toLength(it);
|
|
if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH);
|
|
return length;
|
|
};
|
|
|
|
var toOffset = function(it, BYTES){
|
|
var offset = toInteger(it);
|
|
if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!');
|
|
return offset;
|
|
};
|
|
|
|
var validate = function(it){
|
|
if(isObject(it) && TYPED_ARRAY in it)return it;
|
|
throw TypeError(it + ' is not a typed array!');
|
|
};
|
|
|
|
var allocate = function(C, length){
|
|
if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){
|
|
throw TypeError('It is not a typed array constructor!');
|
|
} return new C(length);
|
|
};
|
|
|
|
var speciesFromList = function(O, list){
|
|
return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
|
|
};
|
|
|
|
var fromList = function(C, list){
|
|
var index = 0
|
|
, length = list.length
|
|
, result = allocate(C, length);
|
|
while(length > index)result[index] = list[index++];
|
|
return result;
|
|
};
|
|
|
|
var addGetter = function(it, key, internal){
|
|
dP(it, key, {get: function(){ return this._d[internal]; }});
|
|
};
|
|
|
|
var $from = function from(source /*, mapfn, thisArg */){
|
|
var O = toObject(source)
|
|
, aLen = arguments.length
|
|
, mapfn = aLen > 1 ? arguments[1] : undefined
|
|
, mapping = mapfn !== undefined
|
|
, iterFn = getIterFn(O)
|
|
, i, length, values, result, step, iterator;
|
|
if(iterFn != undefined && !isArrayIter(iterFn)){
|
|
for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){
|
|
values.push(step.value);
|
|
} O = values;
|
|
}
|
|
if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2);
|
|
for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){
|
|
result[i] = mapping ? mapfn(O[i], i) : O[i];
|
|
}
|
|
return result;
|
|
};
|
|
|
|
var $of = function of(/*...items*/){
|
|
var index = 0
|
|
, length = arguments.length
|
|
, result = allocate(this, length);
|
|
while(length > index)result[index] = arguments[index++];
|
|
return result;
|
|
};
|
|
|
|
// iOS Safari 6.x fails here
|
|
var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); });
|
|
|
|
var $toLocaleString = function toLocaleString(){
|
|
return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
|
|
};
|
|
|
|
var proto = {
|
|
copyWithin: function copyWithin(target, start /*, end */){
|
|
return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
|
|
},
|
|
every: function every(callbackfn /*, thisArg */){
|
|
return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars
|
|
return arrayFill.apply(validate(this), arguments);
|
|
},
|
|
filter: function filter(callbackfn /*, thisArg */){
|
|
return speciesFromList(this, arrayFilter(validate(this), callbackfn,
|
|
arguments.length > 1 ? arguments[1] : undefined));
|
|
},
|
|
find: function find(predicate /*, thisArg */){
|
|
return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
findIndex: function findIndex(predicate /*, thisArg */){
|
|
return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
forEach: function forEach(callbackfn /*, thisArg */){
|
|
arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
indexOf: function indexOf(searchElement /*, fromIndex */){
|
|
return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
includes: function includes(searchElement /*, fromIndex */){
|
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
join: function join(separator){ // eslint-disable-line no-unused-vars
|
|
return arrayJoin.apply(validate(this), arguments);
|
|
},
|
|
lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars
|
|
return arrayLastIndexOf.apply(validate(this), arguments);
|
|
},
|
|
map: function map(mapfn /*, thisArg */){
|
|
return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
|
|
return arrayReduce.apply(validate(this), arguments);
|
|
},
|
|
reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
|
|
return arrayReduceRight.apply(validate(this), arguments);
|
|
},
|
|
reverse: function reverse(){
|
|
var that = this
|
|
, length = validate(that).length
|
|
, middle = Math.floor(length / 2)
|
|
, index = 0
|
|
, value;
|
|
while(index < middle){
|
|
value = that[index];
|
|
that[index++] = that[--length];
|
|
that[length] = value;
|
|
} return that;
|
|
},
|
|
some: function some(callbackfn /*, thisArg */){
|
|
return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
},
|
|
sort: function sort(comparefn){
|
|
return arraySort.call(validate(this), comparefn);
|
|
},
|
|
subarray: function subarray(begin, end){
|
|
var O = validate(this)
|
|
, length = O.length
|
|
, $begin = toIndex(begin, length);
|
|
return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(
|
|
O.buffer,
|
|
O.byteOffset + $begin * O.BYTES_PER_ELEMENT,
|
|
toLength((end === undefined ? length : toIndex(end, length)) - $begin)
|
|
);
|
|
}
|
|
};
|
|
|
|
var $slice = function slice(start, end){
|
|
return speciesFromList(this, arraySlice.call(validate(this), start, end));
|
|
};
|
|
|
|
var $set = function set(arrayLike /*, offset */){
|
|
validate(this);
|
|
var offset = toOffset(arguments[1], 1)
|
|
, length = this.length
|
|
, src = toObject(arrayLike)
|
|
, len = toLength(src.length)
|
|
, index = 0;
|
|
if(len + offset > length)throw RangeError(WRONG_LENGTH);
|
|
while(index < len)this[offset + index] = src[index++];
|
|
};
|
|
|
|
var $iterators = {
|
|
entries: function entries(){
|
|
return arrayEntries.call(validate(this));
|
|
},
|
|
keys: function keys(){
|
|
return arrayKeys.call(validate(this));
|
|
},
|
|
values: function values(){
|
|
return arrayValues.call(validate(this));
|
|
}
|
|
};
|
|
|
|
var isTAIndex = function(target, key){
|
|
return isObject(target)
|
|
&& target[TYPED_ARRAY]
|
|
&& typeof key != 'symbol'
|
|
&& key in target
|
|
&& String(+key) == String(key);
|
|
};
|
|
var $getDesc = function getOwnPropertyDescriptor(target, key){
|
|
return isTAIndex(target, key = toPrimitive(key, true))
|
|
? propertyDesc(2, target[key])
|
|
: gOPD(target, key);
|
|
};
|
|
var $setDesc = function defineProperty(target, key, desc){
|
|
if(isTAIndex(target, key = toPrimitive(key, true))
|
|
&& isObject(desc)
|
|
&& has(desc, 'value')
|
|
&& !has(desc, 'get')
|
|
&& !has(desc, 'set')
|
|
// TODO: add validation descriptor w/o calling accessors
|
|
&& !desc.configurable
|
|
&& (!has(desc, 'writable') || desc.writable)
|
|
&& (!has(desc, 'enumerable') || desc.enumerable)
|
|
){
|
|
target[key] = desc.value;
|
|
return target;
|
|
} else return dP(target, key, desc);
|
|
};
|
|
|
|
if(!ALL_CONSTRUCTORS){
|
|
$GOPD.f = $getDesc;
|
|
$DP.f = $setDesc;
|
|
}
|
|
|
|
$export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
|
|
getOwnPropertyDescriptor: $getDesc,
|
|
defineProperty: $setDesc
|
|
});
|
|
|
|
if(fails(function(){ arrayToString.call({}); })){
|
|
arrayToString = arrayToLocaleString = function toString(){
|
|
return arrayJoin.call(this);
|
|
}
|
|
}
|
|
|
|
var $TypedArrayPrototype$ = redefineAll({}, proto);
|
|
redefineAll($TypedArrayPrototype$, $iterators);
|
|
hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
|
|
redefineAll($TypedArrayPrototype$, {
|
|
slice: $slice,
|
|
set: $set,
|
|
constructor: function(){ /* noop */ },
|
|
toString: arrayToString,
|
|
toLocaleString: $toLocaleString
|
|
});
|
|
addGetter($TypedArrayPrototype$, 'buffer', 'b');
|
|
addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
|
|
addGetter($TypedArrayPrototype$, 'byteLength', 'l');
|
|
addGetter($TypedArrayPrototype$, 'length', 'e');
|
|
dP($TypedArrayPrototype$, TAG, {
|
|
get: function(){ return this[TYPED_ARRAY]; }
|
|
});
|
|
|
|
module.exports = function(KEY, BYTES, wrapper, CLAMPED){
|
|
CLAMPED = !!CLAMPED;
|
|
var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'
|
|
, ISNT_UINT8 = NAME != 'Uint8Array'
|
|
, GETTER = 'get' + KEY
|
|
, SETTER = 'set' + KEY
|
|
, TypedArray = global[NAME]
|
|
, Base = TypedArray || {}
|
|
, TAC = TypedArray && getPrototypeOf(TypedArray)
|
|
, FORCED = !TypedArray || !$typed.ABV
|
|
, O = {}
|
|
, TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
|
|
var getter = function(that, index){
|
|
var data = that._d;
|
|
return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
|
|
};
|
|
var setter = function(that, index, value){
|
|
var data = that._d;
|
|
if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
|
|
data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
|
|
};
|
|
var addElement = function(that, index){
|
|
dP(that, index, {
|
|
get: function(){
|
|
return getter(this, index);
|
|
},
|
|
set: function(value){
|
|
return setter(this, index, value);
|
|
},
|
|
enumerable: true
|
|
});
|
|
};
|
|
if(FORCED){
|
|
TypedArray = wrapper(function(that, data, $offset, $length){
|
|
anInstance(that, TypedArray, NAME, '_d');
|
|
var index = 0
|
|
, offset = 0
|
|
, buffer, byteLength, length, klass;
|
|
if(!isObject(data)){
|
|
length = strictToLength(data, true)
|
|
byteLength = length * BYTES;
|
|
buffer = new $ArrayBuffer(byteLength);
|
|
} else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
|
|
buffer = data;
|
|
offset = toOffset($offset, BYTES);
|
|
var $len = data.byteLength;
|
|
if($length === undefined){
|
|
if($len % BYTES)throw RangeError(WRONG_LENGTH);
|
|
byteLength = $len - offset;
|
|
if(byteLength < 0)throw RangeError(WRONG_LENGTH);
|
|
} else {
|
|
byteLength = toLength($length) * BYTES;
|
|
if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH);
|
|
}
|
|
length = byteLength / BYTES;
|
|
} else if(TYPED_ARRAY in data){
|
|
return fromList(TypedArray, data);
|
|
} else {
|
|
return $from.call(TypedArray, data);
|
|
}
|
|
hide(that, '_d', {
|
|
b: buffer,
|
|
o: offset,
|
|
l: byteLength,
|
|
e: length,
|
|
v: new $DataView(buffer)
|
|
});
|
|
while(index < length)addElement(that, index++);
|
|
});
|
|
TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
|
|
hide(TypedArrayPrototype, 'constructor', TypedArray);
|
|
} else if(!$iterDetect(function(iter){
|
|
// V8 works with iterators, but fails in many other cases
|
|
// https://code.google.com/p/v8/issues/detail?id=4552
|
|
new TypedArray(null); // eslint-disable-line no-new
|
|
new TypedArray(iter); // eslint-disable-line no-new
|
|
}, true)){
|
|
TypedArray = wrapper(function(that, data, $offset, $length){
|
|
anInstance(that, TypedArray, NAME);
|
|
var klass;
|
|
// `ws` module bug, temporarily remove validation length for Uint8Array
|
|
// https://github.com/websockets/ws/pull/645
|
|
if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8));
|
|
if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){
|
|
return $length !== undefined
|
|
? new Base(data, toOffset($offset, BYTES), $length)
|
|
: $offset !== undefined
|
|
? new Base(data, toOffset($offset, BYTES))
|
|
: new Base(data);
|
|
}
|
|
if(TYPED_ARRAY in data)return fromList(TypedArray, data);
|
|
return $from.call(TypedArray, data);
|
|
});
|
|
arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){
|
|
if(!(key in TypedArray))hide(TypedArray, key, Base[key]);
|
|
});
|
|
TypedArray[PROTOTYPE] = TypedArrayPrototype;
|
|
if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray;
|
|
}
|
|
var $nativeIterator = TypedArrayPrototype[ITERATOR]
|
|
, CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined)
|
|
, $iterator = $iterators.values;
|
|
hide(TypedArray, TYPED_CONSTRUCTOR, true);
|
|
hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
|
|
hide(TypedArrayPrototype, VIEW, true);
|
|
hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
|
|
|
|
if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){
|
|
dP(TypedArrayPrototype, TAG, {
|
|
get: function(){ return NAME; }
|
|
});
|
|
}
|
|
|
|
O[NAME] = TypedArray;
|
|
|
|
$export($export.G + $export.W + $export.F * (TypedArray != Base), O);
|
|
|
|
$export($export.S, NAME, {
|
|
BYTES_PER_ELEMENT: BYTES,
|
|
from: $from,
|
|
of: $of
|
|
});
|
|
|
|
if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
|
|
|
|
$export($export.P, NAME, proto);
|
|
|
|
setSpecies(NAME);
|
|
|
|
$export($export.P + $export.F * FORCED_SET, NAME, {set: $set});
|
|
|
|
$export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
|
|
|
|
$export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString});
|
|
|
|
$export($export.P + $export.F * fails(function(){
|
|
new TypedArray(1).slice();
|
|
}), NAME, {slice: $slice});
|
|
|
|
$export($export.P + $export.F * (fails(function(){
|
|
return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString()
|
|
}) || !fails(function(){
|
|
TypedArrayPrototype.toLocaleString.call([1, 2]);
|
|
})), NAME, {toLocaleString: $toLocaleString});
|
|
|
|
Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
|
|
if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator);
|
|
};
|
|
} else module.exports = function(){ /* empty */ };
|
|
},{"./_an-instance":12,"./_array-copy-within":14,"./_array-fill":15,"./_array-includes":17,"./_array-methods":18,"./_classof":23,"./_ctx":31,"./_descriptors":34,"./_export":38,"./_fails":40,"./_global":44,"./_has":45,"./_hide":46,"./_is-array-iter":52,"./_is-object":55,"./_iter-detect":60,"./_iterators":62,"./_library":64,"./_object-create":72,"./_object-dp":73,"./_object-gopd":76,"./_object-gopn":78,"./_object-gpo":80,"./_property-desc":91,"./_redefine-all":92,"./_same-value":95,"./_set-species":97,"./_species-constructor":101,"./_to-index":111,"./_to-integer":112,"./_to-length":114,"./_to-object":115,"./_to-primitive":116,"./_typed":119,"./_typed-buffer":118,"./_uid":120,"./_wks":123,"./core.get-iterator-method":124,"./es6.array.iterator":136}],118:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./_global')
|
|
, DESCRIPTORS = require('./_descriptors')
|
|
, LIBRARY = require('./_library')
|
|
, $typed = require('./_typed')
|
|
, hide = require('./_hide')
|
|
, redefineAll = require('./_redefine-all')
|
|
, fails = require('./_fails')
|
|
, anInstance = require('./_an-instance')
|
|
, toInteger = require('./_to-integer')
|
|
, toLength = require('./_to-length')
|
|
, gOPN = require('./_object-gopn').f
|
|
, dP = require('./_object-dp').f
|
|
, arrayFill = require('./_array-fill')
|
|
, setToStringTag = require('./_set-to-string-tag')
|
|
, ARRAY_BUFFER = 'ArrayBuffer'
|
|
, DATA_VIEW = 'DataView'
|
|
, PROTOTYPE = 'prototype'
|
|
, WRONG_LENGTH = 'Wrong length!'
|
|
, WRONG_INDEX = 'Wrong index!'
|
|
, $ArrayBuffer = global[ARRAY_BUFFER]
|
|
, $DataView = global[DATA_VIEW]
|
|
, Math = global.Math
|
|
, RangeError = global.RangeError
|
|
, Infinity = global.Infinity
|
|
, BaseBuffer = $ArrayBuffer
|
|
, abs = Math.abs
|
|
, pow = Math.pow
|
|
, floor = Math.floor
|
|
, log = Math.log
|
|
, LN2 = Math.LN2
|
|
, BUFFER = 'buffer'
|
|
, BYTE_LENGTH = 'byteLength'
|
|
, BYTE_OFFSET = 'byteOffset'
|
|
, $BUFFER = DESCRIPTORS ? '_b' : BUFFER
|
|
, $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH
|
|
, $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
|
|
|
|
// IEEE754 conversions based on https://github.com/feross/ieee754
|
|
var packIEEE754 = function(value, mLen, nBytes){
|
|
var buffer = Array(nBytes)
|
|
, eLen = nBytes * 8 - mLen - 1
|
|
, eMax = (1 << eLen) - 1
|
|
, eBias = eMax >> 1
|
|
, rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0
|
|
, i = 0
|
|
, s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0
|
|
, e, m, c;
|
|
value = abs(value)
|
|
if(value != value || value === Infinity){
|
|
m = value != value ? 1 : 0;
|
|
e = eMax;
|
|
} else {
|
|
e = floor(log(value) / LN2);
|
|
if(value * (c = pow(2, -e)) < 1){
|
|
e--;
|
|
c *= 2;
|
|
}
|
|
if(e + eBias >= 1){
|
|
value += rt / c;
|
|
} else {
|
|
value += rt * 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) * pow(2, mLen);
|
|
e = e + eBias;
|
|
} else {
|
|
m = value * pow(2, eBias - 1) * pow(2, mLen);
|
|
e = 0;
|
|
}
|
|
}
|
|
for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
|
|
e = e << mLen | m;
|
|
eLen += mLen;
|
|
for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
|
|
buffer[--i] |= s * 128;
|
|
return buffer;
|
|
};
|
|
var unpackIEEE754 = function(buffer, mLen, nBytes){
|
|
var eLen = nBytes * 8 - mLen - 1
|
|
, eMax = (1 << eLen) - 1
|
|
, eBias = eMax >> 1
|
|
, nBits = eLen - 7
|
|
, i = nBytes - 1
|
|
, s = buffer[i--]
|
|
, e = s & 127
|
|
, m;
|
|
s >>= 7;
|
|
for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
|
|
m = e & (1 << -nBits) - 1;
|
|
e >>= -nBits;
|
|
nBits += mLen;
|
|
for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
|
|
if(e === 0){
|
|
e = 1 - eBias;
|
|
} else if(e === eMax){
|
|
return m ? NaN : s ? -Infinity : Infinity;
|
|
} else {
|
|
m = m + pow(2, mLen);
|
|
e = e - eBias;
|
|
} return (s ? -1 : 1) * m * pow(2, e - mLen);
|
|
};
|
|
|
|
var unpackI32 = function(bytes){
|
|
return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
|
|
};
|
|
var packI8 = function(it){
|
|
return [it & 0xff];
|
|
};
|
|
var packI16 = function(it){
|
|
return [it & 0xff, it >> 8 & 0xff];
|
|
};
|
|
var packI32 = function(it){
|
|
return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
|
|
};
|
|
var packF64 = function(it){
|
|
return packIEEE754(it, 52, 8);
|
|
};
|
|
var packF32 = function(it){
|
|
return packIEEE754(it, 23, 4);
|
|
};
|
|
|
|
var addGetter = function(C, key, internal){
|
|
dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }});
|
|
};
|
|
|
|
var get = function(view, bytes, index, isLittleEndian){
|
|
var numIndex = +index
|
|
, intIndex = toInteger(numIndex);
|
|
if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
|
|
var store = view[$BUFFER]._b
|
|
, start = intIndex + view[$OFFSET]
|
|
, pack = store.slice(start, start + bytes);
|
|
return isLittleEndian ? pack : pack.reverse();
|
|
};
|
|
var set = function(view, bytes, index, conversion, value, isLittleEndian){
|
|
var numIndex = +index
|
|
, intIndex = toInteger(numIndex);
|
|
if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX);
|
|
var store = view[$BUFFER]._b
|
|
, start = intIndex + view[$OFFSET]
|
|
, pack = conversion(+value);
|
|
for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
|
|
};
|
|
|
|
var validateArrayBufferArguments = function(that, length){
|
|
anInstance(that, $ArrayBuffer, ARRAY_BUFFER);
|
|
var numberLength = +length
|
|
, byteLength = toLength(numberLength);
|
|
if(numberLength != byteLength)throw RangeError(WRONG_LENGTH);
|
|
return byteLength;
|
|
};
|
|
|
|
if(!$typed.ABV){
|
|
$ArrayBuffer = function ArrayBuffer(length){
|
|
var byteLength = validateArrayBufferArguments(this, length);
|
|
this._b = arrayFill.call(Array(byteLength), 0);
|
|
this[$LENGTH] = byteLength;
|
|
};
|
|
|
|
$DataView = function DataView(buffer, byteOffset, byteLength){
|
|
anInstance(this, $DataView, DATA_VIEW);
|
|
anInstance(buffer, $ArrayBuffer, DATA_VIEW);
|
|
var bufferLength = buffer[$LENGTH]
|
|
, offset = toInteger(byteOffset);
|
|
if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!');
|
|
byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
|
|
if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH);
|
|
this[$BUFFER] = buffer;
|
|
this[$OFFSET] = offset;
|
|
this[$LENGTH] = byteLength;
|
|
};
|
|
|
|
if(DESCRIPTORS){
|
|
addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
|
|
addGetter($DataView, BUFFER, '_b');
|
|
addGetter($DataView, BYTE_LENGTH, '_l');
|
|
addGetter($DataView, BYTE_OFFSET, '_o');
|
|
}
|
|
|
|
redefineAll($DataView[PROTOTYPE], {
|
|
getInt8: function getInt8(byteOffset){
|
|
return get(this, 1, byteOffset)[0] << 24 >> 24;
|
|
},
|
|
getUint8: function getUint8(byteOffset){
|
|
return get(this, 1, byteOffset)[0];
|
|
},
|
|
getInt16: function getInt16(byteOffset /*, littleEndian */){
|
|
var bytes = get(this, 2, byteOffset, arguments[1]);
|
|
return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
|
|
},
|
|
getUint16: function getUint16(byteOffset /*, littleEndian */){
|
|
var bytes = get(this, 2, byteOffset, arguments[1]);
|
|
return bytes[1] << 8 | bytes[0];
|
|
},
|
|
getInt32: function getInt32(byteOffset /*, littleEndian */){
|
|
return unpackI32(get(this, 4, byteOffset, arguments[1]));
|
|
},
|
|
getUint32: function getUint32(byteOffset /*, littleEndian */){
|
|
return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
|
|
},
|
|
getFloat32: function getFloat32(byteOffset /*, littleEndian */){
|
|
return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
|
|
},
|
|
getFloat64: function getFloat64(byteOffset /*, littleEndian */){
|
|
return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
|
|
},
|
|
setInt8: function setInt8(byteOffset, value){
|
|
set(this, 1, byteOffset, packI8, value);
|
|
},
|
|
setUint8: function setUint8(byteOffset, value){
|
|
set(this, 1, byteOffset, packI8, value);
|
|
},
|
|
setInt16: function setInt16(byteOffset, value /*, littleEndian */){
|
|
set(this, 2, byteOffset, packI16, value, arguments[2]);
|
|
},
|
|
setUint16: function setUint16(byteOffset, value /*, littleEndian */){
|
|
set(this, 2, byteOffset, packI16, value, arguments[2]);
|
|
},
|
|
setInt32: function setInt32(byteOffset, value /*, littleEndian */){
|
|
set(this, 4, byteOffset, packI32, value, arguments[2]);
|
|
},
|
|
setUint32: function setUint32(byteOffset, value /*, littleEndian */){
|
|
set(this, 4, byteOffset, packI32, value, arguments[2]);
|
|
},
|
|
setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){
|
|
set(this, 4, byteOffset, packF32, value, arguments[2]);
|
|
},
|
|
setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){
|
|
set(this, 8, byteOffset, packF64, value, arguments[2]);
|
|
}
|
|
});
|
|
} else {
|
|
if(!fails(function(){
|
|
new $ArrayBuffer; // eslint-disable-line no-new
|
|
}) || !fails(function(){
|
|
new $ArrayBuffer(.5); // eslint-disable-line no-new
|
|
})){
|
|
$ArrayBuffer = function ArrayBuffer(length){
|
|
return new BaseBuffer(validateArrayBufferArguments(this, length));
|
|
};
|
|
var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
|
|
for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){
|
|
if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]);
|
|
};
|
|
if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
|
|
}
|
|
// iOS Safari 7.x bug
|
|
var view = new $DataView(new $ArrayBuffer(2))
|
|
, $setInt8 = $DataView[PROTOTYPE].setInt8;
|
|
view.setInt8(0, 2147483648);
|
|
view.setInt8(1, 2147483649);
|
|
if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
|
|
setInt8: function setInt8(byteOffset, value){
|
|
$setInt8.call(this, byteOffset, value << 24 >> 24);
|
|
},
|
|
setUint8: function setUint8(byteOffset, value){
|
|
$setInt8.call(this, byteOffset, value << 24 >> 24);
|
|
}
|
|
}, true);
|
|
}
|
|
setToStringTag($ArrayBuffer, ARRAY_BUFFER);
|
|
setToStringTag($DataView, DATA_VIEW);
|
|
hide($DataView[PROTOTYPE], $typed.VIEW, true);
|
|
exports[ARRAY_BUFFER] = $ArrayBuffer;
|
|
exports[DATA_VIEW] = $DataView;
|
|
},{"./_an-instance":12,"./_array-fill":15,"./_descriptors":34,"./_fails":40,"./_global":44,"./_hide":46,"./_library":64,"./_object-dp":73,"./_object-gopn":78,"./_redefine-all":92,"./_set-to-string-tag":98,"./_to-integer":112,"./_to-length":114,"./_typed":119}],119:[function(require,module,exports){
|
|
var global = require('./_global')
|
|
, hide = require('./_hide')
|
|
, uid = require('./_uid')
|
|
, TYPED = uid('typed_array')
|
|
, VIEW = uid('view')
|
|
, ABV = !!(global.ArrayBuffer && global.DataView)
|
|
, CONSTR = ABV
|
|
, i = 0, l = 9, Typed;
|
|
|
|
var TypedArrayConstructors = (
|
|
'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'
|
|
).split(',');
|
|
|
|
while(i < l){
|
|
if(Typed = global[TypedArrayConstructors[i++]]){
|
|
hide(Typed.prototype, TYPED, true);
|
|
hide(Typed.prototype, VIEW, true);
|
|
} else CONSTR = false;
|
|
}
|
|
|
|
module.exports = {
|
|
ABV: ABV,
|
|
CONSTR: CONSTR,
|
|
TYPED: TYPED,
|
|
VIEW: VIEW
|
|
};
|
|
},{"./_global":44,"./_hide":46,"./_uid":120}],120:[function(require,module,exports){
|
|
var id = 0
|
|
, px = Math.random();
|
|
module.exports = function(key){
|
|
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
};
|
|
},{}],121:[function(require,module,exports){
|
|
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":29,"./_global":44,"./_library":64,"./_object-dp":73,"./_wks-ext":122}],122:[function(require,module,exports){
|
|
exports.f = require('./_wks');
|
|
},{"./_wks":123}],123:[function(require,module,exports){
|
|
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":44,"./_shared":100,"./_uid":120}],124:[function(require,module,exports){
|
|
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":23,"./_core":29,"./_iterators":62,"./_wks":123}],125:[function(require,module,exports){
|
|
// https://github.com/benjamingr/RexExp.escape
|
|
var $export = require('./_export')
|
|
, $re = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
|
|
$export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
|
|
|
|
},{"./_export":38,"./_replacer":94}],126:[function(require,module,exports){
|
|
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P, 'Array', {copyWithin: require('./_array-copy-within')});
|
|
|
|
require('./_add-to-unscopables')('copyWithin');
|
|
},{"./_add-to-unscopables":11,"./_array-copy-within":14,"./_export":38}],127:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $every = require('./_array-methods')(4);
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', {
|
|
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
|
|
every: function every(callbackfn /* , thisArg */){
|
|
return $every(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-methods":18,"./_export":38,"./_strict-method":102}],128:[function(require,module,exports){
|
|
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P, 'Array', {fill: require('./_array-fill')});
|
|
|
|
require('./_add-to-unscopables')('fill');
|
|
},{"./_add-to-unscopables":11,"./_array-fill":15,"./_export":38}],129:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $filter = require('./_array-methods')(2);
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {
|
|
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
|
|
filter: function filter(callbackfn /* , thisArg */){
|
|
return $filter(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-methods":18,"./_export":38,"./_strict-method":102}],130:[function(require,module,exports){
|
|
'use strict';
|
|
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
|
|
var $export = require('./_export')
|
|
, $find = require('./_array-methods')(6)
|
|
, KEY = 'findIndex'
|
|
, forced = true;
|
|
// Shouldn't skip holes
|
|
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
|
|
$export($export.P + $export.F * forced, 'Array', {
|
|
findIndex: function findIndex(callbackfn/*, that = undefined */){
|
|
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
require('./_add-to-unscopables')(KEY);
|
|
},{"./_add-to-unscopables":11,"./_array-methods":18,"./_export":38}],131:[function(require,module,exports){
|
|
'use strict';
|
|
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
|
|
var $export = require('./_export')
|
|
, $find = require('./_array-methods')(5)
|
|
, KEY = 'find'
|
|
, forced = true;
|
|
// Shouldn't skip holes
|
|
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
|
|
$export($export.P + $export.F * forced, 'Array', {
|
|
find: function find(callbackfn/*, that = undefined */){
|
|
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
require('./_add-to-unscopables')(KEY);
|
|
},{"./_add-to-unscopables":11,"./_array-methods":18,"./_export":38}],132:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $forEach = require('./_array-methods')(0)
|
|
, STRICT = require('./_strict-method')([].forEach, true);
|
|
|
|
$export($export.P + $export.F * !STRICT, 'Array', {
|
|
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
|
|
forEach: function forEach(callbackfn /* , thisArg */){
|
|
return $forEach(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-methods":18,"./_export":38,"./_strict-method":102}],133:[function(require,module,exports){
|
|
'use strict';
|
|
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){ Array.from(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":30,"./_ctx":31,"./_export":38,"./_is-array-iter":52,"./_iter-call":57,"./_iter-detect":60,"./_to-length":114,"./_to-object":115,"./core.get-iterator-method":124}],134:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $indexOf = require('./_array-includes')(false)
|
|
, $native = [].indexOf
|
|
, NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
|
|
|
|
$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
|
|
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
|
|
indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
|
|
return NEGATIVE_ZERO
|
|
// convert -0 to +0
|
|
? $native.apply(this, arguments) || 0
|
|
: $indexOf(this, searchElement, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-includes":17,"./_export":38,"./_strict-method":102}],135:[function(require,module,exports){
|
|
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Array', {isArray: require('./_is-array')});
|
|
},{"./_export":38,"./_is-array":53}],136:[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":11,"./_iter-define":59,"./_iter-step":61,"./_iterators":62,"./_to-iobject":113}],137:[function(require,module,exports){
|
|
'use strict';
|
|
// 22.1.3.13 Array.prototype.join(separator)
|
|
var $export = require('./_export')
|
|
, toIObject = require('./_to-iobject')
|
|
, arrayJoin = [].join;
|
|
|
|
// fallback for not array-like strings
|
|
$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', {
|
|
join: function join(separator){
|
|
return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_iobject":51,"./_strict-method":102,"./_to-iobject":113}],138:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toIObject = require('./_to-iobject')
|
|
, toInteger = require('./_to-integer')
|
|
, toLength = require('./_to-length')
|
|
, $native = [].lastIndexOf
|
|
, NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
|
|
|
|
$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
|
|
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
|
|
lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){
|
|
// convert -0 to +0
|
|
if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0;
|
|
var O = toIObject(this)
|
|
, length = toLength(O.length)
|
|
, index = length - 1;
|
|
if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1]));
|
|
if(index < 0)index = length + index;
|
|
for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0;
|
|
return -1;
|
|
}
|
|
});
|
|
},{"./_export":38,"./_strict-method":102,"./_to-integer":112,"./_to-iobject":113,"./_to-length":114}],139:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $map = require('./_array-methods')(1);
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', {
|
|
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
|
|
map: function map(callbackfn /* , thisArg */){
|
|
return $map(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-methods":18,"./_export":38,"./_strict-method":102}],140:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, createProperty = require('./_create-property');
|
|
|
|
// WebKit Array.of isn't generic
|
|
$export($export.S + $export.F * require('./_fails')(function(){
|
|
function F(){}
|
|
return !(Array.of.call(F) instanceof F);
|
|
}), 'Array', {
|
|
// 22.1.2.3 Array.of( ...items)
|
|
of: function of(/* ...args */){
|
|
var index = 0
|
|
, aLen = arguments.length
|
|
, result = new (typeof this == 'function' ? this : Array)(aLen);
|
|
while(aLen > index)createProperty(result, index, arguments[index++]);
|
|
result.length = aLen;
|
|
return result;
|
|
}
|
|
});
|
|
},{"./_create-property":30,"./_export":38,"./_fails":40}],141:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $reduce = require('./_array-reduce');
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', {
|
|
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
|
|
reduceRight: function reduceRight(callbackfn /* , initialValue */){
|
|
return $reduce(this, callbackfn, arguments.length, arguments[1], true);
|
|
}
|
|
});
|
|
},{"./_array-reduce":19,"./_export":38,"./_strict-method":102}],142:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $reduce = require('./_array-reduce');
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', {
|
|
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
|
|
reduce: function reduce(callbackfn /* , initialValue */){
|
|
return $reduce(this, callbackfn, arguments.length, arguments[1], false);
|
|
}
|
|
});
|
|
},{"./_array-reduce":19,"./_export":38,"./_strict-method":102}],143:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, html = require('./_html')
|
|
, cof = require('./_cof')
|
|
, toIndex = require('./_to-index')
|
|
, toLength = require('./_to-length')
|
|
, arraySlice = [].slice;
|
|
|
|
// fallback for not array-like ES3 strings and DOM objects
|
|
$export($export.P + $export.F * require('./_fails')(function(){
|
|
if(html)arraySlice.call(html);
|
|
}), 'Array', {
|
|
slice: function slice(begin, end){
|
|
var len = toLength(this.length)
|
|
, klass = cof(this);
|
|
end = end === undefined ? len : end;
|
|
if(klass == 'Array')return arraySlice.call(this, begin, end);
|
|
var start = toIndex(begin, len)
|
|
, upTo = toIndex(end, len)
|
|
, size = toLength(upTo - start)
|
|
, cloned = Array(size)
|
|
, i = 0;
|
|
for(; i < size; i++)cloned[i] = klass == 'String'
|
|
? this.charAt(start + i)
|
|
: this[start + i];
|
|
return cloned;
|
|
}
|
|
});
|
|
},{"./_cof":24,"./_export":38,"./_fails":40,"./_html":47,"./_to-index":111,"./_to-length":114}],144:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $some = require('./_array-methods')(3);
|
|
|
|
$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', {
|
|
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
|
|
some: function some(callbackfn /* , thisArg */){
|
|
return $some(this, callbackfn, arguments[1]);
|
|
}
|
|
});
|
|
},{"./_array-methods":18,"./_export":38,"./_strict-method":102}],145:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, aFunction = require('./_a-function')
|
|
, toObject = require('./_to-object')
|
|
, fails = require('./_fails')
|
|
, $sort = [].sort
|
|
, test = [1, 2, 3];
|
|
|
|
$export($export.P + $export.F * (fails(function(){
|
|
// IE8-
|
|
test.sort(undefined);
|
|
}) || !fails(function(){
|
|
// V8 bug
|
|
test.sort(null);
|
|
// Old WebKit
|
|
}) || !require('./_strict-method')($sort)), 'Array', {
|
|
// 22.1.3.25 Array.prototype.sort(comparefn)
|
|
sort: function sort(comparefn){
|
|
return comparefn === undefined
|
|
? $sort.call(toObject(this))
|
|
: $sort.call(toObject(this), aFunction(comparefn));
|
|
}
|
|
});
|
|
},{"./_a-function":9,"./_export":38,"./_fails":40,"./_strict-method":102,"./_to-object":115}],146:[function(require,module,exports){
|
|
require('./_set-species')('Array');
|
|
},{"./_set-species":97}],147:[function(require,module,exports){
|
|
// 20.3.3.1 / 15.9.4.4 Date.now()
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Date', {now: function(){ return new Date().getTime(); }});
|
|
},{"./_export":38}],148:[function(require,module,exports){
|
|
'use strict';
|
|
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
|
|
var $export = require('./_export')
|
|
, fails = require('./_fails')
|
|
, getTime = Date.prototype.getTime;
|
|
|
|
var lz = function(num){
|
|
return num > 9 ? num : '0' + num;
|
|
};
|
|
|
|
// PhantomJS / old WebKit has a broken implementations
|
|
$export($export.P + $export.F * (fails(function(){
|
|
return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
|
|
}) || !fails(function(){
|
|
new Date(NaN).toISOString();
|
|
})), 'Date', {
|
|
toISOString: function toISOString(){
|
|
if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value');
|
|
var d = this
|
|
, y = d.getUTCFullYear()
|
|
, m = d.getUTCMilliseconds()
|
|
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
|
|
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
|
|
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
|
|
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
|
|
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails":40}],149:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toObject = require('./_to-object')
|
|
, toPrimitive = require('./_to-primitive');
|
|
|
|
$export($export.P + $export.F * require('./_fails')(function(){
|
|
return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1;
|
|
}), 'Date', {
|
|
toJSON: function toJSON(key){
|
|
var O = toObject(this)
|
|
, pv = toPrimitive(O);
|
|
return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails":40,"./_to-object":115,"./_to-primitive":116}],150:[function(require,module,exports){
|
|
var TO_PRIMITIVE = require('./_wks')('toPrimitive')
|
|
, proto = Date.prototype;
|
|
|
|
if(!(TO_PRIMITIVE in proto))require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive'));
|
|
},{"./_date-to-primitive":32,"./_hide":46,"./_wks":123}],151:[function(require,module,exports){
|
|
var DateProto = Date.prototype
|
|
, INVALID_DATE = 'Invalid Date'
|
|
, TO_STRING = 'toString'
|
|
, $toString = DateProto[TO_STRING]
|
|
, getTime = DateProto.getTime;
|
|
if(new Date(NaN) + '' != INVALID_DATE){
|
|
require('./_redefine')(DateProto, TO_STRING, function toString(){
|
|
var value = getTime.call(this);
|
|
return value === value ? $toString.call(this) : INVALID_DATE;
|
|
});
|
|
}
|
|
},{"./_redefine":93}],152:[function(require,module,exports){
|
|
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P, 'Function', {bind: require('./_bind')});
|
|
},{"./_bind":22,"./_export":38}],153:[function(require,module,exports){
|
|
'use strict';
|
|
var isObject = require('./_is-object')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, HAS_INSTANCE = require('./_wks')('hasInstance')
|
|
, FunctionProto = Function.prototype;
|
|
// 19.2.3.6 Function.prototype[@@hasInstance](V)
|
|
if(!(HAS_INSTANCE in FunctionProto))require('./_object-dp').f(FunctionProto, HAS_INSTANCE, {value: function(O){
|
|
if(typeof this != 'function' || !isObject(O))return false;
|
|
if(!isObject(this.prototype))return O instanceof this;
|
|
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
|
|
while(O = getPrototypeOf(O))if(this.prototype === O)return true;
|
|
return false;
|
|
}});
|
|
},{"./_is-object":55,"./_object-dp":73,"./_object-gpo":80,"./_wks":123}],154:[function(require,module,exports){
|
|
var dP = require('./_object-dp').f
|
|
, createDesc = require('./_property-desc')
|
|
, has = require('./_has')
|
|
, FProto = Function.prototype
|
|
, nameRE = /^\s*function ([^ (]*)/
|
|
, NAME = 'name';
|
|
|
|
var isExtensible = Object.isExtensible || function(){
|
|
return true;
|
|
};
|
|
|
|
// 19.2.4.2 name
|
|
NAME in FProto || require('./_descriptors') && dP(FProto, NAME, {
|
|
configurable: true,
|
|
get: function(){
|
|
try {
|
|
var that = this
|
|
, name = ('' + that).match(nameRE)[1];
|
|
has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
|
|
return name;
|
|
} catch(e){
|
|
return '';
|
|
}
|
|
}
|
|
});
|
|
},{"./_descriptors":34,"./_has":45,"./_object-dp":73,"./_property-desc":91}],155:[function(require,module,exports){
|
|
'use strict';
|
|
var strong = require('./_collection-strong');
|
|
|
|
// 23.1 Map Objects
|
|
module.exports = require('./_collection')('Map', function(get){
|
|
return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.1.3.6 Map.prototype.get(key)
|
|
get: function get(key){
|
|
var entry = strong.getEntry(this, key);
|
|
return entry && entry.v;
|
|
},
|
|
// 23.1.3.9 Map.prototype.set(key, value)
|
|
set: function set(key, value){
|
|
return strong.def(this, key === 0 ? 0 : key, value);
|
|
}
|
|
}, strong, true);
|
|
},{"./_collection":28,"./_collection-strong":25}],156:[function(require,module,exports){
|
|
// 20.2.2.3 Math.acosh(x)
|
|
var $export = require('./_export')
|
|
, log1p = require('./_math-log1p')
|
|
, sqrt = Math.sqrt
|
|
, $acosh = Math.acosh;
|
|
|
|
$export($export.S + $export.F * !($acosh
|
|
// V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
|
|
&& Math.floor($acosh(Number.MAX_VALUE)) == 710
|
|
// Tor Browser bug: Math.acosh(Infinity) -> NaN
|
|
&& $acosh(Infinity) == Infinity
|
|
), 'Math', {
|
|
acosh: function acosh(x){
|
|
return (x = +x) < 1 ? NaN : x > 94906265.62425156
|
|
? Math.log(x) + Math.LN2
|
|
: log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
|
|
}
|
|
});
|
|
},{"./_export":38,"./_math-log1p":66}],157:[function(require,module,exports){
|
|
// 20.2.2.5 Math.asinh(x)
|
|
var $export = require('./_export')
|
|
, $asinh = Math.asinh;
|
|
|
|
function asinh(x){
|
|
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
|
|
}
|
|
|
|
// Tor Browser bug: Math.asinh(0) -> -0
|
|
$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh});
|
|
},{"./_export":38}],158:[function(require,module,exports){
|
|
// 20.2.2.7 Math.atanh(x)
|
|
var $export = require('./_export')
|
|
, $atanh = Math.atanh;
|
|
|
|
// Tor Browser bug: Math.atanh(-0) -> 0
|
|
$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
|
|
atanh: function atanh(x){
|
|
return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
|
|
}
|
|
});
|
|
},{"./_export":38}],159:[function(require,module,exports){
|
|
// 20.2.2.9 Math.cbrt(x)
|
|
var $export = require('./_export')
|
|
, sign = require('./_math-sign');
|
|
|
|
$export($export.S, 'Math', {
|
|
cbrt: function cbrt(x){
|
|
return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_math-sign":67}],160:[function(require,module,exports){
|
|
// 20.2.2.11 Math.clz32(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
clz32: function clz32(x){
|
|
return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
|
|
}
|
|
});
|
|
},{"./_export":38}],161:[function(require,module,exports){
|
|
// 20.2.2.12 Math.cosh(x)
|
|
var $export = require('./_export')
|
|
, exp = Math.exp;
|
|
|
|
$export($export.S, 'Math', {
|
|
cosh: function cosh(x){
|
|
return (exp(x = +x) + exp(-x)) / 2;
|
|
}
|
|
});
|
|
},{"./_export":38}],162:[function(require,module,exports){
|
|
// 20.2.2.14 Math.expm1(x)
|
|
var $export = require('./_export')
|
|
, $expm1 = require('./_math-expm1');
|
|
|
|
$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1});
|
|
},{"./_export":38,"./_math-expm1":65}],163:[function(require,module,exports){
|
|
// 20.2.2.16 Math.fround(x)
|
|
var $export = require('./_export')
|
|
, sign = require('./_math-sign')
|
|
, pow = Math.pow
|
|
, EPSILON = pow(2, -52)
|
|
, EPSILON32 = pow(2, -23)
|
|
, MAX32 = pow(2, 127) * (2 - EPSILON32)
|
|
, MIN32 = pow(2, -126);
|
|
|
|
var roundTiesToEven = function(n){
|
|
return n + 1 / EPSILON - 1 / EPSILON;
|
|
};
|
|
|
|
|
|
$export($export.S, 'Math', {
|
|
fround: function fround(x){
|
|
var $abs = Math.abs(x)
|
|
, $sign = sign(x)
|
|
, a, result;
|
|
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
|
|
a = (1 + EPSILON32 / EPSILON) * $abs;
|
|
result = a - (a - $abs);
|
|
if(result > MAX32 || result != result)return $sign * Infinity;
|
|
return $sign * result;
|
|
}
|
|
});
|
|
},{"./_export":38,"./_math-sign":67}],164:[function(require,module,exports){
|
|
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
|
|
var $export = require('./_export')
|
|
, abs = Math.abs;
|
|
|
|
$export($export.S, 'Math', {
|
|
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
|
|
var sum = 0
|
|
, i = 0
|
|
, aLen = arguments.length
|
|
, larg = 0
|
|
, arg, div;
|
|
while(i < aLen){
|
|
arg = abs(arguments[i++]);
|
|
if(larg < arg){
|
|
div = larg / arg;
|
|
sum = sum * div * div + 1;
|
|
larg = arg;
|
|
} else if(arg > 0){
|
|
div = arg / larg;
|
|
sum += div * div;
|
|
} else sum += arg;
|
|
}
|
|
return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
|
|
}
|
|
});
|
|
},{"./_export":38}],165:[function(require,module,exports){
|
|
// 20.2.2.18 Math.imul(x, y)
|
|
var $export = require('./_export')
|
|
, $imul = Math.imul;
|
|
|
|
// some WebKit versions fails with big numbers, some has wrong arity
|
|
$export($export.S + $export.F * require('./_fails')(function(){
|
|
return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
|
|
}), 'Math', {
|
|
imul: function imul(x, y){
|
|
var UINT16 = 0xffff
|
|
, xn = +x
|
|
, yn = +y
|
|
, xl = UINT16 & xn
|
|
, yl = UINT16 & yn;
|
|
return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails":40}],166:[function(require,module,exports){
|
|
// 20.2.2.21 Math.log10(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
log10: function log10(x){
|
|
return Math.log(x) / Math.LN10;
|
|
}
|
|
});
|
|
},{"./_export":38}],167:[function(require,module,exports){
|
|
// 20.2.2.20 Math.log1p(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {log1p: require('./_math-log1p')});
|
|
},{"./_export":38,"./_math-log1p":66}],168:[function(require,module,exports){
|
|
// 20.2.2.22 Math.log2(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
log2: function log2(x){
|
|
return Math.log(x) / Math.LN2;
|
|
}
|
|
});
|
|
},{"./_export":38}],169:[function(require,module,exports){
|
|
// 20.2.2.28 Math.sign(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {sign: require('./_math-sign')});
|
|
},{"./_export":38,"./_math-sign":67}],170:[function(require,module,exports){
|
|
// 20.2.2.30 Math.sinh(x)
|
|
var $export = require('./_export')
|
|
, expm1 = require('./_math-expm1')
|
|
, exp = Math.exp;
|
|
|
|
// V8 near Chromium 38 has a problem with very small numbers
|
|
$export($export.S + $export.F * require('./_fails')(function(){
|
|
return !Math.sinh(-2e-17) != -2e-17;
|
|
}), 'Math', {
|
|
sinh: function sinh(x){
|
|
return Math.abs(x = +x) < 1
|
|
? (expm1(x) - expm1(-x)) / 2
|
|
: (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails":40,"./_math-expm1":65}],171:[function(require,module,exports){
|
|
// 20.2.2.33 Math.tanh(x)
|
|
var $export = require('./_export')
|
|
, expm1 = require('./_math-expm1')
|
|
, exp = Math.exp;
|
|
|
|
$export($export.S, 'Math', {
|
|
tanh: function tanh(x){
|
|
var a = expm1(x = +x)
|
|
, b = expm1(-x);
|
|
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
|
|
}
|
|
});
|
|
},{"./_export":38,"./_math-expm1":65}],172:[function(require,module,exports){
|
|
// 20.2.2.34 Math.trunc(x)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
trunc: function trunc(it){
|
|
return (it > 0 ? Math.floor : Math.ceil)(it);
|
|
}
|
|
});
|
|
},{"./_export":38}],173:[function(require,module,exports){
|
|
'use strict';
|
|
var global = require('./_global')
|
|
, has = require('./_has')
|
|
, cof = require('./_cof')
|
|
, inheritIfRequired = require('./_inherit-if-required')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, fails = require('./_fails')
|
|
, gOPN = require('./_object-gopn').f
|
|
, gOPD = require('./_object-gopd').f
|
|
, dP = require('./_object-dp').f
|
|
, $trim = require('./_string-trim').trim
|
|
, NUMBER = 'Number'
|
|
, $Number = global[NUMBER]
|
|
, Base = $Number
|
|
, proto = $Number.prototype
|
|
// Opera ~12 has broken Object#toString
|
|
, BROKEN_COF = cof(require('./_object-create')(proto)) == NUMBER
|
|
, TRIM = 'trim' in String.prototype;
|
|
|
|
// 7.1.3 ToNumber(argument)
|
|
var toNumber = function(argument){
|
|
var it = toPrimitive(argument, false);
|
|
if(typeof it == 'string' && it.length > 2){
|
|
it = TRIM ? it.trim() : $trim(it, 3);
|
|
var first = it.charCodeAt(0)
|
|
, third, radix, maxCode;
|
|
if(first === 43 || first === 45){
|
|
third = it.charCodeAt(2);
|
|
if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
|
|
} else if(first === 48){
|
|
switch(it.charCodeAt(1)){
|
|
case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
|
|
case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
|
|
default : return +it;
|
|
}
|
|
for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
|
|
code = digits.charCodeAt(i);
|
|
// parseInt parses a string to a first unavailable symbol
|
|
// but ToNumber should return NaN if a string contains unavailable symbols
|
|
if(code < 48 || code > maxCode)return NaN;
|
|
} return parseInt(digits, radix);
|
|
}
|
|
} return +it;
|
|
};
|
|
|
|
if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
|
|
$Number = function Number(value){
|
|
var it = arguments.length < 1 ? 0 : value
|
|
, that = this;
|
|
return that instanceof $Number
|
|
// check on 1..constructor(foo) case
|
|
&& (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
|
|
? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
|
|
};
|
|
for(var keys = require('./_descriptors') ? gOPN(Base) : (
|
|
// ES3:
|
|
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
|
// ES6 (in case, if modules with ES6 Number statics required before):
|
|
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
|
|
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
|
|
).split(','), j = 0, key; keys.length > j; j++){
|
|
if(has(Base, key = keys[j]) && !has($Number, key)){
|
|
dP($Number, key, gOPD(Base, key));
|
|
}
|
|
}
|
|
$Number.prototype = proto;
|
|
proto.constructor = $Number;
|
|
require('./_redefine')(global, NUMBER, $Number);
|
|
}
|
|
},{"./_cof":24,"./_descriptors":34,"./_fails":40,"./_global":44,"./_has":45,"./_inherit-if-required":49,"./_object-create":72,"./_object-dp":73,"./_object-gopd":76,"./_object-gopn":78,"./_redefine":93,"./_string-trim":108,"./_to-primitive":116}],174:[function(require,module,exports){
|
|
// 20.1.2.1 Number.EPSILON
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
|
|
},{"./_export":38}],175:[function(require,module,exports){
|
|
// 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":38,"./_global":44}],176:[function(require,module,exports){
|
|
// 20.1.2.3 Number.isInteger(number)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Number', {isInteger: require('./_is-integer')});
|
|
},{"./_export":38,"./_is-integer":54}],177:[function(require,module,exports){
|
|
// 20.1.2.4 Number.isNaN(number)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Number', {
|
|
isNaN: function isNaN(number){
|
|
return number != number;
|
|
}
|
|
});
|
|
},{"./_export":38}],178:[function(require,module,exports){
|
|
// 20.1.2.5 Number.isSafeInteger(number)
|
|
var $export = require('./_export')
|
|
, isInteger = require('./_is-integer')
|
|
, abs = Math.abs;
|
|
|
|
$export($export.S, 'Number', {
|
|
isSafeInteger: function isSafeInteger(number){
|
|
return isInteger(number) && abs(number) <= 0x1fffffffffffff;
|
|
}
|
|
});
|
|
},{"./_export":38,"./_is-integer":54}],179:[function(require,module,exports){
|
|
// 20.1.2.6 Number.MAX_SAFE_INTEGER
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
|
|
},{"./_export":38}],180:[function(require,module,exports){
|
|
// 20.1.2.10 Number.MIN_SAFE_INTEGER
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
|
|
},{"./_export":38}],181:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, $parseFloat = require('./_parse-float');
|
|
// 20.1.2.12 Number.parseFloat(string)
|
|
$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat});
|
|
},{"./_export":38,"./_parse-float":87}],182:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, $parseInt = require('./_parse-int');
|
|
// 20.1.2.13 Number.parseInt(string, radix)
|
|
$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt});
|
|
},{"./_export":38,"./_parse-int":88}],183:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toInteger = require('./_to-integer')
|
|
, aNumberValue = require('./_a-number-value')
|
|
, repeat = require('./_string-repeat')
|
|
, $toFixed = 1..toFixed
|
|
, floor = Math.floor
|
|
, data = [0, 0, 0, 0, 0, 0]
|
|
, ERROR = 'Number.toFixed: incorrect invocation!'
|
|
, ZERO = '0';
|
|
|
|
var multiply = function(n, c){
|
|
var i = -1
|
|
, c2 = c;
|
|
while(++i < 6){
|
|
c2 += n * data[i];
|
|
data[i] = c2 % 1e7;
|
|
c2 = floor(c2 / 1e7);
|
|
}
|
|
};
|
|
var divide = function(n){
|
|
var i = 6
|
|
, c = 0;
|
|
while(--i >= 0){
|
|
c += data[i];
|
|
data[i] = floor(c / n);
|
|
c = (c % n) * 1e7;
|
|
}
|
|
};
|
|
var numToString = function(){
|
|
var i = 6
|
|
, s = '';
|
|
while(--i >= 0){
|
|
if(s !== '' || i === 0 || data[i] !== 0){
|
|
var t = String(data[i]);
|
|
s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
|
|
}
|
|
} return s;
|
|
};
|
|
var pow = function(x, n, acc){
|
|
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
};
|
|
var log = function(x){
|
|
var n = 0
|
|
, x2 = x;
|
|
while(x2 >= 4096){
|
|
n += 12;
|
|
x2 /= 4096;
|
|
}
|
|
while(x2 >= 2){
|
|
n += 1;
|
|
x2 /= 2;
|
|
} return n;
|
|
};
|
|
|
|
$export($export.P + $export.F * (!!$toFixed && (
|
|
0.00008.toFixed(3) !== '0.000' ||
|
|
0.9.toFixed(0) !== '1' ||
|
|
1.255.toFixed(2) !== '1.25' ||
|
|
1000000000000000128..toFixed(0) !== '1000000000000000128'
|
|
) || !require('./_fails')(function(){
|
|
// V8 ~ Android 4.3-
|
|
$toFixed.call({});
|
|
})), 'Number', {
|
|
toFixed: function toFixed(fractionDigits){
|
|
var x = aNumberValue(this, ERROR)
|
|
, f = toInteger(fractionDigits)
|
|
, s = ''
|
|
, m = ZERO
|
|
, e, z, j, k;
|
|
if(f < 0 || f > 20)throw RangeError(ERROR);
|
|
if(x != x)return 'NaN';
|
|
if(x <= -1e21 || x >= 1e21)return String(x);
|
|
if(x < 0){
|
|
s = '-';
|
|
x = -x;
|
|
}
|
|
if(x > 1e-21){
|
|
e = log(x * pow(2, 69, 1)) - 69;
|
|
z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
|
|
z *= 0x10000000000000;
|
|
e = 52 - e;
|
|
if(e > 0){
|
|
multiply(0, z);
|
|
j = f;
|
|
while(j >= 7){
|
|
multiply(1e7, 0);
|
|
j -= 7;
|
|
}
|
|
multiply(pow(10, j, 1), 0);
|
|
j = e - 1;
|
|
while(j >= 23){
|
|
divide(1 << 23);
|
|
j -= 23;
|
|
}
|
|
divide(1 << j);
|
|
multiply(1, 1);
|
|
divide(2);
|
|
m = numToString();
|
|
} else {
|
|
multiply(0, z);
|
|
multiply(1 << -e, 0);
|
|
m = numToString() + repeat.call(ZERO, f);
|
|
}
|
|
}
|
|
if(f > 0){
|
|
k = m.length;
|
|
m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
|
|
} else {
|
|
m = s + m;
|
|
} return m;
|
|
}
|
|
});
|
|
},{"./_a-number-value":10,"./_export":38,"./_fails":40,"./_string-repeat":107,"./_to-integer":112}],184:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $fails = require('./_fails')
|
|
, aNumberValue = require('./_a-number-value')
|
|
, $toPrecision = 1..toPrecision;
|
|
|
|
$export($export.P + $export.F * ($fails(function(){
|
|
// IE7-
|
|
return $toPrecision.call(1, undefined) !== '1';
|
|
}) || !$fails(function(){
|
|
// V8 ~ Android 4.3-
|
|
$toPrecision.call({});
|
|
})), 'Number', {
|
|
toPrecision: function toPrecision(precision){
|
|
var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
|
|
return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
|
|
}
|
|
});
|
|
},{"./_a-number-value":10,"./_export":38,"./_fails":40}],185:[function(require,module,exports){
|
|
// 19.1.3.1 Object.assign(target, source)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S + $export.F, 'Object', {assign: require('./_object-assign')});
|
|
},{"./_export":38,"./_object-assign":71}],186:[function(require,module,exports){
|
|
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":38,"./_object-create":72}],187:[function(require,module,exports){
|
|
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":34,"./_export":38,"./_object-dps":74}],188:[function(require,module,exports){
|
|
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":34,"./_export":38,"./_object-dp":73}],189:[function(require,module,exports){
|
|
// 19.1.2.5 Object.freeze(O)
|
|
var isObject = require('./_is-object')
|
|
, meta = require('./_meta').onFreeze;
|
|
|
|
require('./_object-sap')('freeze', function($freeze){
|
|
return function freeze(it){
|
|
return $freeze && isObject(it) ? $freeze(meta(it)) : it;
|
|
};
|
|
});
|
|
},{"./_is-object":55,"./_meta":68,"./_object-sap":84}],190:[function(require,module,exports){
|
|
// 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":76,"./_object-sap":84,"./_to-iobject":113}],191:[function(require,module,exports){
|
|
// 19.1.2.7 Object.getOwnPropertyNames(O)
|
|
require('./_object-sap')('getOwnPropertyNames', function(){
|
|
return require('./_object-gopn-ext').f;
|
|
});
|
|
},{"./_object-gopn-ext":77,"./_object-sap":84}],192:[function(require,module,exports){
|
|
// 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":80,"./_object-sap":84,"./_to-object":115}],193:[function(require,module,exports){
|
|
// 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":55,"./_object-sap":84}],194:[function(require,module,exports){
|
|
// 19.1.2.12 Object.isFrozen(O)
|
|
var isObject = require('./_is-object');
|
|
|
|
require('./_object-sap')('isFrozen', function($isFrozen){
|
|
return function isFrozen(it){
|
|
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
|
|
};
|
|
});
|
|
},{"./_is-object":55,"./_object-sap":84}],195:[function(require,module,exports){
|
|
// 19.1.2.13 Object.isSealed(O)
|
|
var isObject = require('./_is-object');
|
|
|
|
require('./_object-sap')('isSealed', function($isSealed){
|
|
return function isSealed(it){
|
|
return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
|
|
};
|
|
});
|
|
},{"./_is-object":55,"./_object-sap":84}],196:[function(require,module,exports){
|
|
// 19.1.3.10 Object.is(value1, value2)
|
|
var $export = require('./_export');
|
|
$export($export.S, 'Object', {is: require('./_same-value')});
|
|
},{"./_export":38,"./_same-value":95}],197:[function(require,module,exports){
|
|
// 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":82,"./_object-sap":84,"./_to-object":115}],198:[function(require,module,exports){
|
|
// 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":55,"./_meta":68,"./_object-sap":84}],199:[function(require,module,exports){
|
|
// 19.1.2.17 Object.seal(O)
|
|
var isObject = require('./_is-object')
|
|
, meta = require('./_meta').onFreeze;
|
|
|
|
require('./_object-sap')('seal', function($seal){
|
|
return function seal(it){
|
|
return $seal && isObject(it) ? $seal(meta(it)) : it;
|
|
};
|
|
});
|
|
},{"./_is-object":55,"./_meta":68,"./_object-sap":84}],200:[function(require,module,exports){
|
|
// 19.1.3.19 Object.setPrototypeOf(O, proto)
|
|
var $export = require('./_export');
|
|
$export($export.S, 'Object', {setPrototypeOf: require('./_set-proto').set});
|
|
},{"./_export":38,"./_set-proto":96}],201:[function(require,module,exports){
|
|
'use strict';
|
|
// 19.1.3.6 Object.prototype.toString()
|
|
var classof = require('./_classof')
|
|
, test = {};
|
|
test[require('./_wks')('toStringTag')] = 'z';
|
|
if(test + '' != '[object z]'){
|
|
require('./_redefine')(Object.prototype, 'toString', function toString(){
|
|
return '[object ' + classof(this) + ']';
|
|
}, true);
|
|
}
|
|
},{"./_classof":23,"./_redefine":93,"./_wks":123}],202:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, $parseFloat = require('./_parse-float');
|
|
// 18.2.4 parseFloat(string)
|
|
$export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat});
|
|
},{"./_export":38,"./_parse-float":87}],203:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, $parseInt = require('./_parse-int');
|
|
// 18.2.5 parseInt(string, radix)
|
|
$export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt});
|
|
},{"./_export":38,"./_parse-int":88}],204:[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 */ }
|
|
, 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(a, b){
|
|
// with library wrapper special case
|
|
return a === b || a === $Promise && b === Wrapper;
|
|
};
|
|
var isThenable = function(it){
|
|
var then;
|
|
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
|
|
};
|
|
var newPromiseCapability = function(C){
|
|
return sameConstructor($Promise, C)
|
|
? new PromiseCapability(C)
|
|
: new GenericPromiseCapability(C);
|
|
};
|
|
var PromiseCapability = GenericPromiseCapability = function(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(exec){
|
|
try {
|
|
exec();
|
|
} catch(e){
|
|
return {error: e};
|
|
}
|
|
};
|
|
var notify = function(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(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(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(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(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(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(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(onRejected){
|
|
return this.then(undefined, onRejected);
|
|
}
|
|
});
|
|
PromiseCapability = function(){
|
|
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":9,"./_an-instance":12,"./_classof":23,"./_core":29,"./_ctx":31,"./_export":38,"./_for-of":43,"./_global":44,"./_is-object":55,"./_iter-detect":60,"./_library":64,"./_microtask":70,"./_redefine-all":92,"./_set-species":97,"./_set-to-string-tag":98,"./_species-constructor":101,"./_task":110,"./_wks":123}],205:[function(require,module,exports){
|
|
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
|
|
var $export = require('./_export')
|
|
, aFunction = require('./_a-function')
|
|
, anObject = require('./_an-object')
|
|
, rApply = (require('./_global').Reflect || {}).apply
|
|
, fApply = Function.apply;
|
|
// MS Edge argumentsList argument is optional
|
|
$export($export.S + $export.F * !require('./_fails')(function(){
|
|
rApply(function(){});
|
|
}), 'Reflect', {
|
|
apply: function apply(target, thisArgument, argumentsList){
|
|
var T = aFunction(target)
|
|
, L = anObject(argumentsList);
|
|
return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
|
|
}
|
|
});
|
|
},{"./_a-function":9,"./_an-object":13,"./_export":38,"./_fails":40,"./_global":44}],206:[function(require,module,exports){
|
|
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
|
|
var $export = require('./_export')
|
|
, create = require('./_object-create')
|
|
, aFunction = require('./_a-function')
|
|
, anObject = require('./_an-object')
|
|
, isObject = require('./_is-object')
|
|
, fails = require('./_fails')
|
|
, bind = require('./_bind')
|
|
, rConstruct = (require('./_global').Reflect || {}).construct;
|
|
|
|
// MS Edge supports only 2 arguments and argumentsList argument is optional
|
|
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
|
|
var NEW_TARGET_BUG = fails(function(){
|
|
function F(){}
|
|
return !(rConstruct(function(){}, [], F) instanceof F);
|
|
});
|
|
var ARGS_BUG = !fails(function(){
|
|
rConstruct(function(){});
|
|
});
|
|
|
|
$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
|
|
construct: function construct(Target, args /*, newTarget*/){
|
|
aFunction(Target);
|
|
anObject(args);
|
|
var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
|
|
if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget);
|
|
if(Target == newTarget){
|
|
// w/o altered newTarget, optimization for 0-4 arguments
|
|
switch(args.length){
|
|
case 0: return new Target;
|
|
case 1: return new Target(args[0]);
|
|
case 2: return new Target(args[0], args[1]);
|
|
case 3: return new Target(args[0], args[1], args[2]);
|
|
case 4: return new Target(args[0], args[1], args[2], args[3]);
|
|
}
|
|
// w/o altered newTarget, lot of arguments case
|
|
var $args = [null];
|
|
$args.push.apply($args, args);
|
|
return new (bind.apply(Target, $args));
|
|
}
|
|
// with altered newTarget, not support built-in constructors
|
|
var proto = newTarget.prototype
|
|
, instance = create(isObject(proto) ? proto : Object.prototype)
|
|
, result = Function.apply.call(Target, instance, args);
|
|
return isObject(result) ? result : instance;
|
|
}
|
|
});
|
|
},{"./_a-function":9,"./_an-object":13,"./_bind":22,"./_export":38,"./_fails":40,"./_global":44,"./_is-object":55,"./_object-create":72}],207:[function(require,module,exports){
|
|
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
|
|
var dP = require('./_object-dp')
|
|
, $export = require('./_export')
|
|
, anObject = require('./_an-object')
|
|
, toPrimitive = require('./_to-primitive');
|
|
|
|
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
|
|
$export($export.S + $export.F * require('./_fails')(function(){
|
|
Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2});
|
|
}), 'Reflect', {
|
|
defineProperty: function defineProperty(target, propertyKey, attributes){
|
|
anObject(target);
|
|
propertyKey = toPrimitive(propertyKey, true);
|
|
anObject(attributes);
|
|
try {
|
|
dP.f(target, propertyKey, attributes);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38,"./_fails":40,"./_object-dp":73,"./_to-primitive":116}],208:[function(require,module,exports){
|
|
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
|
|
var $export = require('./_export')
|
|
, gOPD = require('./_object-gopd').f
|
|
, anObject = require('./_an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
deleteProperty: function deleteProperty(target, propertyKey){
|
|
var desc = gOPD(anObject(target), propertyKey);
|
|
return desc && !desc.configurable ? false : delete target[propertyKey];
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38,"./_object-gopd":76}],209:[function(require,module,exports){
|
|
'use strict';
|
|
// 26.1.5 Reflect.enumerate(target)
|
|
var $export = require('./_export')
|
|
, anObject = require('./_an-object');
|
|
var Enumerate = function(iterated){
|
|
this._t = anObject(iterated); // target
|
|
this._i = 0; // next index
|
|
var keys = this._k = [] // keys
|
|
, key;
|
|
for(key in iterated)keys.push(key);
|
|
};
|
|
require('./_iter-create')(Enumerate, 'Object', function(){
|
|
var that = this
|
|
, keys = that._k
|
|
, key;
|
|
do {
|
|
if(that._i >= keys.length)return {value: undefined, done: true};
|
|
} while(!((key = keys[that._i++]) in that._t));
|
|
return {value: key, done: false};
|
|
});
|
|
|
|
$export($export.S, 'Reflect', {
|
|
enumerate: function enumerate(target){
|
|
return new Enumerate(target);
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38,"./_iter-create":58}],210:[function(require,module,exports){
|
|
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
|
|
var gOPD = require('./_object-gopd')
|
|
, $export = require('./_export')
|
|
, anObject = require('./_an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
|
|
return gOPD.f(anObject(target), propertyKey);
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38,"./_object-gopd":76}],211:[function(require,module,exports){
|
|
// 26.1.8 Reflect.getPrototypeOf(target)
|
|
var $export = require('./_export')
|
|
, getProto = require('./_object-gpo')
|
|
, anObject = require('./_an-object');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
getPrototypeOf: function getPrototypeOf(target){
|
|
return getProto(anObject(target));
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38,"./_object-gpo":80}],212:[function(require,module,exports){
|
|
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
|
|
var gOPD = require('./_object-gopd')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, has = require('./_has')
|
|
, $export = require('./_export')
|
|
, isObject = require('./_is-object')
|
|
, anObject = require('./_an-object');
|
|
|
|
function get(target, propertyKey/*, receiver*/){
|
|
var receiver = arguments.length < 3 ? target : arguments[2]
|
|
, desc, proto;
|
|
if(anObject(target) === receiver)return target[propertyKey];
|
|
if(desc = gOPD.f(target, propertyKey))return has(desc, 'value')
|
|
? desc.value
|
|
: desc.get !== undefined
|
|
? desc.get.call(receiver)
|
|
: undefined;
|
|
if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver);
|
|
}
|
|
|
|
$export($export.S, 'Reflect', {get: get});
|
|
},{"./_an-object":13,"./_export":38,"./_has":45,"./_is-object":55,"./_object-gopd":76,"./_object-gpo":80}],213:[function(require,module,exports){
|
|
// 26.1.9 Reflect.has(target, propertyKey)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Reflect', {
|
|
has: function has(target, propertyKey){
|
|
return propertyKey in target;
|
|
}
|
|
});
|
|
},{"./_export":38}],214:[function(require,module,exports){
|
|
// 26.1.10 Reflect.isExtensible(target)
|
|
var $export = require('./_export')
|
|
, anObject = require('./_an-object')
|
|
, $isExtensible = Object.isExtensible;
|
|
|
|
$export($export.S, 'Reflect', {
|
|
isExtensible: function isExtensible(target){
|
|
anObject(target);
|
|
return $isExtensible ? $isExtensible(target) : true;
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38}],215:[function(require,module,exports){
|
|
// 26.1.11 Reflect.ownKeys(target)
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Reflect', {ownKeys: require('./_own-keys')});
|
|
},{"./_export":38,"./_own-keys":86}],216:[function(require,module,exports){
|
|
// 26.1.12 Reflect.preventExtensions(target)
|
|
var $export = require('./_export')
|
|
, anObject = require('./_an-object')
|
|
, $preventExtensions = Object.preventExtensions;
|
|
|
|
$export($export.S, 'Reflect', {
|
|
preventExtensions: function preventExtensions(target){
|
|
anObject(target);
|
|
try {
|
|
if($preventExtensions)$preventExtensions(target);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./_an-object":13,"./_export":38}],217:[function(require,module,exports){
|
|
// 26.1.14 Reflect.setPrototypeOf(target, proto)
|
|
var $export = require('./_export')
|
|
, setProto = require('./_set-proto');
|
|
|
|
if(setProto)$export($export.S, 'Reflect', {
|
|
setPrototypeOf: function setPrototypeOf(target, proto){
|
|
setProto.check(target, proto);
|
|
try {
|
|
setProto.set(target, proto);
|
|
return true;
|
|
} catch(e){
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
},{"./_export":38,"./_set-proto":96}],218:[function(require,module,exports){
|
|
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
|
|
var dP = require('./_object-dp')
|
|
, gOPD = require('./_object-gopd')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, has = require('./_has')
|
|
, $export = require('./_export')
|
|
, createDesc = require('./_property-desc')
|
|
, anObject = require('./_an-object')
|
|
, isObject = require('./_is-object');
|
|
|
|
function set(target, propertyKey, V/*, receiver*/){
|
|
var receiver = arguments.length < 4 ? target : arguments[3]
|
|
, ownDesc = gOPD.f(anObject(target), propertyKey)
|
|
, existingDescriptor, proto;
|
|
if(!ownDesc){
|
|
if(isObject(proto = getPrototypeOf(target))){
|
|
return set(proto, propertyKey, V, receiver);
|
|
}
|
|
ownDesc = createDesc(0);
|
|
}
|
|
if(has(ownDesc, 'value')){
|
|
if(ownDesc.writable === false || !isObject(receiver))return false;
|
|
existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0);
|
|
existingDescriptor.value = V;
|
|
dP.f(receiver, propertyKey, existingDescriptor);
|
|
return true;
|
|
}
|
|
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
|
|
}
|
|
|
|
$export($export.S, 'Reflect', {set: set});
|
|
},{"./_an-object":13,"./_export":38,"./_has":45,"./_is-object":55,"./_object-dp":73,"./_object-gopd":76,"./_object-gpo":80,"./_property-desc":91}],219:[function(require,module,exports){
|
|
var global = require('./_global')
|
|
, inheritIfRequired = require('./_inherit-if-required')
|
|
, dP = require('./_object-dp').f
|
|
, gOPN = require('./_object-gopn').f
|
|
, isRegExp = require('./_is-regexp')
|
|
, $flags = require('./_flags')
|
|
, $RegExp = global.RegExp
|
|
, Base = $RegExp
|
|
, proto = $RegExp.prototype
|
|
, re1 = /a/g
|
|
, re2 = /a/g
|
|
// "new" creates a new object, old webkit buggy here
|
|
, CORRECT_NEW = new $RegExp(re1) !== re1;
|
|
|
|
if(require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function(){
|
|
re2[require('./_wks')('match')] = false;
|
|
// RegExp constructor can alter flags and IsRegExp works correct with @@match
|
|
return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
|
|
}))){
|
|
$RegExp = function RegExp(p, f){
|
|
var tiRE = this instanceof $RegExp
|
|
, piRE = isRegExp(p)
|
|
, fiU = f === undefined;
|
|
return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
|
|
: inheritIfRequired(CORRECT_NEW
|
|
? new Base(piRE && !fiU ? p.source : p, f)
|
|
: Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
|
|
, tiRE ? this : proto, $RegExp);
|
|
};
|
|
var proxy = function(key){
|
|
key in $RegExp || dP($RegExp, key, {
|
|
configurable: true,
|
|
get: function(){ return Base[key]; },
|
|
set: function(it){ Base[key] = it; }
|
|
});
|
|
};
|
|
for(var keys = gOPN(Base), i = 0; keys.length > i; )proxy(keys[i++]);
|
|
proto.constructor = $RegExp;
|
|
$RegExp.prototype = proto;
|
|
require('./_redefine')(global, 'RegExp', $RegExp);
|
|
}
|
|
|
|
require('./_set-species')('RegExp');
|
|
},{"./_descriptors":34,"./_fails":40,"./_flags":42,"./_global":44,"./_inherit-if-required":49,"./_is-regexp":56,"./_object-dp":73,"./_object-gopn":78,"./_redefine":93,"./_set-species":97,"./_wks":123}],220:[function(require,module,exports){
|
|
// 21.2.5.3 get RegExp.prototype.flags()
|
|
if(require('./_descriptors') && /./g.flags != 'g')require('./_object-dp').f(RegExp.prototype, 'flags', {
|
|
configurable: true,
|
|
get: require('./_flags')
|
|
});
|
|
},{"./_descriptors":34,"./_flags":42,"./_object-dp":73}],221:[function(require,module,exports){
|
|
// @@match logic
|
|
require('./_fix-re-wks')('match', 1, function(defined, MATCH, $match){
|
|
// 21.1.3.11 String.prototype.match(regexp)
|
|
return [function match(regexp){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = regexp == undefined ? undefined : regexp[MATCH];
|
|
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
|
|
}, $match];
|
|
});
|
|
},{"./_fix-re-wks":41}],222:[function(require,module,exports){
|
|
// @@replace logic
|
|
require('./_fix-re-wks')('replace', 2, function(defined, REPLACE, $replace){
|
|
// 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
|
|
return [function replace(searchValue, replaceValue){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = searchValue == undefined ? undefined : searchValue[REPLACE];
|
|
return fn !== undefined
|
|
? fn.call(searchValue, O, replaceValue)
|
|
: $replace.call(String(O), searchValue, replaceValue);
|
|
}, $replace];
|
|
});
|
|
},{"./_fix-re-wks":41}],223:[function(require,module,exports){
|
|
// @@search logic
|
|
require('./_fix-re-wks')('search', 1, function(defined, SEARCH, $search){
|
|
// 21.1.3.15 String.prototype.search(regexp)
|
|
return [function search(regexp){
|
|
'use strict';
|
|
var O = defined(this)
|
|
, fn = regexp == undefined ? undefined : regexp[SEARCH];
|
|
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
|
|
}, $search];
|
|
});
|
|
},{"./_fix-re-wks":41}],224:[function(require,module,exports){
|
|
// @@split logic
|
|
require('./_fix-re-wks')('split', 2, function(defined, SPLIT, $split){
|
|
'use strict';
|
|
var isRegExp = require('./_is-regexp')
|
|
, _split = $split
|
|
, $push = [].push
|
|
, $SPLIT = 'split'
|
|
, LENGTH = 'length'
|
|
, LAST_INDEX = 'lastIndex';
|
|
if(
|
|
'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||
|
|
'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||
|
|
'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||
|
|
'.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||
|
|
'.'[$SPLIT](/()()/)[LENGTH] > 1 ||
|
|
''[$SPLIT](/.?/)[LENGTH]
|
|
){
|
|
var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group
|
|
// based on es5-shim implementation, need to rework it
|
|
$split = function(separator, limit){
|
|
var string = String(this);
|
|
if(separator === undefined && limit === 0)return [];
|
|
// If `separator` is not a regex, use native split
|
|
if(!isRegExp(separator))return _split.call(string, separator, limit);
|
|
var output = [];
|
|
var flags = (separator.ignoreCase ? 'i' : '') +
|
|
(separator.multiline ? 'm' : '') +
|
|
(separator.unicode ? 'u' : '') +
|
|
(separator.sticky ? 'y' : '');
|
|
var lastLastIndex = 0;
|
|
var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;
|
|
// Make `global` and avoid `lastIndex` issues by working with a copy
|
|
var separatorCopy = new RegExp(separator.source, flags + 'g');
|
|
var separator2, match, lastIndex, lastLength, i;
|
|
// Doesn't need flags gy, but they don't hurt
|
|
if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
|
|
while(match = separatorCopy.exec(string)){
|
|
// `separatorCopy.lastIndex` is not reliable cross-browser
|
|
lastIndex = match.index + match[0][LENGTH];
|
|
if(lastIndex > lastLastIndex){
|
|
output.push(string.slice(lastLastIndex, match.index));
|
|
// Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
|
|
if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){
|
|
for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined;
|
|
});
|
|
if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1));
|
|
lastLength = match[0][LENGTH];
|
|
lastLastIndex = lastIndex;
|
|
if(output[LENGTH] >= splitLimit)break;
|
|
}
|
|
if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
|
|
}
|
|
if(lastLastIndex === string[LENGTH]){
|
|
if(lastLength || !separatorCopy.test(''))output.push('');
|
|
} else output.push(string.slice(lastLastIndex));
|
|
return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
|
|
};
|
|
// Chakra, V8
|
|
} else if('0'[$SPLIT](undefined, 0)[LENGTH]){
|
|
$split = function(separator, limit){
|
|
return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);
|
|
};
|
|
}
|
|
// 21.1.3.17 String.prototype.split(separator, limit)
|
|
return [function split(separator, limit){
|
|
var O = defined(this)
|
|
, fn = separator == undefined ? undefined : separator[SPLIT];
|
|
return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);
|
|
}, $split];
|
|
});
|
|
},{"./_fix-re-wks":41,"./_is-regexp":56}],225:[function(require,module,exports){
|
|
'use strict';
|
|
require('./es6.regexp.flags');
|
|
var anObject = require('./_an-object')
|
|
, $flags = require('./_flags')
|
|
, DESCRIPTORS = require('./_descriptors')
|
|
, TO_STRING = 'toString'
|
|
, $toString = /./[TO_STRING];
|
|
|
|
var define = function(fn){
|
|
require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);
|
|
};
|
|
|
|
// 21.2.5.14 RegExp.prototype.toString()
|
|
if(require('./_fails')(function(){ return $toString.call({source: 'a', flags: 'b'}) != '/a/b'; })){
|
|
define(function toString(){
|
|
var R = anObject(this);
|
|
return '/'.concat(R.source, '/',
|
|
'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
|
|
});
|
|
// FF44- RegExp#toString has a wrong name
|
|
} else if($toString.name != TO_STRING){
|
|
define(function toString(){
|
|
return $toString.call(this);
|
|
});
|
|
}
|
|
},{"./_an-object":13,"./_descriptors":34,"./_fails":40,"./_flags":42,"./_redefine":93,"./es6.regexp.flags":220}],226:[function(require,module,exports){
|
|
'use strict';
|
|
var strong = require('./_collection-strong');
|
|
|
|
// 23.2 Set Objects
|
|
module.exports = require('./_collection')('Set', function(get){
|
|
return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.2.3.1 Set.prototype.add(value)
|
|
add: function add(value){
|
|
return strong.def(this, value = value === 0 ? 0 : value, value);
|
|
}
|
|
}, strong);
|
|
},{"./_collection":28,"./_collection-strong":25}],227:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.2 String.prototype.anchor(name)
|
|
require('./_string-html')('anchor', function(createHTML){
|
|
return function anchor(name){
|
|
return createHTML(this, 'a', 'name', name);
|
|
}
|
|
});
|
|
},{"./_string-html":105}],228:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.3 String.prototype.big()
|
|
require('./_string-html')('big', function(createHTML){
|
|
return function big(){
|
|
return createHTML(this, 'big', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],229:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.4 String.prototype.blink()
|
|
require('./_string-html')('blink', function(createHTML){
|
|
return function blink(){
|
|
return createHTML(this, 'blink', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],230:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.5 String.prototype.bold()
|
|
require('./_string-html')('bold', function(createHTML){
|
|
return function bold(){
|
|
return createHTML(this, 'b', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],231:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $at = require('./_string-at')(false);
|
|
$export($export.P, 'String', {
|
|
// 21.1.3.3 String.prototype.codePointAt(pos)
|
|
codePointAt: function codePointAt(pos){
|
|
return $at(this, pos);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_string-at":103}],232:[function(require,module,exports){
|
|
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toLength = require('./_to-length')
|
|
, context = require('./_string-context')
|
|
, ENDS_WITH = 'endsWith'
|
|
, $endsWith = ''[ENDS_WITH];
|
|
|
|
$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', {
|
|
endsWith: function endsWith(searchString /*, endPosition = @length */){
|
|
var that = context(this, searchString, ENDS_WITH)
|
|
, endPosition = arguments.length > 1 ? arguments[1] : undefined
|
|
, len = toLength(that.length)
|
|
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
|
|
, search = String(searchString);
|
|
return $endsWith
|
|
? $endsWith.call(that, search, end)
|
|
: that.slice(end - search.length, end) === search;
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails-is-regexp":39,"./_string-context":104,"./_to-length":114}],233:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.6 String.prototype.fixed()
|
|
require('./_string-html')('fixed', function(createHTML){
|
|
return function fixed(){
|
|
return createHTML(this, 'tt', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],234:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.7 String.prototype.fontcolor(color)
|
|
require('./_string-html')('fontcolor', function(createHTML){
|
|
return function fontcolor(color){
|
|
return createHTML(this, 'font', 'color', color);
|
|
}
|
|
});
|
|
},{"./_string-html":105}],235:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.8 String.prototype.fontsize(size)
|
|
require('./_string-html')('fontsize', function(createHTML){
|
|
return function fontsize(size){
|
|
return createHTML(this, 'font', 'size', size);
|
|
}
|
|
});
|
|
},{"./_string-html":105}],236:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, toIndex = require('./_to-index')
|
|
, fromCharCode = String.fromCharCode
|
|
, $fromCodePoint = String.fromCodePoint;
|
|
|
|
// 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":38,"./_to-index":111}],237:[function(require,module,exports){
|
|
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, context = require('./_string-context')
|
|
, INCLUDES = 'includes';
|
|
|
|
$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', {
|
|
includes: function includes(searchString /*, position = 0 */){
|
|
return !!~context(this, searchString, INCLUDES)
|
|
.indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails-is-regexp":39,"./_string-context":104}],238:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.9 String.prototype.italics()
|
|
require('./_string-html')('italics', function(createHTML){
|
|
return function italics(){
|
|
return createHTML(this, 'i', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],239:[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":59,"./_string-at":103}],240:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.10 String.prototype.link(url)
|
|
require('./_string-html')('link', function(createHTML){
|
|
return function link(url){
|
|
return createHTML(this, 'a', 'href', url);
|
|
}
|
|
});
|
|
},{"./_string-html":105}],241:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, toIObject = require('./_to-iobject')
|
|
, toLength = require('./_to-length');
|
|
|
|
$export($export.S, 'String', {
|
|
// 21.1.2.4 String.raw(callSite, ...substitutions)
|
|
raw: function raw(callSite){
|
|
var tpl = toIObject(callSite.raw)
|
|
, len = toLength(tpl.length)
|
|
, aLen = arguments.length
|
|
, res = []
|
|
, i = 0;
|
|
while(len > i){
|
|
res.push(String(tpl[i++]));
|
|
if(i < aLen)res.push(String(arguments[i]));
|
|
} return res.join('');
|
|
}
|
|
});
|
|
},{"./_export":38,"./_to-iobject":113,"./_to-length":114}],242:[function(require,module,exports){
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P, 'String', {
|
|
// 21.1.3.13 String.prototype.repeat(count)
|
|
repeat: require('./_string-repeat')
|
|
});
|
|
},{"./_export":38,"./_string-repeat":107}],243:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.11 String.prototype.small()
|
|
require('./_string-html')('small', function(createHTML){
|
|
return function small(){
|
|
return createHTML(this, 'small', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],244:[function(require,module,exports){
|
|
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toLength = require('./_to-length')
|
|
, context = require('./_string-context')
|
|
, STARTS_WITH = 'startsWith'
|
|
, $startsWith = ''[STARTS_WITH];
|
|
|
|
$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', {
|
|
startsWith: function startsWith(searchString /*, position = 0 */){
|
|
var that = context(this, searchString, STARTS_WITH)
|
|
, index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length))
|
|
, search = String(searchString);
|
|
return $startsWith
|
|
? $startsWith.call(that, search, index)
|
|
: that.slice(index, index + search.length) === search;
|
|
}
|
|
});
|
|
},{"./_export":38,"./_fails-is-regexp":39,"./_string-context":104,"./_to-length":114}],245:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.12 String.prototype.strike()
|
|
require('./_string-html')('strike', function(createHTML){
|
|
return function strike(){
|
|
return createHTML(this, 'strike', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],246:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.13 String.prototype.sub()
|
|
require('./_string-html')('sub', function(createHTML){
|
|
return function sub(){
|
|
return createHTML(this, 'sub', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],247:[function(require,module,exports){
|
|
'use strict';
|
|
// B.2.3.14 String.prototype.sup()
|
|
require('./_string-html')('sup', function(createHTML){
|
|
return function sup(){
|
|
return createHTML(this, 'sup', '', '');
|
|
}
|
|
});
|
|
},{"./_string-html":105}],248:[function(require,module,exports){
|
|
'use strict';
|
|
// 21.1.3.25 String.prototype.trim()
|
|
require('./_string-trim')('trim', function($trim){
|
|
return function trim(){
|
|
return $trim(this, 3);
|
|
};
|
|
});
|
|
},{"./_string-trim":108}],249:[function(require,module,exports){
|
|
'use strict';
|
|
// ECMAScript 6 symbols shim
|
|
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(){ 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(tag){
|
|
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
|
|
sym._k = tag;
|
|
return sym;
|
|
};
|
|
|
|
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
|
|
return typeof 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(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(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(){ setter = true; },
|
|
useSimple: function(){ 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(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":13,"./_descriptors":34,"./_enum-keys":37,"./_export":38,"./_fails":40,"./_global":44,"./_has":45,"./_hide":46,"./_is-array":53,"./_keyof":63,"./_library":64,"./_meta":68,"./_object-create":72,"./_object-dp":73,"./_object-gopd":76,"./_object-gopn":78,"./_object-gopn-ext":77,"./_object-gops":79,"./_object-keys":82,"./_object-pie":83,"./_property-desc":91,"./_redefine":93,"./_set-to-string-tag":98,"./_shared":100,"./_to-iobject":113,"./_to-primitive":116,"./_uid":120,"./_wks":123,"./_wks-define":121,"./_wks-ext":122}],250:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, $typed = require('./_typed')
|
|
, buffer = require('./_typed-buffer')
|
|
, anObject = require('./_an-object')
|
|
, toIndex = require('./_to-index')
|
|
, toLength = require('./_to-length')
|
|
, isObject = require('./_is-object')
|
|
, ArrayBuffer = require('./_global').ArrayBuffer
|
|
, speciesConstructor = require('./_species-constructor')
|
|
, $ArrayBuffer = buffer.ArrayBuffer
|
|
, $DataView = buffer.DataView
|
|
, $isView = $typed.ABV && ArrayBuffer.isView
|
|
, $slice = $ArrayBuffer.prototype.slice
|
|
, VIEW = $typed.VIEW
|
|
, ARRAY_BUFFER = 'ArrayBuffer';
|
|
|
|
$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer});
|
|
|
|
$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
|
|
// 24.1.3.1 ArrayBuffer.isView(arg)
|
|
isView: function isView(it){
|
|
return $isView && $isView(it) || isObject(it) && VIEW in it;
|
|
}
|
|
});
|
|
|
|
$export($export.P + $export.U + $export.F * require('./_fails')(function(){
|
|
return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
|
|
}), ARRAY_BUFFER, {
|
|
// 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
|
|
slice: function slice(start, end){
|
|
if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix
|
|
var len = anObject(this).byteLength
|
|
, first = toIndex(start, len)
|
|
, final = toIndex(end === undefined ? len : end, len)
|
|
, result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first))
|
|
, viewS = new $DataView(this)
|
|
, viewT = new $DataView(result)
|
|
, index = 0;
|
|
while(first < final){
|
|
viewT.setUint8(index++, viewS.getUint8(first++));
|
|
} return result;
|
|
}
|
|
});
|
|
|
|
require('./_set-species')(ARRAY_BUFFER);
|
|
},{"./_an-object":13,"./_export":38,"./_fails":40,"./_global":44,"./_is-object":55,"./_set-species":97,"./_species-constructor":101,"./_to-index":111,"./_to-length":114,"./_typed":119,"./_typed-buffer":118}],251:[function(require,module,exports){
|
|
var $export = require('./_export');
|
|
$export($export.G + $export.W + $export.F * !require('./_typed').ABV, {
|
|
DataView: require('./_typed-buffer').DataView
|
|
});
|
|
},{"./_export":38,"./_typed":119,"./_typed-buffer":118}],252:[function(require,module,exports){
|
|
require('./_typed-array')('Float32', 4, function(init){
|
|
return function Float32Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],253:[function(require,module,exports){
|
|
require('./_typed-array')('Float64', 8, function(init){
|
|
return function Float64Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],254:[function(require,module,exports){
|
|
require('./_typed-array')('Int16', 2, function(init){
|
|
return function Int16Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],255:[function(require,module,exports){
|
|
require('./_typed-array')('Int32', 4, function(init){
|
|
return function Int32Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],256:[function(require,module,exports){
|
|
require('./_typed-array')('Int8', 1, function(init){
|
|
return function Int8Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],257:[function(require,module,exports){
|
|
require('./_typed-array')('Uint16', 2, function(init){
|
|
return function Uint16Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],258:[function(require,module,exports){
|
|
require('./_typed-array')('Uint32', 4, function(init){
|
|
return function Uint32Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],259:[function(require,module,exports){
|
|
require('./_typed-array')('Uint8', 1, function(init){
|
|
return function Uint8Array(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
});
|
|
},{"./_typed-array":117}],260:[function(require,module,exports){
|
|
require('./_typed-array')('Uint8', 1, function(init){
|
|
return function Uint8ClampedArray(data, byteOffset, length){
|
|
return init(this, data, byteOffset, length);
|
|
};
|
|
}, true);
|
|
},{"./_typed-array":117}],261:[function(require,module,exports){
|
|
'use strict';
|
|
var each = require('./_array-methods')(0)
|
|
, redefine = require('./_redefine')
|
|
, meta = require('./_meta')
|
|
, assign = require('./_object-assign')
|
|
, weak = require('./_collection-weak')
|
|
, isObject = require('./_is-object')
|
|
, getWeak = meta.getWeak
|
|
, isExtensible = Object.isExtensible
|
|
, uncaughtFrozenStore = weak.ufstore
|
|
, tmp = {}
|
|
, InternalMap;
|
|
|
|
var wrapper = function(get){
|
|
return function WeakMap(){
|
|
return get(this, arguments.length > 0 ? arguments[0] : undefined);
|
|
};
|
|
};
|
|
|
|
var methods = {
|
|
// 23.3.3.3 WeakMap.prototype.get(key)
|
|
get: function get(key){
|
|
if(isObject(key)){
|
|
var data = getWeak(key);
|
|
if(data === true)return uncaughtFrozenStore(this).get(key);
|
|
return data ? data[this._i] : undefined;
|
|
}
|
|
},
|
|
// 23.3.3.5 WeakMap.prototype.set(key, value)
|
|
set: function set(key, value){
|
|
return weak.def(this, key, value);
|
|
}
|
|
};
|
|
|
|
// 23.3 WeakMap Objects
|
|
var $WeakMap = module.exports = require('./_collection')('WeakMap', wrapper, methods, weak, true, true);
|
|
|
|
// IE11 WeakMap frozen keys fix
|
|
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
|
|
InternalMap = weak.getConstructor(wrapper);
|
|
assign(InternalMap.prototype, methods);
|
|
meta.NEED = true;
|
|
each(['delete', 'has', 'get', 'set'], function(key){
|
|
var proto = $WeakMap.prototype
|
|
, method = proto[key];
|
|
redefine(proto, key, function(a, b){
|
|
// store frozen objects on internal weakmap shim
|
|
if(isObject(a) && !isExtensible(a)){
|
|
if(!this._f)this._f = new InternalMap;
|
|
var result = this._f[key](a, b);
|
|
return key == 'set' ? this : result;
|
|
// store all the rest on native weakmap
|
|
} return method.call(this, a, b);
|
|
});
|
|
});
|
|
}
|
|
},{"./_array-methods":18,"./_collection":28,"./_collection-weak":27,"./_is-object":55,"./_meta":68,"./_object-assign":71,"./_redefine":93}],262:[function(require,module,exports){
|
|
'use strict';
|
|
var weak = require('./_collection-weak');
|
|
|
|
// 23.4 WeakSet Objects
|
|
require('./_collection')('WeakSet', function(get){
|
|
return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.4.3.1 WeakSet.prototype.add(value)
|
|
add: function add(value){
|
|
return weak.def(this, value, true);
|
|
}
|
|
}, weak, false, true);
|
|
},{"./_collection":28,"./_collection-weak":27}],263:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/tc39/Array.prototype.includes
|
|
var $export = require('./_export')
|
|
, $includes = require('./_array-includes')(true);
|
|
|
|
$export($export.P, 'Array', {
|
|
includes: function includes(el /*, fromIndex = 0 */){
|
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
|
|
require('./_add-to-unscopables')('includes');
|
|
},{"./_add-to-unscopables":11,"./_array-includes":17,"./_export":38}],264:[function(require,module,exports){
|
|
// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
|
|
var $export = require('./_export')
|
|
, microtask = require('./_microtask')()
|
|
, process = require('./_global').process
|
|
, isNode = require('./_cof')(process) == 'process';
|
|
|
|
$export($export.G, {
|
|
asap: function asap(fn){
|
|
var domain = isNode && process.domain;
|
|
microtask(domain ? domain.bind(fn) : fn);
|
|
}
|
|
});
|
|
},{"./_cof":24,"./_export":38,"./_global":44,"./_microtask":70}],265:[function(require,module,exports){
|
|
// https://github.com/ljharb/proposal-is-error
|
|
var $export = require('./_export')
|
|
, cof = require('./_cof');
|
|
|
|
$export($export.S, 'Error', {
|
|
isError: function isError(it){
|
|
return cof(it) === 'Error';
|
|
}
|
|
});
|
|
},{"./_cof":24,"./_export":38}],266:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P + $export.R, 'Map', {toJSON: require('./_collection-to-json')('Map')});
|
|
},{"./_collection-to-json":26,"./_export":38}],267:[function(require,module,exports){
|
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
iaddh: function iaddh(x0, x1, y0, y1){
|
|
var $x0 = x0 >>> 0
|
|
, $x1 = x1 >>> 0
|
|
, $y0 = y0 >>> 0;
|
|
return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
|
|
}
|
|
});
|
|
},{"./_export":38}],268:[function(require,module,exports){
|
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
imulh: function imulh(u, v){
|
|
var UINT16 = 0xffff
|
|
, $u = +u
|
|
, $v = +v
|
|
, u0 = $u & UINT16
|
|
, v0 = $v & UINT16
|
|
, u1 = $u >> 16
|
|
, v1 = $v >> 16
|
|
, t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
|
|
return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
|
|
}
|
|
});
|
|
},{"./_export":38}],269:[function(require,module,exports){
|
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
isubh: function isubh(x0, x1, y0, y1){
|
|
var $x0 = x0 >>> 0
|
|
, $x1 = x1 >>> 0
|
|
, $y0 = y0 >>> 0;
|
|
return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
|
|
}
|
|
});
|
|
},{"./_export":38}],270:[function(require,module,exports){
|
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'Math', {
|
|
umulh: function umulh(u, v){
|
|
var UINT16 = 0xffff
|
|
, $u = +u
|
|
, $v = +v
|
|
, u0 = $u & UINT16
|
|
, v0 = $v & UINT16
|
|
, u1 = $u >>> 16
|
|
, v1 = $v >>> 16
|
|
, t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
|
|
return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
|
|
}
|
|
});
|
|
},{"./_export":38}],271:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toObject = require('./_to-object')
|
|
, aFunction = require('./_a-function')
|
|
, $defineProperty = require('./_object-dp');
|
|
|
|
// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
|
|
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
|
|
__defineGetter__: function __defineGetter__(P, getter){
|
|
$defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true});
|
|
}
|
|
});
|
|
},{"./_a-function":9,"./_descriptors":34,"./_export":38,"./_object-dp":73,"./_object-forced-pam":75,"./_to-object":115}],272:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toObject = require('./_to-object')
|
|
, aFunction = require('./_a-function')
|
|
, $defineProperty = require('./_object-dp');
|
|
|
|
// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
|
|
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
|
|
__defineSetter__: function __defineSetter__(P, setter){
|
|
$defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true});
|
|
}
|
|
});
|
|
},{"./_a-function":9,"./_descriptors":34,"./_export":38,"./_object-dp":73,"./_object-forced-pam":75,"./_to-object":115}],273:[function(require,module,exports){
|
|
// https://github.com/tc39/proposal-object-values-entries
|
|
var $export = require('./_export')
|
|
, $entries = require('./_object-to-array')(true);
|
|
|
|
$export($export.S, 'Object', {
|
|
entries: function entries(it){
|
|
return $entries(it);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_object-to-array":85}],274:[function(require,module,exports){
|
|
// https://github.com/tc39/proposal-object-getownpropertydescriptors
|
|
var $export = require('./_export')
|
|
, ownKeys = require('./_own-keys')
|
|
, toIObject = require('./_to-iobject')
|
|
, gOPD = require('./_object-gopd')
|
|
, createProperty = require('./_create-property');
|
|
|
|
$export($export.S, 'Object', {
|
|
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
|
|
var O = toIObject(object)
|
|
, getDesc = gOPD.f
|
|
, keys = ownKeys(O)
|
|
, result = {}
|
|
, i = 0
|
|
, key;
|
|
while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key));
|
|
return result;
|
|
}
|
|
});
|
|
},{"./_create-property":30,"./_export":38,"./_object-gopd":76,"./_own-keys":86,"./_to-iobject":113}],275:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toObject = require('./_to-object')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, getOwnPropertyDescriptor = require('./_object-gopd').f;
|
|
|
|
// B.2.2.4 Object.prototype.__lookupGetter__(P)
|
|
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
|
|
__lookupGetter__: function __lookupGetter__(P){
|
|
var O = toObject(this)
|
|
, K = toPrimitive(P, true)
|
|
, D;
|
|
do {
|
|
if(D = getOwnPropertyDescriptor(O, K))return D.get;
|
|
} while(O = getPrototypeOf(O));
|
|
}
|
|
});
|
|
},{"./_descriptors":34,"./_export":38,"./_object-forced-pam":75,"./_object-gopd":76,"./_object-gpo":80,"./_to-object":115,"./_to-primitive":116}],276:[function(require,module,exports){
|
|
'use strict';
|
|
var $export = require('./_export')
|
|
, toObject = require('./_to-object')
|
|
, toPrimitive = require('./_to-primitive')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, getOwnPropertyDescriptor = require('./_object-gopd').f;
|
|
|
|
// B.2.2.5 Object.prototype.__lookupSetter__(P)
|
|
require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
|
|
__lookupSetter__: function __lookupSetter__(P){
|
|
var O = toObject(this)
|
|
, K = toPrimitive(P, true)
|
|
, D;
|
|
do {
|
|
if(D = getOwnPropertyDescriptor(O, K))return D.set;
|
|
} while(O = getPrototypeOf(O));
|
|
}
|
|
});
|
|
},{"./_descriptors":34,"./_export":38,"./_object-forced-pam":75,"./_object-gopd":76,"./_object-gpo":80,"./_to-object":115,"./_to-primitive":116}],277:[function(require,module,exports){
|
|
// https://github.com/tc39/proposal-object-values-entries
|
|
var $export = require('./_export')
|
|
, $values = require('./_object-to-array')(false);
|
|
|
|
$export($export.S, 'Object', {
|
|
values: function values(it){
|
|
return $values(it);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_object-to-array":85}],278:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/zenparsing/es-observable
|
|
var $export = require('./_export')
|
|
, global = require('./_global')
|
|
, core = require('./_core')
|
|
, microtask = require('./_microtask')()
|
|
, OBSERVABLE = require('./_wks')('observable')
|
|
, aFunction = require('./_a-function')
|
|
, anObject = require('./_an-object')
|
|
, anInstance = require('./_an-instance')
|
|
, redefineAll = require('./_redefine-all')
|
|
, hide = require('./_hide')
|
|
, forOf = require('./_for-of')
|
|
, RETURN = forOf.RETURN;
|
|
|
|
var getMethod = function(fn){
|
|
return fn == null ? undefined : aFunction(fn);
|
|
};
|
|
|
|
var cleanupSubscription = function(subscription){
|
|
var cleanup = subscription._c;
|
|
if(cleanup){
|
|
subscription._c = undefined;
|
|
cleanup();
|
|
}
|
|
};
|
|
|
|
var subscriptionClosed = function(subscription){
|
|
return subscription._o === undefined;
|
|
};
|
|
|
|
var closeSubscription = function(subscription){
|
|
if(!subscriptionClosed(subscription)){
|
|
subscription._o = undefined;
|
|
cleanupSubscription(subscription);
|
|
}
|
|
};
|
|
|
|
var Subscription = function(observer, subscriber){
|
|
anObject(observer);
|
|
this._c = undefined;
|
|
this._o = observer;
|
|
observer = new SubscriptionObserver(this);
|
|
try {
|
|
var cleanup = subscriber(observer)
|
|
, subscription = cleanup;
|
|
if(cleanup != null){
|
|
if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); };
|
|
else aFunction(cleanup);
|
|
this._c = cleanup;
|
|
}
|
|
} catch(e){
|
|
observer.error(e);
|
|
return;
|
|
} if(subscriptionClosed(this))cleanupSubscription(this);
|
|
};
|
|
|
|
Subscription.prototype = redefineAll({}, {
|
|
unsubscribe: function unsubscribe(){ closeSubscription(this); }
|
|
});
|
|
|
|
var SubscriptionObserver = function(subscription){
|
|
this._s = subscription;
|
|
};
|
|
|
|
SubscriptionObserver.prototype = redefineAll({}, {
|
|
next: function next(value){
|
|
var subscription = this._s;
|
|
if(!subscriptionClosed(subscription)){
|
|
var observer = subscription._o;
|
|
try {
|
|
var m = getMethod(observer.next);
|
|
if(m)return m.call(observer, value);
|
|
} catch(e){
|
|
try {
|
|
closeSubscription(subscription);
|
|
} finally {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
error: function error(value){
|
|
var subscription = this._s;
|
|
if(subscriptionClosed(subscription))throw value;
|
|
var observer = subscription._o;
|
|
subscription._o = undefined;
|
|
try {
|
|
var m = getMethod(observer.error);
|
|
if(!m)throw value;
|
|
value = m.call(observer, value);
|
|
} catch(e){
|
|
try {
|
|
cleanupSubscription(subscription);
|
|
} finally {
|
|
throw e;
|
|
}
|
|
} cleanupSubscription(subscription);
|
|
return value;
|
|
},
|
|
complete: function complete(value){
|
|
var subscription = this._s;
|
|
if(!subscriptionClosed(subscription)){
|
|
var observer = subscription._o;
|
|
subscription._o = undefined;
|
|
try {
|
|
var m = getMethod(observer.complete);
|
|
value = m ? m.call(observer, value) : undefined;
|
|
} catch(e){
|
|
try {
|
|
cleanupSubscription(subscription);
|
|
} finally {
|
|
throw e;
|
|
}
|
|
} cleanupSubscription(subscription);
|
|
return value;
|
|
}
|
|
}
|
|
});
|
|
|
|
var $Observable = function Observable(subscriber){
|
|
anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
|
|
};
|
|
|
|
redefineAll($Observable.prototype, {
|
|
subscribe: function subscribe(observer){
|
|
return new Subscription(observer, this._f);
|
|
},
|
|
forEach: function forEach(fn){
|
|
var that = this;
|
|
return new (core.Promise || global.Promise)(function(resolve, reject){
|
|
aFunction(fn);
|
|
var subscription = that.subscribe({
|
|
next : function(value){
|
|
try {
|
|
return fn(value);
|
|
} catch(e){
|
|
reject(e);
|
|
subscription.unsubscribe();
|
|
}
|
|
},
|
|
error: reject,
|
|
complete: resolve
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
redefineAll($Observable, {
|
|
from: function from(x){
|
|
var C = typeof this === 'function' ? this : $Observable;
|
|
var method = getMethod(anObject(x)[OBSERVABLE]);
|
|
if(method){
|
|
var observable = anObject(method.call(x));
|
|
return observable.constructor === C ? observable : new C(function(observer){
|
|
return observable.subscribe(observer);
|
|
});
|
|
}
|
|
return new C(function(observer){
|
|
var done = false;
|
|
microtask(function(){
|
|
if(!done){
|
|
try {
|
|
if(forOf(x, false, function(it){
|
|
observer.next(it);
|
|
if(done)return RETURN;
|
|
}) === RETURN)return;
|
|
} catch(e){
|
|
if(done)throw e;
|
|
observer.error(e);
|
|
return;
|
|
} observer.complete();
|
|
}
|
|
});
|
|
return function(){ done = true; };
|
|
});
|
|
},
|
|
of: function of(){
|
|
for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++];
|
|
return new (typeof this === 'function' ? this : $Observable)(function(observer){
|
|
var done = false;
|
|
microtask(function(){
|
|
if(!done){
|
|
for(var i = 0; i < items.length; ++i){
|
|
observer.next(items[i]);
|
|
if(done)return;
|
|
} observer.complete();
|
|
}
|
|
});
|
|
return function(){ done = true; };
|
|
});
|
|
}
|
|
});
|
|
|
|
hide($Observable.prototype, OBSERVABLE, function(){ return this; });
|
|
|
|
$export($export.G, {Observable: $Observable});
|
|
|
|
require('./_set-species')('Observable');
|
|
},{"./_a-function":9,"./_an-instance":12,"./_an-object":13,"./_core":29,"./_export":38,"./_for-of":43,"./_global":44,"./_hide":46,"./_microtask":70,"./_redefine-all":92,"./_set-species":97,"./_wks":123}],279:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, toMetaKey = metadata.key
|
|
, ordinaryDefineOwnMetadata = metadata.set;
|
|
|
|
metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){
|
|
ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69}],280:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, toMetaKey = metadata.key
|
|
, getOrCreateMetadataMap = metadata.map
|
|
, store = metadata.store;
|
|
|
|
metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){
|
|
var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2])
|
|
, metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
|
|
if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false;
|
|
if(metadataMap.size)return true;
|
|
var targetMetadata = store.get(target);
|
|
targetMetadata['delete'](targetKey);
|
|
return !!targetMetadata.size || store['delete'](target);
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69}],281:[function(require,module,exports){
|
|
var Set = require('./es6.set')
|
|
, from = require('./_array-from-iterable')
|
|
, metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, ordinaryOwnMetadataKeys = metadata.keys
|
|
, toMetaKey = metadata.key;
|
|
|
|
var ordinaryMetadataKeys = function(O, P){
|
|
var oKeys = ordinaryOwnMetadataKeys(O, P)
|
|
, parent = getPrototypeOf(O);
|
|
if(parent === null)return oKeys;
|
|
var pKeys = ordinaryMetadataKeys(parent, P);
|
|
return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
|
|
};
|
|
|
|
metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){
|
|
return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
|
|
}});
|
|
},{"./_an-object":13,"./_array-from-iterable":16,"./_metadata":69,"./_object-gpo":80,"./es6.set":226}],282:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, ordinaryHasOwnMetadata = metadata.has
|
|
, ordinaryGetOwnMetadata = metadata.get
|
|
, toMetaKey = metadata.key;
|
|
|
|
var ordinaryGetMetadata = function(MetadataKey, O, P){
|
|
var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
|
if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P);
|
|
var parent = getPrototypeOf(O);
|
|
return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
|
|
};
|
|
|
|
metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){
|
|
return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69,"./_object-gpo":80}],283:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, ordinaryOwnMetadataKeys = metadata.keys
|
|
, toMetaKey = metadata.key;
|
|
|
|
metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){
|
|
return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69}],284:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, ordinaryGetOwnMetadata = metadata.get
|
|
, toMetaKey = metadata.key;
|
|
|
|
metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){
|
|
return ordinaryGetOwnMetadata(metadataKey, anObject(target)
|
|
, arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69}],285:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, getPrototypeOf = require('./_object-gpo')
|
|
, ordinaryHasOwnMetadata = metadata.has
|
|
, toMetaKey = metadata.key;
|
|
|
|
var ordinaryHasMetadata = function(MetadataKey, O, P){
|
|
var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
|
if(hasOwn)return true;
|
|
var parent = getPrototypeOf(O);
|
|
return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
|
|
};
|
|
|
|
metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){
|
|
return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69,"./_object-gpo":80}],286:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, ordinaryHasOwnMetadata = metadata.has
|
|
, toMetaKey = metadata.key;
|
|
|
|
metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){
|
|
return ordinaryHasOwnMetadata(metadataKey, anObject(target)
|
|
, arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
|
}});
|
|
},{"./_an-object":13,"./_metadata":69}],287:[function(require,module,exports){
|
|
var metadata = require('./_metadata')
|
|
, anObject = require('./_an-object')
|
|
, aFunction = require('./_a-function')
|
|
, toMetaKey = metadata.key
|
|
, ordinaryDefineOwnMetadata = metadata.set;
|
|
|
|
metadata.exp({metadata: function metadata(metadataKey, metadataValue){
|
|
return function decorator(target, targetKey){
|
|
ordinaryDefineOwnMetadata(
|
|
metadataKey, metadataValue,
|
|
(targetKey !== undefined ? anObject : aFunction)(target),
|
|
toMetaKey(targetKey)
|
|
);
|
|
};
|
|
}});
|
|
},{"./_a-function":9,"./_an-object":13,"./_metadata":69}],288:[function(require,module,exports){
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = require('./_export');
|
|
|
|
$export($export.P + $export.R, 'Set', {toJSON: require('./_collection-to-json')('Set')});
|
|
},{"./_collection-to-json":26,"./_export":38}],289:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/mathiasbynens/String.prototype.at
|
|
var $export = require('./_export')
|
|
, $at = require('./_string-at')(true);
|
|
|
|
$export($export.P, 'String', {
|
|
at: function at(pos){
|
|
return $at(this, pos);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_string-at":103}],290:[function(require,module,exports){
|
|
'use strict';
|
|
// https://tc39.github.io/String.prototype.matchAll/
|
|
var $export = require('./_export')
|
|
, defined = require('./_defined')
|
|
, toLength = require('./_to-length')
|
|
, isRegExp = require('./_is-regexp')
|
|
, getFlags = require('./_flags')
|
|
, RegExpProto = RegExp.prototype;
|
|
|
|
var $RegExpStringIterator = function(regexp, string){
|
|
this._r = regexp;
|
|
this._s = string;
|
|
};
|
|
|
|
require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next(){
|
|
var match = this._r.exec(this._s);
|
|
return {value: match, done: match === null};
|
|
});
|
|
|
|
$export($export.P, 'String', {
|
|
matchAll: function matchAll(regexp){
|
|
defined(this);
|
|
if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!');
|
|
var S = String(this)
|
|
, flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp)
|
|
, rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
|
|
rx.lastIndex = toLength(regexp.lastIndex);
|
|
return new $RegExpStringIterator(rx, S);
|
|
}
|
|
});
|
|
},{"./_defined":33,"./_export":38,"./_flags":42,"./_is-regexp":56,"./_iter-create":58,"./_to-length":114}],291:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/tc39/proposal-string-pad-start-end
|
|
var $export = require('./_export')
|
|
, $pad = require('./_string-pad');
|
|
|
|
$export($export.P, 'String', {
|
|
padEnd: function padEnd(maxLength /*, fillString = ' ' */){
|
|
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_string-pad":106}],292:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/tc39/proposal-string-pad-start-end
|
|
var $export = require('./_export')
|
|
, $pad = require('./_string-pad');
|
|
|
|
$export($export.P, 'String', {
|
|
padStart: function padStart(maxLength /*, fillString = ' ' */){
|
|
return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
|
|
}
|
|
});
|
|
},{"./_export":38,"./_string-pad":106}],293:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
|
|
require('./_string-trim')('trimLeft', function($trim){
|
|
return function trimLeft(){
|
|
return $trim(this, 1);
|
|
};
|
|
}, 'trimStart');
|
|
},{"./_string-trim":108}],294:[function(require,module,exports){
|
|
'use strict';
|
|
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
|
|
require('./_string-trim')('trimRight', function($trim){
|
|
return function trimRight(){
|
|
return $trim(this, 2);
|
|
};
|
|
}, 'trimEnd');
|
|
},{"./_string-trim":108}],295:[function(require,module,exports){
|
|
require('./_wks-define')('asyncIterator');
|
|
},{"./_wks-define":121}],296:[function(require,module,exports){
|
|
require('./_wks-define')('observable');
|
|
},{"./_wks-define":121}],297:[function(require,module,exports){
|
|
// https://github.com/ljharb/proposal-global
|
|
var $export = require('./_export');
|
|
|
|
$export($export.S, 'System', {global: require('./_global')});
|
|
},{"./_export":38,"./_global":44}],298:[function(require,module,exports){
|
|
var $iterators = require('./es6.array.iterator')
|
|
, redefine = require('./_redefine')
|
|
, global = require('./_global')
|
|
, hide = require('./_hide')
|
|
, Iterators = require('./_iterators')
|
|
, wks = require('./_wks')
|
|
, ITERATOR = wks('iterator')
|
|
, TO_STRING_TAG = wks('toStringTag')
|
|
, ArrayValues = Iterators.Array;
|
|
|
|
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
|
|
var NAME = collections[i]
|
|
, Collection = global[NAME]
|
|
, proto = Collection && Collection.prototype
|
|
, key;
|
|
if(proto){
|
|
if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues);
|
|
if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
|
|
Iterators[NAME] = ArrayValues;
|
|
for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true);
|
|
}
|
|
}
|
|
},{"./_global":44,"./_hide":46,"./_iterators":62,"./_redefine":93,"./_wks":123,"./es6.array.iterator":136}],299:[function(require,module,exports){
|
|
var $export = require('./_export')
|
|
, $task = require('./_task');
|
|
$export($export.G + $export.B, {
|
|
setImmediate: $task.set,
|
|
clearImmediate: $task.clear
|
|
});
|
|
},{"./_export":38,"./_task":110}],300:[function(require,module,exports){
|
|
// ie9- setTimeout & setInterval additional parameters fix
|
|
var global = require('./_global')
|
|
, $export = require('./_export')
|
|
, invoke = require('./_invoke')
|
|
, partial = require('./_partial')
|
|
, navigator = global.navigator
|
|
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
|
|
var wrap = function(set){
|
|
return MSIE ? function(fn, time /*, ...args */){
|
|
return set(invoke(
|
|
partial,
|
|
[].slice.call(arguments, 2),
|
|
typeof fn == 'function' ? fn : Function(fn)
|
|
), time);
|
|
} : set;
|
|
};
|
|
$export($export.G + $export.B + $export.F * MSIE, {
|
|
setTimeout: wrap(global.setTimeout),
|
|
setInterval: wrap(global.setInterval)
|
|
});
|
|
},{"./_export":38,"./_global":44,"./_invoke":50,"./_partial":89}],301:[function(require,module,exports){
|
|
require('./modules/es6.symbol');
|
|
require('./modules/es6.object.create');
|
|
require('./modules/es6.object.define-property');
|
|
require('./modules/es6.object.define-properties');
|
|
require('./modules/es6.object.get-own-property-descriptor');
|
|
require('./modules/es6.object.get-prototype-of');
|
|
require('./modules/es6.object.keys');
|
|
require('./modules/es6.object.get-own-property-names');
|
|
require('./modules/es6.object.freeze');
|
|
require('./modules/es6.object.seal');
|
|
require('./modules/es6.object.prevent-extensions');
|
|
require('./modules/es6.object.is-frozen');
|
|
require('./modules/es6.object.is-sealed');
|
|
require('./modules/es6.object.is-extensible');
|
|
require('./modules/es6.object.assign');
|
|
require('./modules/es6.object.is');
|
|
require('./modules/es6.object.set-prototype-of');
|
|
require('./modules/es6.object.to-string');
|
|
require('./modules/es6.function.bind');
|
|
require('./modules/es6.function.name');
|
|
require('./modules/es6.function.has-instance');
|
|
require('./modules/es6.parse-int');
|
|
require('./modules/es6.parse-float');
|
|
require('./modules/es6.number.constructor');
|
|
require('./modules/es6.number.to-fixed');
|
|
require('./modules/es6.number.to-precision');
|
|
require('./modules/es6.number.epsilon');
|
|
require('./modules/es6.number.is-finite');
|
|
require('./modules/es6.number.is-integer');
|
|
require('./modules/es6.number.is-nan');
|
|
require('./modules/es6.number.is-safe-integer');
|
|
require('./modules/es6.number.max-safe-integer');
|
|
require('./modules/es6.number.min-safe-integer');
|
|
require('./modules/es6.number.parse-float');
|
|
require('./modules/es6.number.parse-int');
|
|
require('./modules/es6.math.acosh');
|
|
require('./modules/es6.math.asinh');
|
|
require('./modules/es6.math.atanh');
|
|
require('./modules/es6.math.cbrt');
|
|
require('./modules/es6.math.clz32');
|
|
require('./modules/es6.math.cosh');
|
|
require('./modules/es6.math.expm1');
|
|
require('./modules/es6.math.fround');
|
|
require('./modules/es6.math.hypot');
|
|
require('./modules/es6.math.imul');
|
|
require('./modules/es6.math.log10');
|
|
require('./modules/es6.math.log1p');
|
|
require('./modules/es6.math.log2');
|
|
require('./modules/es6.math.sign');
|
|
require('./modules/es6.math.sinh');
|
|
require('./modules/es6.math.tanh');
|
|
require('./modules/es6.math.trunc');
|
|
require('./modules/es6.string.from-code-point');
|
|
require('./modules/es6.string.raw');
|
|
require('./modules/es6.string.trim');
|
|
require('./modules/es6.string.iterator');
|
|
require('./modules/es6.string.code-point-at');
|
|
require('./modules/es6.string.ends-with');
|
|
require('./modules/es6.string.includes');
|
|
require('./modules/es6.string.repeat');
|
|
require('./modules/es6.string.starts-with');
|
|
require('./modules/es6.string.anchor');
|
|
require('./modules/es6.string.big');
|
|
require('./modules/es6.string.blink');
|
|
require('./modules/es6.string.bold');
|
|
require('./modules/es6.string.fixed');
|
|
require('./modules/es6.string.fontcolor');
|
|
require('./modules/es6.string.fontsize');
|
|
require('./modules/es6.string.italics');
|
|
require('./modules/es6.string.link');
|
|
require('./modules/es6.string.small');
|
|
require('./modules/es6.string.strike');
|
|
require('./modules/es6.string.sub');
|
|
require('./modules/es6.string.sup');
|
|
require('./modules/es6.date.now');
|
|
require('./modules/es6.date.to-json');
|
|
require('./modules/es6.date.to-iso-string');
|
|
require('./modules/es6.date.to-string');
|
|
require('./modules/es6.date.to-primitive');
|
|
require('./modules/es6.array.is-array');
|
|
require('./modules/es6.array.from');
|
|
require('./modules/es6.array.of');
|
|
require('./modules/es6.array.join');
|
|
require('./modules/es6.array.slice');
|
|
require('./modules/es6.array.sort');
|
|
require('./modules/es6.array.for-each');
|
|
require('./modules/es6.array.map');
|
|
require('./modules/es6.array.filter');
|
|
require('./modules/es6.array.some');
|
|
require('./modules/es6.array.every');
|
|
require('./modules/es6.array.reduce');
|
|
require('./modules/es6.array.reduce-right');
|
|
require('./modules/es6.array.index-of');
|
|
require('./modules/es6.array.last-index-of');
|
|
require('./modules/es6.array.copy-within');
|
|
require('./modules/es6.array.fill');
|
|
require('./modules/es6.array.find');
|
|
require('./modules/es6.array.find-index');
|
|
require('./modules/es6.array.species');
|
|
require('./modules/es6.array.iterator');
|
|
require('./modules/es6.regexp.constructor');
|
|
require('./modules/es6.regexp.to-string');
|
|
require('./modules/es6.regexp.flags');
|
|
require('./modules/es6.regexp.match');
|
|
require('./modules/es6.regexp.replace');
|
|
require('./modules/es6.regexp.search');
|
|
require('./modules/es6.regexp.split');
|
|
require('./modules/es6.promise');
|
|
require('./modules/es6.map');
|
|
require('./modules/es6.set');
|
|
require('./modules/es6.weak-map');
|
|
require('./modules/es6.weak-set');
|
|
require('./modules/es6.typed.array-buffer');
|
|
require('./modules/es6.typed.data-view');
|
|
require('./modules/es6.typed.int8-array');
|
|
require('./modules/es6.typed.uint8-array');
|
|
require('./modules/es6.typed.uint8-clamped-array');
|
|
require('./modules/es6.typed.int16-array');
|
|
require('./modules/es6.typed.uint16-array');
|
|
require('./modules/es6.typed.int32-array');
|
|
require('./modules/es6.typed.uint32-array');
|
|
require('./modules/es6.typed.float32-array');
|
|
require('./modules/es6.typed.float64-array');
|
|
require('./modules/es6.reflect.apply');
|
|
require('./modules/es6.reflect.construct');
|
|
require('./modules/es6.reflect.define-property');
|
|
require('./modules/es6.reflect.delete-property');
|
|
require('./modules/es6.reflect.enumerate');
|
|
require('./modules/es6.reflect.get');
|
|
require('./modules/es6.reflect.get-own-property-descriptor');
|
|
require('./modules/es6.reflect.get-prototype-of');
|
|
require('./modules/es6.reflect.has');
|
|
require('./modules/es6.reflect.is-extensible');
|
|
require('./modules/es6.reflect.own-keys');
|
|
require('./modules/es6.reflect.prevent-extensions');
|
|
require('./modules/es6.reflect.set');
|
|
require('./modules/es6.reflect.set-prototype-of');
|
|
require('./modules/es7.array.includes');
|
|
require('./modules/es7.string.at');
|
|
require('./modules/es7.string.pad-start');
|
|
require('./modules/es7.string.pad-end');
|
|
require('./modules/es7.string.trim-left');
|
|
require('./modules/es7.string.trim-right');
|
|
require('./modules/es7.string.match-all');
|
|
require('./modules/es7.symbol.async-iterator');
|
|
require('./modules/es7.symbol.observable');
|
|
require('./modules/es7.object.get-own-property-descriptors');
|
|
require('./modules/es7.object.values');
|
|
require('./modules/es7.object.entries');
|
|
require('./modules/es7.object.define-getter');
|
|
require('./modules/es7.object.define-setter');
|
|
require('./modules/es7.object.lookup-getter');
|
|
require('./modules/es7.object.lookup-setter');
|
|
require('./modules/es7.map.to-json');
|
|
require('./modules/es7.set.to-json');
|
|
require('./modules/es7.system.global');
|
|
require('./modules/es7.error.is-error');
|
|
require('./modules/es7.math.iaddh');
|
|
require('./modules/es7.math.isubh');
|
|
require('./modules/es7.math.imulh');
|
|
require('./modules/es7.math.umulh');
|
|
require('./modules/es7.reflect.define-metadata');
|
|
require('./modules/es7.reflect.delete-metadata');
|
|
require('./modules/es7.reflect.get-metadata');
|
|
require('./modules/es7.reflect.get-metadata-keys');
|
|
require('./modules/es7.reflect.get-own-metadata');
|
|
require('./modules/es7.reflect.get-own-metadata-keys');
|
|
require('./modules/es7.reflect.has-metadata');
|
|
require('./modules/es7.reflect.has-own-metadata');
|
|
require('./modules/es7.reflect.metadata');
|
|
require('./modules/es7.asap');
|
|
require('./modules/es7.observable');
|
|
require('./modules/web.timers');
|
|
require('./modules/web.immediate');
|
|
require('./modules/web.dom.iterable');
|
|
module.exports = require('./modules/_core');
|
|
},{"./modules/_core":29,"./modules/es6.array.copy-within":126,"./modules/es6.array.every":127,"./modules/es6.array.fill":128,"./modules/es6.array.filter":129,"./modules/es6.array.find":131,"./modules/es6.array.find-index":130,"./modules/es6.array.for-each":132,"./modules/es6.array.from":133,"./modules/es6.array.index-of":134,"./modules/es6.array.is-array":135,"./modules/es6.array.iterator":136,"./modules/es6.array.join":137,"./modules/es6.array.last-index-of":138,"./modules/es6.array.map":139,"./modules/es6.array.of":140,"./modules/es6.array.reduce":142,"./modules/es6.array.reduce-right":141,"./modules/es6.array.slice":143,"./modules/es6.array.some":144,"./modules/es6.array.sort":145,"./modules/es6.array.species":146,"./modules/es6.date.now":147,"./modules/es6.date.to-iso-string":148,"./modules/es6.date.to-json":149,"./modules/es6.date.to-primitive":150,"./modules/es6.date.to-string":151,"./modules/es6.function.bind":152,"./modules/es6.function.has-instance":153,"./modules/es6.function.name":154,"./modules/es6.map":155,"./modules/es6.math.acosh":156,"./modules/es6.math.asinh":157,"./modules/es6.math.atanh":158,"./modules/es6.math.cbrt":159,"./modules/es6.math.clz32":160,"./modules/es6.math.cosh":161,"./modules/es6.math.expm1":162,"./modules/es6.math.fround":163,"./modules/es6.math.hypot":164,"./modules/es6.math.imul":165,"./modules/es6.math.log10":166,"./modules/es6.math.log1p":167,"./modules/es6.math.log2":168,"./modules/es6.math.sign":169,"./modules/es6.math.sinh":170,"./modules/es6.math.tanh":171,"./modules/es6.math.trunc":172,"./modules/es6.number.constructor":173,"./modules/es6.number.epsilon":174,"./modules/es6.number.is-finite":175,"./modules/es6.number.is-integer":176,"./modules/es6.number.is-nan":177,"./modules/es6.number.is-safe-integer":178,"./modules/es6.number.max-safe-integer":179,"./modules/es6.number.min-safe-integer":180,"./modules/es6.number.parse-float":181,"./modules/es6.number.parse-int":182,"./modules/es6.number.to-fixed":183,"./modules/es6.number.to-precision":184,"./modules/es6.object.assign":185,"./modules/es6.object.create":186,"./modules/es6.object.define-properties":187,"./modules/es6.object.define-property":188,"./modules/es6.object.freeze":189,"./modules/es6.object.get-own-property-descriptor":190,"./modules/es6.object.get-own-property-names":191,"./modules/es6.object.get-prototype-of":192,"./modules/es6.object.is":196,"./modules/es6.object.is-extensible":193,"./modules/es6.object.is-frozen":194,"./modules/es6.object.is-sealed":195,"./modules/es6.object.keys":197,"./modules/es6.object.prevent-extensions":198,"./modules/es6.object.seal":199,"./modules/es6.object.set-prototype-of":200,"./modules/es6.object.to-string":201,"./modules/es6.parse-float":202,"./modules/es6.parse-int":203,"./modules/es6.promise":204,"./modules/es6.reflect.apply":205,"./modules/es6.reflect.construct":206,"./modules/es6.reflect.define-property":207,"./modules/es6.reflect.delete-property":208,"./modules/es6.reflect.enumerate":209,"./modules/es6.reflect.get":212,"./modules/es6.reflect.get-own-property-descriptor":210,"./modules/es6.reflect.get-prototype-of":211,"./modules/es6.reflect.has":213,"./modules/es6.reflect.is-extensible":214,"./modules/es6.reflect.own-keys":215,"./modules/es6.reflect.prevent-extensions":216,"./modules/es6.reflect.set":218,"./modules/es6.reflect.set-prototype-of":217,"./modules/es6.regexp.constructor":219,"./modules/es6.regexp.flags":220,"./modules/es6.regexp.match":221,"./modules/es6.regexp.replace":222,"./modules/es6.regexp.search":223,"./modules/es6.regexp.split":224,"./modules/es6.regexp.to-string":225,"./modules/es6.set":226,"./modules/es6.string.anchor":227,"./modules/es6.string.big":228,"./modules/es6.string.blink":229,"./modules/es6.string.bold":230,"./modules/es6.string.code-point-at":231,"./modules/es6.string.ends-with":232,"./modules/es6.string.fixed":233,"./modules/es6.string.fontcolor":234,"./modules/es6.string.fontsize":235,"./modules/es6.string.from-code-point":236,"./modules/es6.string.includes":237,"./modules/es6.string.italics":238,"./modules/es6.string.iterator":239,"./modules/es6.string.link":240,"./modules/es6.string.raw":241,"./modules/es6.string.repeat":242,"./modules/es6.string.small":243,"./modules/es6.string.starts-with":244,"./modules/es6.string.strike":245,"./modules/es6.string.sub":246,"./modules/es6.string.sup":247,"./modules/es6.string.trim":248,"./modules/es6.symbol":249,"./modules/es6.typed.array-buffer":250,"./modules/es6.typed.data-view":251,"./modules/es6.typed.float32-array":252,"./modules/es6.typed.float64-array":253,"./modules/es6.typed.int16-array":254,"./modules/es6.typed.int32-array":255,"./modules/es6.typed.int8-array":256,"./modules/es6.typed.uint16-array":257,"./modules/es6.typed.uint32-array":258,"./modules/es6.typed.uint8-array":259,"./modules/es6.typed.uint8-clamped-array":260,"./modules/es6.weak-map":261,"./modules/es6.weak-set":262,"./modules/es7.array.includes":263,"./modules/es7.asap":264,"./modules/es7.error.is-error":265,"./modules/es7.map.to-json":266,"./modules/es7.math.iaddh":267,"./modules/es7.math.imulh":268,"./modules/es7.math.isubh":269,"./modules/es7.math.umulh":270,"./modules/es7.object.define-getter":271,"./modules/es7.object.define-setter":272,"./modules/es7.object.entries":273,"./modules/es7.object.get-own-property-descriptors":274,"./modules/es7.object.lookup-getter":275,"./modules/es7.object.lookup-setter":276,"./modules/es7.object.values":277,"./modules/es7.observable":278,"./modules/es7.reflect.define-metadata":279,"./modules/es7.reflect.delete-metadata":280,"./modules/es7.reflect.get-metadata":282,"./modules/es7.reflect.get-metadata-keys":281,"./modules/es7.reflect.get-own-metadata":284,"./modules/es7.reflect.get-own-metadata-keys":283,"./modules/es7.reflect.has-metadata":285,"./modules/es7.reflect.has-own-metadata":286,"./modules/es7.reflect.metadata":287,"./modules/es7.set.to-json":288,"./modules/es7.string.at":289,"./modules/es7.string.match-all":290,"./modules/es7.string.pad-end":291,"./modules/es7.string.pad-start":292,"./modules/es7.string.trim-left":293,"./modules/es7.string.trim-right":294,"./modules/es7.symbol.async-iterator":295,"./modules/es7.symbol.observable":296,"./modules/es7.system.global":297,"./modules/web.dom.iterable":298,"./modules/web.immediate":299,"./modules/web.timers":300}],302:[function(require,module,exports){
|
|
(function (Buffer){
|
|
// 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 === '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 === '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 === '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":306}],303:[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.
|
|
|
|
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 === 'object' && arg !== null;
|
|
}
|
|
|
|
function isUndefined(arg) {
|
|
return arg === void 0;
|
|
}
|
|
|
|
},{}],304:[function(require,module,exports){
|
|
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
|
|
}
|
|
|
|
},{}],305:[function(require,module,exports){
|
|
if (typeof Object.create === 'function') {
|
|
// implementation from standard node.js 'util' module
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
ctor.super_ = superCtor
|
|
ctor.prototype = Object.create(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.prototype = superCtor.prototype
|
|
ctor.prototype = new TempCtor()
|
|
ctor.prototype.constructor = ctor
|
|
}
|
|
}
|
|
|
|
},{}],306:[function(require,module,exports){
|
|
/*!
|
|
* Determine if an object is a Buffer
|
|
*
|
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
* @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))
|
|
}
|
|
|
|
},{}],307:[function(require,module,exports){
|
|
var toString = {}.toString;
|
|
|
|
module.exports = Array.isArray || function (arr) {
|
|
return toString.call(arr) == '[object Array]';
|
|
};
|
|
|
|
},{}],308:[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":309}],309:[function(require,module,exports){
|
|
// 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.prependListener = noop;
|
|
process.prependOnceListener = noop;
|
|
|
|
process.listeners = function (name) { return [] }
|
|
|
|
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; };
|
|
|
|
},{}],310:[function(require,module,exports){
|
|
module.exports = require('./lib/_stream_duplex.js');
|
|
|
|
},{"./lib/_stream_duplex.js":311}],311:[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';
|
|
|
|
/*<replacement>*/
|
|
|
|
var objectKeys = Object.keys || function (obj) {
|
|
var keys = [];
|
|
for (var key in obj) {
|
|
keys.push(key);
|
|
}return keys;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
module.exports = Duplex;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = require('process-nextick-args');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var util = require('core-util-is');
|
|
util.inherits = require('inherits');
|
|
/*</replacement>*/
|
|
|
|
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":313,"./_stream_writable":315,"core-util-is":302,"inherits":305,"process-nextick-args":308}],312:[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');
|
|
|
|
/*<replacement>*/
|
|
var util = require('core-util-is');
|
|
util.inherits = require('inherits');
|
|
/*</replacement>*/
|
|
|
|
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":314,"core-util-is":302,"inherits":305}],313:[function(require,module,exports){
|
|
(function (process){
|
|
'use strict';
|
|
|
|
module.exports = Readable;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = require('process-nextick-args');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var isArray = require('isarray');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Readable.ReadableState = ReadableState;
|
|
|
|
/*<replacement>*/
|
|
var EE = require('events').EventEmitter;
|
|
|
|
var EElistenerCount = function (emitter, type) {
|
|
return emitter.listeners(type).length;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream = require('./internal/streams/stream');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Buffer = require('safe-buffer').Buffer;
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var util = require('core-util-is');
|
|
util.inherits = require('inherits');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var debugUtil = require('util');
|
|
var debug = void 0;
|
|
if (debugUtil && debugUtil.debuglog) {
|
|
debug = debugUtil.debuglog('stream');
|
|
} else {
|
|
debug = function () {};
|
|
}
|
|
/*</replacement>*/
|
|
|
|
var BufferList = require('./internal/streams/BufferList');
|
|
var StringDecoder;
|
|
|
|
util.inherits(Readable, Stream);
|
|
|
|
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
|
|
|
function prependListener(emitter, event, fn) {
|
|
// Sadly this is not cacheable as some libraries bundle their own
|
|
// event emitter implementation with them.
|
|
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]];
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
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 = Buffer.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('_read() is 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 : unpipe;
|
|
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', unpipe);
|
|
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 index = indexOf(state.pipes, dest);
|
|
if (index === -1) return this;
|
|
|
|
state.pipes.splice(index, 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.
|
|
for (var n = 0; n < kProxyEvents.length; n++) {
|
|
stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n]));
|
|
}
|
|
|
|
// 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 = Buffer.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":311,"./internal/streams/BufferList":316,"./internal/streams/stream":317,"_process":309,"core-util-is":302,"events":303,"inherits":305,"isarray":307,"process-nextick-args":308,"safe-buffer":323,"string_decoder/":325,"util":6}],314:[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');
|
|
|
|
/*<replacement>*/
|
|
var util = require('core-util-is');
|
|
util.inherits = require('inherits');
|
|
/*</replacement>*/
|
|
|
|
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);
|
|
|
|
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;
|
|
}
|
|
|
|
// When the writable side finishes, then flush out anything remaining.
|
|
this.once('prefinish', function () {
|
|
if (typeof this._flush === 'function') this._flush(function (er, data) {
|
|
done(stream, er, data);
|
|
});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('_transform() is 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, data) {
|
|
if (er) return stream.emit('error', er);
|
|
|
|
if (data !== null && data !== undefined) stream.push(data);
|
|
|
|
// 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":311,"core-util-is":302,"inherits":305}],315:[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';
|
|
|
|
module.exports = Writable;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = require('process-nextick-args');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Writable.WritableState = WritableState;
|
|
|
|
/*<replacement>*/
|
|
var util = require('core-util-is');
|
|
util.inherits = require('inherits');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var internalUtil = {
|
|
deprecate: require('util-deprecate')
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream = require('./internal/streams/stream');
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Buffer = require('safe-buffer').Buffer;
|
|
/*</replacement>*/
|
|
|
|
util.inherits(Writable, Stream);
|
|
|
|
function nop() {}
|
|
|
|
function WriteReq(chunk, encoding, cb) {
|
|
this.chunk = chunk;
|
|
this.encoding = encoding;
|
|
this.callback = cb;
|
|
this.next = null;
|
|
}
|
|
|
|
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;
|
|
|
|
// drain event flag.
|
|
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 getBuffer() {
|
|
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 (_) {}
|
|
})();
|
|
|
|
// Test _writableState for inheritance to account for Duplex streams,
|
|
// whose prototype chain only points to Readable.
|
|
var realHasInstance;
|
|
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
|
realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
Object.defineProperty(Writable, Symbol.hasInstance, {
|
|
value: function (object) {
|
|
if (realHasInstance.call(this, object)) return true;
|
|
|
|
return object && object._writableState instanceof WritableState;
|
|
}
|
|
});
|
|
} else {
|
|
realHasInstance = function (object) {
|
|
return object instanceof this;
|
|
};
|
|
}
|
|
|
|
function Writable(options) {
|
|
Duplex = Duplex || require('./_stream_duplex');
|
|
|
|
// Writable ctor is applied to Duplexes, too.
|
|
// `realHasInstance` is necessary because using plain `instanceof`
|
|
// would return false, as no `_writableState` property is attached.
|
|
|
|
// Trying to use the custom `instanceof` for Writable here will also break the
|
|
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
|
// `_writableState` that would lead to infinite recursion.
|
|
if (!realHasInstance.call(Writable, this) && !(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);
|
|
}
|
|
|
|
// Checks that a user-supplied chunk is valid, especially for the particular
|
|
// mode the stream is in. Currently this means that `null` is never accepted
|
|
// and undefined/non-string values are only allowed in object mode.
|
|
function validChunk(stream, state, chunk, cb) {
|
|
var valid = true;
|
|
var er = false;
|
|
|
|
if (chunk === null) {
|
|
er = new TypeError('May not write null values to stream');
|
|
} else if (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;
|
|
var isBuf = Buffer.isBuffer(chunk);
|
|
|
|
if (typeof encoding === 'function') {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
|
|
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
|
|
|
if (typeof cb !== 'function') cb = nop;
|
|
|
|
if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
|
state.pendingcb++;
|
|
ret = writeOrBuffer(this, state, isBuf, 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 = Buffer.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, isBuf, chunk, encoding, cb) {
|
|
if (!isBuf) {
|
|
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) {
|
|
/*<replacement>*/
|
|
asyncWrite(afterWrite, stream, state, finished, cb);
|
|
/*</replacement>*/
|
|
} 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('_write() is 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":311,"./internal/streams/stream":317,"_process":309,"core-util-is":302,"inherits":305,"process-nextick-args":308,"safe-buffer":323,"util-deprecate":326}],316:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
/*<replacement>*/
|
|
|
|
var Buffer = require('safe-buffer').Buffer;
|
|
/*</replacement>*/
|
|
|
|
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 Buffer.alloc(0);
|
|
if (this.length === 1) return this.head.data;
|
|
var ret = Buffer.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;
|
|
};
|
|
},{"safe-buffer":323}],317:[function(require,module,exports){
|
|
module.exports = require('events').EventEmitter;
|
|
|
|
},{"events":303}],318:[function(require,module,exports){
|
|
module.exports = require('./readable').PassThrough
|
|
|
|
},{"./readable":319}],319:[function(require,module,exports){
|
|
exports = module.exports = require('./lib/_stream_readable.js');
|
|
exports.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');
|
|
|
|
},{"./lib/_stream_duplex.js":311,"./lib/_stream_passthrough.js":312,"./lib/_stream_readable.js":313,"./lib/_stream_transform.js":314,"./lib/_stream_writable.js":315}],320:[function(require,module,exports){
|
|
module.exports = require('./readable').Transform
|
|
|
|
},{"./readable":319}],321:[function(require,module,exports){
|
|
module.exports = require('./lib/_stream_writable.js');
|
|
|
|
},{"./lib/_stream_writable.js":315}],322:[function(require,module,exports){
|
|
(function (global){
|
|
/**
|
|
* 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 Op = Object.prototype;
|
|
var hasOwn = Op.hasOwnProperty;
|
|
var undefined; // More compressible than void 0.
|
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
|
|
var inModule = typeof 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 and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
var generator = Object.create(protoGenerator.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() {}
|
|
|
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|
// don't natively support it.
|
|
var IteratorPrototype = {};
|
|
IteratorPrototype[iteratorSymbol] = function () {
|
|
return this;
|
|
};
|
|
|
|
var getProto = Object.getPrototypeOf;
|
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
if (NativeIteratorPrototype &&
|
|
NativeIteratorPrototype !== Op &&
|
|
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
// of the polyfill.
|
|
IteratorPrototype = NativeIteratorPrototype;
|
|
}
|
|
|
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|
Generator.prototype = Object.create(IteratorPrototype);
|
|
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 (Object.setPrototypeOf) {
|
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
} else {
|
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
if (!(toStringTagSymbol in genFun)) {
|
|
genFun[toStringTagSymbol] = "GeneratorFunction";
|
|
}
|
|
}
|
|
genFun.prototype = Object.create(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
|
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
// meant to be awaited.
|
|
runtime.awrap = function(arg) {
|
|
return { __await: 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 &&
|
|
typeof value === "object" &&
|
|
hasOwn.call(value, "__await")) {
|
|
return Promise.resolve(value.__await).then(function(value) {
|
|
invoke("next", value, resolve, reject);
|
|
}, function(err) {
|
|
invoke("throw", err, resolve, reject);
|
|
});
|
|
}
|
|
|
|
return Promise.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 global.process === "object" && global.process.domain) {
|
|
invoke = global.process.domain.bind(invoke);
|
|
}
|
|
|
|
var previousPromise;
|
|
|
|
function enqueue(method, arg) {
|
|
function callInvokeWithMethodAndArg() {
|
|
return new Promise(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);
|
|
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
return this;
|
|
};
|
|
runtime.AsyncIterator = AsyncIterator;
|
|
|
|
// 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();
|
|
}
|
|
|
|
context.method = method;
|
|
context.arg = arg;
|
|
|
|
while (true) {
|
|
var delegate = context.delegate;
|
|
if (delegate) {
|
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
if (delegateResult) {
|
|
if (delegateResult === ContinueSentinel) continue;
|
|
return delegateResult;
|
|
}
|
|
}
|
|
|
|
if (context.method === "next") {
|
|
// Setting context._sent for legacy support of Babel's
|
|
// function.sent implementation.
|
|
context.sent = context._sent = context.arg;
|
|
|
|
} else if (context.method === "throw") {
|
|
if (state === GenStateSuspendedStart) {
|
|
state = GenStateCompleted;
|
|
throw context.arg;
|
|
}
|
|
|
|
context.dispatchException(context.arg);
|
|
|
|
} else if (context.method === "return") {
|
|
context.abrupt("return", context.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;
|
|
|
|
if (record.arg === ContinueSentinel) {
|
|
continue;
|
|
}
|
|
|
|
return {
|
|
value: record.arg,
|
|
done: context.done
|
|
};
|
|
|
|
} else if (record.type === "throw") {
|
|
state = GenStateCompleted;
|
|
// Dispatch the exception by looping back around to the
|
|
// context.dispatchException(context.arg) call above.
|
|
context.method = "throw";
|
|
context.arg = record.arg;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
// result, either by returning a { value, done } result from the
|
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
function maybeInvokeDelegate(delegate, context) {
|
|
var method = delegate.iterator[context.method];
|
|
if (method === undefined) {
|
|
// A .throw or .return when the delegate iterator has no .throw
|
|
// method always terminates the yield* loop.
|
|
context.delegate = null;
|
|
|
|
if (context.method === "throw") {
|
|
if (delegate.iterator.return) {
|
|
// If the delegate iterator has a return method, give it a
|
|
// chance to clean up.
|
|
context.method = "return";
|
|
context.arg = undefined;
|
|
maybeInvokeDelegate(delegate, context);
|
|
|
|
if (context.method === "throw") {
|
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
// "return" to "throw", let that override the TypeError below.
|
|
return ContinueSentinel;
|
|
}
|
|
}
|
|
|
|
context.method = "throw";
|
|
context.arg = new TypeError(
|
|
"The iterator does not provide a 'throw' method");
|
|
}
|
|
|
|
return ContinueSentinel;
|
|
}
|
|
|
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
|
|
if (record.type === "throw") {
|
|
context.method = "throw";
|
|
context.arg = record.arg;
|
|
context.delegate = null;
|
|
return ContinueSentinel;
|
|
}
|
|
|
|
var info = record.arg;
|
|
|
|
if (! info) {
|
|
context.method = "throw";
|
|
context.arg = new TypeError("iterator result is not an object");
|
|
context.delegate = null;
|
|
return ContinueSentinel;
|
|
}
|
|
|
|
if (info.done) {
|
|
// Assign the result of the finished delegate to the temporary
|
|
// variable specified by delegate.resultName (see delegateYield).
|
|
context[delegate.resultName] = info.value;
|
|
|
|
// Resume execution at the desired location (see delegateYield).
|
|
context.next = delegate.nextLoc;
|
|
|
|
// If context.method was "throw" but the delegate handled the
|
|
// exception, let the outer generator proceed normally. If
|
|
// context.method was "next", forget context.arg since it has been
|
|
// "consumed" by the delegate iterator. If context.method was
|
|
// "return", allow the original .return call to continue in the
|
|
// outer generator.
|
|
if (context.method !== "return") {
|
|
context.method = "next";
|
|
context.arg = undefined;
|
|
}
|
|
|
|
} else {
|
|
// Re-yield the result returned by the delegate method.
|
|
return info;
|
|
}
|
|
|
|
// The delegate iterator is finished, so forget it and continue with
|
|
// the outer generator.
|
|
context.delegate = null;
|
|
return ContinueSentinel;
|
|
}
|
|
|
|
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
// unified ._invoke helper method.
|
|
defineIteratorMethods(Gp);
|
|
|
|
Gp[toStringTagSymbol] = "Generator";
|
|
|
|
// A Generator should always return itself as the iterator object when the
|
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
Gp[iteratorSymbol] = function() {
|
|
return this;
|
|
};
|
|
|
|
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(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.method = "next";
|
|
this.arg = undefined;
|
|
|
|
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() {
|
|
this.done = true;
|
|
|
|
var rootEntry = this.tryEntries[0];
|
|
var rootRecord = rootEntry.completion;
|
|
if (rootRecord.type === "throw") {
|
|
throw rootRecord.arg;
|
|
}
|
|
|
|
return this.rval;
|
|
},
|
|
|
|
dispatchException: function(exception) {
|
|
if (this.done) {
|
|
throw exception;
|
|
}
|
|
|
|
var context = this;
|
|
function handle(loc, caught) {
|
|
record.type = "throw";
|
|
record.arg = exception;
|
|
context.next = loc;
|
|
|
|
if (caught) {
|
|
// If the dispatched exception was caught by a catch block,
|
|
// then let that catch block handle the exception normally.
|
|
context.method = "next";
|
|
context.arg = undefined;
|
|
}
|
|
|
|
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(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.method = "next";
|
|
this.next = finallyEntry.finallyLoc;
|
|
return ContinueSentinel;
|
|
}
|
|
|
|
return this.complete(record);
|
|
},
|
|
|
|
complete: function(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 = this.arg = record.arg;
|
|
this.method = "return";
|
|
this.next = "end";
|
|
} else if (record.type === "normal" && afterLoc) {
|
|
this.next = afterLoc;
|
|
}
|
|
|
|
return ContinueSentinel;
|
|
},
|
|
|
|
finish: function(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(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(iterable, resultName, nextLoc) {
|
|
this.delegate = {
|
|
iterator: values(iterable),
|
|
resultName: resultName,
|
|
nextLoc: nextLoc
|
|
};
|
|
|
|
if (this.method === "next") {
|
|
// Deliberately forget the last sent value so that we don't
|
|
// accidentally pass it on to the delegate.
|
|
this.arg = undefined;
|
|
}
|
|
|
|
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 === "object" ? global :
|
|
typeof window === "object" ? window :
|
|
typeof self === "object" ? self : this
|
|
);
|
|
|
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
},{}],323:[function(require,module,exports){
|
|
module.exports = require('buffer')
|
|
|
|
},{"buffer":7}],324:[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.
|
|
|
|
module.exports = Stream;
|
|
|
|
var EE = require('events').EventEmitter;
|
|
var inherits = require('inherits');
|
|
|
|
inherits(Stream, EE);
|
|
Stream.Readable = require('readable-stream/readable.js');
|
|
Stream.Writable = require('readable-stream/writable.js');
|
|
Stream.Duplex = require('readable-stream/duplex.js');
|
|
Stream.Transform = require('readable-stream/transform.js');
|
|
Stream.PassThrough = require('readable-stream/passthrough.js');
|
|
|
|
// Backwards-compat with node 0.4.x
|
|
Stream.Stream = Stream;
|
|
|
|
|
|
|
|
// old-style streams. Note that the pipe method (the only relevant
|
|
// part of this class) is overridden in the Readable class.
|
|
|
|
function Stream() {
|
|
EE.call(this);
|
|
}
|
|
|
|
Stream.prototype.pipe = function(dest, options) {
|
|
var source = this;
|
|
|
|
function ondata(chunk) {
|
|
if (dest.writable) {
|
|
if (false === dest.write(chunk) && source.pause) {
|
|
source.pause();
|
|
}
|
|
}
|
|
}
|
|
|
|
source.on('data', ondata);
|
|
|
|
function ondrain() {
|
|
if (source.readable && source.resume) {
|
|
source.resume();
|
|
}
|
|
}
|
|
|
|
dest.on('drain', ondrain);
|
|
|
|
// If the 'end' option is not supplied, dest.end() will be called when
|
|
// source gets the 'end' or 'close' events. Only dest.end() once.
|
|
if (!dest._isStdio && (!options || options.end !== false)) {
|
|
source.on('end', onend);
|
|
source.on('close', onclose);
|
|
}
|
|
|
|
var didOnEnd = false;
|
|
function onend() {
|
|
if (didOnEnd) return;
|
|
didOnEnd = true;
|
|
|
|
dest.end();
|
|
}
|
|
|
|
|
|
function onclose() {
|
|
if (didOnEnd) return;
|
|
didOnEnd = true;
|
|
|
|
if (typeof dest.destroy === 'function') dest.destroy();
|
|
}
|
|
|
|
// don't leave dangling pipes when there are errors.
|
|
function onerror(er) {
|
|
cleanup();
|
|
if (EE.listenerCount(this, 'error') === 0) {
|
|
throw er; // Unhandled stream error in pipe.
|
|
}
|
|
}
|
|
|
|
source.on('error', onerror);
|
|
dest.on('error', onerror);
|
|
|
|
// remove all the event listeners that were added.
|
|
function cleanup() {
|
|
source.removeListener('data', ondata);
|
|
dest.removeListener('drain', ondrain);
|
|
|
|
source.removeListener('end', onend);
|
|
source.removeListener('close', onclose);
|
|
|
|
source.removeListener('error', onerror);
|
|
dest.removeListener('error', onerror);
|
|
|
|
source.removeListener('end', cleanup);
|
|
source.removeListener('close', cleanup);
|
|
|
|
dest.removeListener('close', cleanup);
|
|
}
|
|
|
|
source.on('end', cleanup);
|
|
source.on('close', cleanup);
|
|
|
|
dest.on('close', cleanup);
|
|
|
|
dest.emit('pipe', source);
|
|
|
|
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
|
return dest;
|
|
};
|
|
|
|
},{"events":303,"inherits":305,"readable-stream/duplex.js":310,"readable-stream/passthrough.js":318,"readable-stream/readable.js":319,"readable-stream/transform.js":320,"readable-stream/writable.js":321}],325:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var Buffer = require('safe-buffer').Buffer;
|
|
|
|
var isEncoding = Buffer.isEncoding || function (encoding) {
|
|
encoding = '' + encoding;
|
|
switch (encoding && encoding.toLowerCase()) {
|
|
case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
};
|
|
|
|
function _normalizeEncoding(enc) {
|
|
if (!enc) return 'utf8';
|
|
var retried;
|
|
while (true) {
|
|
switch (enc) {
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
return 'utf8';
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return 'utf16le';
|
|
case 'latin1':
|
|
case 'binary':
|
|
return 'latin1';
|
|
case 'base64':
|
|
case 'ascii':
|
|
case 'hex':
|
|
return enc;
|
|
default:
|
|
if (retried) return; // undefined
|
|
enc = ('' + enc).toLowerCase();
|
|
retried = true;
|
|
}
|
|
}
|
|
};
|
|
|
|
// Do not cache `Buffer.isEncoding` when checking encoding names as some
|
|
// modules monkey-patch it to support additional encodings
|
|
function normalizeEncoding(enc) {
|
|
var nenc = _normalizeEncoding(enc);
|
|
if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
|
return nenc || enc;
|
|
}
|
|
|
|
// StringDecoder provides an interface for efficiently splitting a series of
|
|
// buffers into a series of JS strings without breaking apart multi-byte
|
|
// characters.
|
|
exports.StringDecoder = StringDecoder;
|
|
function StringDecoder(encoding) {
|
|
this.encoding = normalizeEncoding(encoding);
|
|
var nb;
|
|
switch (this.encoding) {
|
|
case 'utf16le':
|
|
this.text = utf16Text;
|
|
this.end = utf16End;
|
|
nb = 4;
|
|
break;
|
|
case 'utf8':
|
|
this.fillLast = utf8FillLast;
|
|
nb = 4;
|
|
break;
|
|
case 'base64':
|
|
this.text = base64Text;
|
|
this.end = base64End;
|
|
nb = 3;
|
|
break;
|
|
default:
|
|
this.write = simpleWrite;
|
|
this.end = simpleEnd;
|
|
return;
|
|
}
|
|
this.lastNeed = 0;
|
|
this.lastTotal = 0;
|
|
this.lastChar = Buffer.allocUnsafe(nb);
|
|
}
|
|
|
|
StringDecoder.prototype.write = function (buf) {
|
|
if (buf.length === 0) return '';
|
|
var r;
|
|
var i;
|
|
if (this.lastNeed) {
|
|
r = this.fillLast(buf);
|
|
if (r === undefined) return '';
|
|
i = this.lastNeed;
|
|
this.lastNeed = 0;
|
|
} else {
|
|
i = 0;
|
|
}
|
|
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
|
return r || '';
|
|
};
|
|
|
|
StringDecoder.prototype.end = utf8End;
|
|
|
|
// Returns only complete characters in a Buffer
|
|
StringDecoder.prototype.text = utf8Text;
|
|
|
|
// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
|
StringDecoder.prototype.fillLast = function (buf) {
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
};
|
|
|
|
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
|
// continuation byte.
|
|
function utf8CheckByte(byte) {
|
|
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
|
return -1;
|
|
}
|
|
|
|
// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
|
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
|
// needed to complete the UTF-8 character (if applicable) are returned.
|
|
function utf8CheckIncomplete(self, buf, i) {
|
|
var j = buf.length - 1;
|
|
if (j < i) return 0;
|
|
var nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 1;
|
|
return nb;
|
|
}
|
|
if (--j < i) return 0;
|
|
nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) self.lastNeed = nb - 2;
|
|
return nb;
|
|
}
|
|
if (--j < i) return 0;
|
|
nb = utf8CheckByte(buf[j]);
|
|
if (nb >= 0) {
|
|
if (nb > 0) {
|
|
if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
|
}
|
|
return nb;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
|
// needed or are available. If we see a non-continuation byte where we expect
|
|
// one, we "replace" the validated continuation bytes we've seen so far with
|
|
// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding
|
|
// behavior. The continuation byte check is included three times in the case
|
|
// where all of the continuation bytes for a character exist in the same buffer.
|
|
// It is also done this way as a slight performance increase instead of using a
|
|
// loop.
|
|
function utf8CheckExtraBytes(self, buf, p) {
|
|
if ((buf[0] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 0;
|
|
return '\ufffd'.repeat(p);
|
|
}
|
|
if (self.lastNeed > 1 && buf.length > 1) {
|
|
if ((buf[1] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 1;
|
|
return '\ufffd'.repeat(p + 1);
|
|
}
|
|
if (self.lastNeed > 2 && buf.length > 2) {
|
|
if ((buf[2] & 0xC0) !== 0x80) {
|
|
self.lastNeed = 2;
|
|
return '\ufffd'.repeat(p + 2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
|
|
function utf8FillLast(buf) {
|
|
var p = this.lastTotal - this.lastNeed;
|
|
var r = utf8CheckExtraBytes(this, buf, p);
|
|
if (r !== undefined) return r;
|
|
if (this.lastNeed <= buf.length) {
|
|
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
|
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
}
|
|
buf.copy(this.lastChar, p, 0, buf.length);
|
|
this.lastNeed -= buf.length;
|
|
}
|
|
|
|
// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
|
|
// partial character, the character's bytes are buffered until the required
|
|
// number of bytes are available.
|
|
function utf8Text(buf, i) {
|
|
var total = utf8CheckIncomplete(this, buf, i);
|
|
if (!this.lastNeed) return buf.toString('utf8', i);
|
|
this.lastTotal = total;
|
|
var end = buf.length - (total - this.lastNeed);
|
|
buf.copy(this.lastChar, 0, end);
|
|
return buf.toString('utf8', i, end);
|
|
}
|
|
|
|
// For UTF-8, a replacement character for each buffered byte of a (partial)
|
|
// character needs to be added to the output.
|
|
function utf8End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed);
|
|
return r;
|
|
}
|
|
|
|
// UTF-16LE typically needs two bytes per character, but even if we have an even
|
|
// number of bytes available, we need to check if we end on a leading/high
|
|
// surrogate. In that case, we need to wait for the next two bytes in order to
|
|
// decode the last character properly.
|
|
function utf16Text(buf, i) {
|
|
if ((buf.length - i) % 2 === 0) {
|
|
var r = buf.toString('utf16le', i);
|
|
if (r) {
|
|
var c = r.charCodeAt(r.length - 1);
|
|
if (c >= 0xD800 && c <= 0xDBFF) {
|
|
this.lastNeed = 2;
|
|
this.lastTotal = 4;
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
return r.slice(0, -1);
|
|
}
|
|
}
|
|
return r;
|
|
}
|
|
this.lastNeed = 1;
|
|
this.lastTotal = 2;
|
|
this.lastChar[0] = buf[buf.length - 1];
|
|
return buf.toString('utf16le', i, buf.length - 1);
|
|
}
|
|
|
|
// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
// end on a partial character, we simply let v8 handle that.
|
|
function utf16End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) {
|
|
var end = this.lastTotal - this.lastNeed;
|
|
return r + this.lastChar.toString('utf16le', 0, end);
|
|
}
|
|
return r;
|
|
}
|
|
|
|
function base64Text(buf, i) {
|
|
var n = (buf.length - i) % 3;
|
|
if (n === 0) return buf.toString('base64', i);
|
|
this.lastNeed = 3 - n;
|
|
this.lastTotal = 3;
|
|
if (n === 1) {
|
|
this.lastChar[0] = buf[buf.length - 1];
|
|
} else {
|
|
this.lastChar[0] = buf[buf.length - 2];
|
|
this.lastChar[1] = buf[buf.length - 1];
|
|
}
|
|
return buf.toString('base64', i, buf.length - n);
|
|
}
|
|
|
|
function base64End(buf) {
|
|
var r = buf && buf.length ? this.write(buf) : '';
|
|
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
|
return r;
|
|
}
|
|
|
|
// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
function simpleWrite(buf) {
|
|
return buf.toString(this.encoding);
|
|
}
|
|
|
|
function simpleEnd(buf) {
|
|
return buf && buf.length ? this.write(buf) : '';
|
|
}
|
|
},{"safe-buffer":323}],326:[function(require,module,exports){
|
|
(function (global){
|
|
|
|
/**
|
|
* Module exports.
|
|
*/
|
|
|
|
module.exports = deprecate;
|
|
|
|
/**
|
|
* Mark that a method should not be used.
|
|
* Returns a modified function which warns once by default.
|
|
*
|
|
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
|
*
|
|
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
|
* will throw an Error when invoked.
|
|
*
|
|
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
|
* will invoke `console.trace()` instead of `console.error()`.
|
|
*
|
|
* @param {Function} fn - the function to deprecate
|
|
* @param {String} msg - the string to print to the console when `fn` is invoked
|
|
* @returns {Function} a new "deprecated" version of `fn`
|
|
* @api public
|
|
*/
|
|
|
|
function deprecate (fn, msg) {
|
|
if (config('noDeprecation')) {
|
|
return fn;
|
|
}
|
|
|
|
var warned = false;
|
|
function deprecated() {
|
|
if (!warned) {
|
|
if (config('throwDeprecation')) {
|
|
throw new Error(msg);
|
|
} else if (config('traceDeprecation')) {
|
|
console.trace(msg);
|
|
} else {
|
|
console.warn(msg);
|
|
}
|
|
warned = true;
|
|
}
|
|
return fn.apply(this, arguments);
|
|
}
|
|
|
|
return deprecated;
|
|
}
|
|
|
|
/**
|
|
* Checks `localStorage` for boolean values for the given `name`.
|
|
*
|
|
* @param {String} name
|
|
* @returns {Boolean}
|
|
* @api private
|
|
*/
|
|
|
|
function config (name) {
|
|
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
|
try {
|
|
if (!global.localStorage) return false;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
var val = global.localStorage[name];
|
|
if (null == val) return false;
|
|
return String(val).toLowerCase() === 'true';
|
|
}
|
|
|
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
},{}],327:[function(require,module,exports){
|
|
(function (Buffer){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _stream = require('stream');
|
|
|
|
var _stream2 = _interopRequireDefault(_stream);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var WriteStreamEs6 = function (_stream$Writable) {
|
|
_inherits(WriteStreamEs6, _stream$Writable);
|
|
|
|
function WriteStreamEs6(writer, options) {
|
|
_classCallCheck(this, WriteStreamEs6);
|
|
|
|
var _this = _possibleConstructorReturn(this, (WriteStreamEs6.__proto__ || Object.getPrototypeOf(WriteStreamEs6)).call(this, options));
|
|
|
|
_this.writer = writer;
|
|
return _this;
|
|
}
|
|
|
|
_createClass(WriteStreamEs6, [{
|
|
key: '_write',
|
|
value: function () {
|
|
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(chunk, enc, next) {
|
|
var file;
|
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return this.writer;
|
|
|
|
case 2:
|
|
file = _context.sent;
|
|
_context.next = 5;
|
|
return file.write(this._createBlob(chunk));
|
|
|
|
case 5:
|
|
next();
|
|
|
|
case 6:
|
|
case 'end':
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee, this);
|
|
}));
|
|
|
|
function _write(_x, _x2, _x3) {
|
|
return _ref.apply(this, arguments);
|
|
}
|
|
|
|
return _write;
|
|
}()
|
|
}, {
|
|
key: '_createBlob',
|
|
value: function _createBlob(buffer) {
|
|
var buf = new Buffer(buffer.byteLength);
|
|
for (var i = 0; i < buf.length; ++i) {
|
|
buf[i] = buffer[i];
|
|
}return new Blob([buf]);
|
|
}
|
|
}]);
|
|
|
|
return WriteStreamEs6;
|
|
}(_stream2.default.Writable);
|
|
|
|
exports.default = WriteStreamEs6;
|
|
|
|
}).call(this,require("buffer").Buffer)
|
|
},{"buffer":7,"stream":324}],328:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = typeof window !== 'undefined' ? FileReader : function () {};
|
|
|
|
},{}],329:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = typeof window !== 'undefined' ? window : { TEMPORARY: 0, PERSISTENT: 1, requestFileSystem: function requestFileSystem() {} };
|
|
|
|
},{}]},{},[3]);
|
|
|