From 7dd2cd480ddc3e1a3310eb404f0fdb7585e9074f Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 14:16:07 -0700 Subject: [PATCH 01/66] Add a simple tsconfig.json that allows JavaScript --- .gitignore | 3 +- package-lock.json | 22 +++++++++- package.json | 3 +- tsconfig.json | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 051296076..de8261ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ doc node_modules *.out *.log -*.tar.gz \ No newline at end of file +*.tar.gz +tsbuild diff --git a/package-lock.json b/package-lock.json index af004e14e..c48ed6695 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,8 @@ "load-grunt-tasks": "^5.1.0", "mocha": "^10.0.0", "puppeteer": "^21.0.1", - "time-grunt": "^2.0.0" + "time-grunt": "^2.0.0", + "typescript": "^5.2.2" }, "engines": { "node": ">=0.10" @@ -6835,6 +6836,19 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/ua-parser-js": { "version": "0.7.33", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", @@ -12667,6 +12681,12 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true + }, "ua-parser-js": { "version": "0.7.33", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", diff --git a/package.json b/package.json index 4235c3ff4..b5b000844 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "load-grunt-tasks": "^5.1.0", "mocha": "^10.0.0", "puppeteer": "^21.0.1", - "time-grunt": "^2.0.0" + "time-grunt": "^2.0.0", + "typescript": "^5.2.2" }, "dependencies": { "@xmldom/xmldom": "^0.8.0", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..b38a2eb77 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,110 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": "./src", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./tsbuild", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": ["src"] +} From 7c2123a0fa7878d894a6f5ce812f6744f3ef04e0 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 14:29:44 -0700 Subject: [PATCH 02/66] Auto-refactor protos to classes via IntelliSense --- src/actionlib/ActionClient.js | 218 ++--- src/actionlib/ActionListener.js | 93 +- src/actionlib/Goal.js | 118 +-- src/actionlib/SimpleActionServer.js | 270 +++--- src/core/Param.js | 120 +-- src/core/Ros.js | 1274 ++++++++++++++------------- src/core/Service.js | 180 ++-- src/core/Topic.js | 349 ++++---- src/math/Pose.js | 103 +-- src/math/Quaternion.js | 142 +-- src/math/Transform.js | 28 +- src/math/Vector3.js | 96 +- src/node/RosTCP.js | 94 +- src/node/SocketIO.js | 43 +- src/tf/TFClient.js | 365 ++++---- src/urdf/UrdfBox.js | 22 +- src/urdf/UrdfColor.js | 16 +- src/urdf/UrdfCylinder.js | 10 +- src/urdf/UrdfJoint.js | 132 +-- src/urdf/UrdfLink.js | 20 +- src/urdf/UrdfMaterial.js | 50 +- src/urdf/UrdfMesh.js | 30 +- src/urdf/UrdfModel.js | 117 +-- src/urdf/UrdfSphere.js | 8 +- src/urdf/UrdfVisual.js | 190 ++-- src/util/workerSocket.js | 69 +- 26 files changed, 2126 insertions(+), 2031 deletions(-) diff --git a/src/actionlib/ActionClient.js b/src/actionlib/ActionClient.js index e0772c1e0..9f4e6f148 100644 --- a/src/actionlib/ActionClient.js +++ b/src/actionlib/ActionClient.js @@ -26,121 +26,127 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. */ -function ActionClient(options) { - var that = this; - options = options || {}; - this.ros = options.ros; - this.serverName = options.serverName; - this.actionName = options.actionName; - this.timeout = options.timeout; - this.omitFeedback = options.omitFeedback; - this.omitStatus = options.omitStatus; - this.omitResult = options.omitResult; - this.goals = {}; - - // flag to check if a status has been received - var receivedStatus = false; - - // create the topics associated with actionlib - this.feedbackListener = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' - }); - - this.statusListener = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' - }); - - this.resultListener = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' - }); - - this.goalTopic = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' - }); - - this.cancelTopic = new Topic({ - ros : this.ros, - name : this.serverName + '/cancel', - messageType : 'actionlib_msgs/GoalID' - }); - - // advertise the goal and cancel topics - this.goalTopic.advertise(); - this.cancelTopic.advertise(); - - // subscribe to the status topic - if (!this.omitStatus) { - this.statusListener.subscribe(function(statusMessage) { - receivedStatus = true; - statusMessage.status_list.forEach(function(status) { - var goal = that.goals[status.goal_id.id]; - if (goal) { - goal.emit('status', status); - } - }); +class ActionClient extends EventEmitter2 { + constructor(options) { + super(options); + var that = this; + options = options || {}; + this.ros = options.ros; + this.serverName = options.serverName; + this.actionName = options.actionName; + this.timeout = options.timeout; + this.omitFeedback = options.omitFeedback; + this.omitStatus = options.omitStatus; + this.omitResult = options.omitResult; + this.goals = {}; + + // flag to check if a status has been received + var receivedStatus = false; + + // create the topics associated with actionlib + this.feedbackListener = new Topic({ + ros: this.ros, + name: this.serverName + "/feedback", + messageType: this.actionName + "Feedback", }); - } - // subscribe the the feedback topic - if (!this.omitFeedback) { - this.feedbackListener.subscribe(function(feedbackMessage) { - var goal = that.goals[feedbackMessage.status.goal_id.id]; - if (goal) { - goal.emit('status', feedbackMessage.status); - goal.emit('feedback', feedbackMessage.feedback); - } + this.statusListener = new Topic({ + ros: this.ros, + name: this.serverName + "/status", + messageType: "actionlib_msgs/GoalStatusArray", }); - } - // subscribe to the result topic - if (!this.omitResult) { - this.resultListener.subscribe(function(resultMessage) { - var goal = that.goals[resultMessage.status.goal_id.id]; + this.resultListener = new Topic({ + ros: this.ros, + name: this.serverName + "/result", + messageType: this.actionName + "Result", + }); - if (goal) { - goal.emit('status', resultMessage.status); - goal.emit('result', resultMessage.result); - } + this.goalTopic = new Topic({ + ros: this.ros, + name: this.serverName + "/goal", + messageType: this.actionName + "Goal", }); - } - // If timeout specified, emit a 'timeout' event if the action server does not respond - if (this.timeout) { - setTimeout(function() { - if (!receivedStatus) { - that.emit('timeout'); - } - }, this.timeout); - } -} + this.cancelTopic = new Topic({ + ros: this.ros, + name: this.serverName + "/cancel", + messageType: "actionlib_msgs/GoalID", + }); -ActionClient.prototype.__proto__ = EventEmitter2.prototype; + // advertise the goal and cancel topics + this.goalTopic.advertise(); + this.cancelTopic.advertise(); + + // subscribe to the status topic + if (!this.omitStatus) { + this.statusListener.subscribe(function (statusMessage) { + receivedStatus = true; + statusMessage.status_list.forEach(function (status) { + var goal = that.goals[status.goal_id.id]; + if (goal) { + goal.emit("status", status); + } + }); + }); + } -/** - * Cancel all goals associated with this ActionClient. - */ -ActionClient.prototype.cancel = function() { - var cancelMessage = new Message(); - this.cancelTopic.publish(cancelMessage); -}; + // subscribe the the feedback topic + if (!this.omitFeedback) { + this.feedbackListener.subscribe(function (feedbackMessage) { + var goal = that.goals[feedbackMessage.status.goal_id.id]; + if (goal) { + goal.emit("status", feedbackMessage.status); + goal.emit("feedback", feedbackMessage.feedback); + } + }); + } + + // subscribe to the result topic + if (!this.omitResult) { + this.resultListener.subscribe(function (resultMessage) { + var goal = that.goals[resultMessage.status.goal_id.id]; + + if (goal) { + goal.emit("status", resultMessage.status); + goal.emit("result", resultMessage.result); + } + }); + } + + // If timeout specified, emit a 'timeout' event if the action server does not respond + if (this.timeout) { + setTimeout(function () { + if (!receivedStatus) { + that.emit("timeout"); + } + }, this.timeout); + } + } + /** + * Cancel all goals associated with this ActionClient. + */ + cancel() { + var cancelMessage = new Message(); + this.cancelTopic.publish(cancelMessage); + } + /** + * Unsubscribe and unadvertise all topics associated with this ActionClient. + */ + dispose() { + this.goalTopic.unadvertise(); + this.cancelTopic.unadvertise(); + if (!this.omitStatus) { + this.statusListener.unsubscribe(); + } + if (!this.omitFeedback) { + this.feedbackListener.unsubscribe(); + } + if (!this.omitResult) { + this.resultListener.unsubscribe(); + } + } +} -/** - * Unsubscribe and unadvertise all topics associated with this ActionClient. - */ -ActionClient.prototype.dispose = function() { - this.goalTopic.unadvertise(); - this.cancelTopic.unadvertise(); - if (!this.omitStatus) {this.statusListener.unsubscribe();} - if (!this.omitFeedback) {this.feedbackListener.unsubscribe();} - if (!this.omitResult) {this.resultListener.unsubscribe();} -}; module.exports = ActionClient; diff --git a/src/actionlib/ActionListener.js b/src/actionlib/ActionListener.js index 0000944d7..912cb7906 100644 --- a/src/actionlib/ActionListener.js +++ b/src/actionlib/ActionListener.js @@ -22,62 +22,61 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {string} options.serverName - The action server name, like '/fibonacci'. * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. */ -function ActionListener(options) { - var that = this; - options = options || {}; - this.ros = options.ros; - this.serverName = options.serverName; - this.actionName = options.actionName; +class ActionListener extends EventEmitter2 { + constructor(options) { + super(options); + var that = this; + options = options || {}; + this.ros = options.ros; + this.serverName = options.serverName; + this.actionName = options.actionName; + // create the topics associated with actionlib + var goalListener = new Topic({ + ros: this.ros, + name: this.serverName + "/goal", + messageType: this.actionName + "Goal", + }); - // create the topics associated with actionlib - var goalListener = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' - }); + var feedbackListener = new Topic({ + ros: this.ros, + name: this.serverName + "/feedback", + messageType: this.actionName + "Feedback", + }); - var feedbackListener = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' - }); + var statusListener = new Topic({ + ros: this.ros, + name: this.serverName + "/status", + messageType: "actionlib_msgs/GoalStatusArray", + }); - var statusListener = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' - }); + var resultListener = new Topic({ + ros: this.ros, + name: this.serverName + "/result", + messageType: this.actionName + "Result", + }); - var resultListener = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' - }); + goalListener.subscribe(function (goalMessage) { + that.emit("goal", goalMessage); + }); - goalListener.subscribe(function(goalMessage) { - that.emit('goal', goalMessage); - }); - - statusListener.subscribe(function(statusMessage) { - statusMessage.status_list.forEach(function(status) { - that.emit('status', status); + statusListener.subscribe(function (statusMessage) { + statusMessage.status_list.forEach(function (status) { + that.emit("status", status); }); - }); - - feedbackListener.subscribe(function(feedbackMessage) { - that.emit('status', feedbackMessage.status); - that.emit('feedback', feedbackMessage.feedback); - }); + }); - // subscribe to the result topic - resultListener.subscribe(function(resultMessage) { - that.emit('status', resultMessage.status); - that.emit('result', resultMessage.result); - }); + feedbackListener.subscribe(function (feedbackMessage) { + that.emit("status", feedbackMessage.status); + that.emit("feedback", feedbackMessage.feedback); + }); + // subscribe to the result topic + resultListener.subscribe(function (resultMessage) { + that.emit("status", resultMessage.status); + that.emit("result", resultMessage.result); + }); + } } -ActionListener.prototype.__proto__ = EventEmitter2.prototype; - module.exports = ActionListener; diff --git a/src/actionlib/Goal.js b/src/actionlib/Goal.js index 6cdd5af41..a8c333b31 100644 --- a/src/actionlib/Goal.js +++ b/src/actionlib/Goal.js @@ -17,73 +17,73 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. */ -function Goal(options) { - var that = this; - this.actionClient = options.actionClient; - this.goalMessage = options.goalMessage; - this.isFinished = false; +class Goal extends EventEmitter2 { + constructor(options) { + super(options); + var that = this; + this.actionClient = options.actionClient; + this.goalMessage = options.goalMessage; + this.isFinished = false; - // Used to create random IDs - var date = new Date(); + // Used to create random IDs + var date = new Date(); - // Create a random ID - this.goalID = 'goal_' + Math.random() + '_' + date.getTime(); - // Fill in the goal message - this.goalMessage = new Message({ - goal_id : { - stamp : { - secs : 0, - nsecs : 0 + // Create a random ID + this.goalID = "goal_" + Math.random() + "_" + date.getTime(); + // Fill in the goal message + this.goalMessage = new Message({ + goal_id: { + stamp: { + secs: 0, + nsecs: 0, + }, + id: this.goalID, }, - id : this.goalID - }, - goal : this.goalMessage - }); + goal: this.goalMessage, + }); - this.on('status', function(status) { - that.status = status; - }); + this.on("status", function (status) { + that.status = status; + }); - this.on('result', function(result) { - that.isFinished = true; - that.result = result; - }); + this.on("result", function (result) { + that.isFinished = true; + that.result = result; + }); - this.on('feedback', function(feedback) { - that.feedback = feedback; - }); + this.on("feedback", function (feedback) { + that.feedback = feedback; + }); - // Add the goal - this.actionClient.goals[this.goalID] = this; -} - -Goal.prototype.__proto__ = EventEmitter2.prototype; - -/** - * Send the goal to the action server. - * - * @param {number} [timeout] - A timeout length for the goal's result. - */ -Goal.prototype.send = function(timeout) { - var that = this; - that.actionClient.goalTopic.publish(that.goalMessage); - if (timeout) { - setTimeout(function() { - if (!that.isFinished) { - that.emit('timeout'); - } - }, timeout); + // Add the goal + this.actionClient.goals[this.goalID] = this; } -}; + /** + * Send the goal to the action server. + * + * @param {number} [timeout] - A timeout length for the goal's result. + */ + send(timeout) { + var that = this; + that.actionClient.goalTopic.publish(that.goalMessage); + if (timeout) { + setTimeout(function () { + if (!that.isFinished) { + that.emit("timeout"); + } + }, timeout); + } + } + /** + * Cancel the current goal. + */ + cancel() { + var cancelMessage = new Message({ + id: this.goalID, + }); + this.actionClient.cancelTopic.publish(cancelMessage); + } +} -/** - * Cancel the current goal. - */ -Goal.prototype.cancel = function() { - var cancelMessage = new Message({ - id : this.goalID - }); - this.actionClient.cancelTopic.publish(cancelMessage); -}; module.exports = Goal; diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index f23a9064a..c500a9ba6 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -20,7 +20,9 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {string} options.serverName - The action server name, like '/fibonacci'. * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. */ -function SimpleActionServer(options) { +class SimpleActionServer extends EventEmitter2 { + constructor(options) { + super(options); var that = this; options = options || {}; this.ros = options.ros; @@ -29,197 +31,209 @@ function SimpleActionServer(options) { // create and advertise publishers this.feedbackPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' + ros: this.ros, + name: this.serverName + "/feedback", + messageType: this.actionName + "Feedback", }); this.feedbackPublisher.advertise(); var statusPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' + ros: this.ros, + name: this.serverName + "/status", + messageType: "actionlib_msgs/GoalStatusArray", }); statusPublisher.advertise(); this.resultPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' + ros: this.ros, + name: this.serverName + "/result", + messageType: this.actionName + "Result", }); this.resultPublisher.advertise(); // create and subscribe to listeners var goalListener = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' + ros: this.ros, + name: this.serverName + "/goal", + messageType: this.actionName + "Goal", }); var cancelListener = new Topic({ - ros : this.ros, - name : this.serverName + '/cancel', - messageType : 'actionlib_msgs/GoalID' + ros: this.ros, + name: this.serverName + "/cancel", + messageType: "actionlib_msgs/GoalID", }); // Track the goals and their status in order to publish status... this.statusMessage = new Message({ - header : { - stamp : {secs : 0, nsecs : 100}, - frame_id : '' - }, - status_list : [] + header: { + stamp: { secs: 0, nsecs: 100 }, + frame_id: "", + }, + status_list: [], }); // needed for handling preemption prompted by a new goal being received this.currentGoal = null; // currently tracked goal this.nextGoal = null; // the one that'll be preempting - goalListener.subscribe(function(goalMessage) { - - if(that.currentGoal) { - that.nextGoal = goalMessage; - // needs to happen AFTER rest is set up - that.emit('cancel'); - } else { - that.statusMessage.status_list = [{goal_id : goalMessage.goal_id, status : 1}]; - that.currentGoal = goalMessage; - that.emit('goal', goalMessage.goal); - } + goalListener.subscribe(function (goalMessage) { + if (that.currentGoal) { + that.nextGoal = goalMessage; + // needs to happen AFTER rest is set up + that.emit("cancel"); + } else { + that.statusMessage.status_list = [ + { goal_id: goalMessage.goal_id, status: 1 }, + ]; + that.currentGoal = goalMessage; + that.emit("goal", goalMessage.goal); + } }); // helper function to determine ordering of timestamps // returns t1 < t2 - var isEarlier = function(t1, t2) { - if(t1.secs > t2.secs) { - return false; - } else if(t1.secs < t2.secs) { - return true; - } else if(t1.nsecs < t2.nsecs) { - return true; - } else { - return false; - } + var isEarlier = function (t1, t2) { + if (t1.secs > t2.secs) { + return false; + } else if (t1.secs < t2.secs) { + return true; + } else if (t1.nsecs < t2.nsecs) { + return true; + } else { + return false; + } }; // TODO: this may be more complicated than necessary, since I'm // not sure if the callbacks can ever wind up with a scenario // where we've been preempted by a next goal, it hasn't finished // processing, and then we get a cancel message - cancelListener.subscribe(function(cancelMessage) { - - // cancel ALL goals if both empty - if(cancelMessage.stamp.secs === 0 && cancelMessage.stamp.secs === 0 && cancelMessage.id === '') { - that.nextGoal = null; - if(that.currentGoal) { - that.emit('cancel'); - } - } else { // treat id and stamp independently - if(that.currentGoal && cancelMessage.id === that.currentGoal.goal_id.id) { - that.emit('cancel'); - } else if(that.nextGoal && cancelMessage.id === that.nextGoal.goal_id.id) { - that.nextGoal = null; - } - - if(that.nextGoal && isEarlier(that.nextGoal.goal_id.stamp, - cancelMessage.stamp)) { - that.nextGoal = null; - } - if(that.currentGoal && isEarlier(that.currentGoal.goal_id.stamp, - cancelMessage.stamp)) { - that.emit('cancel'); - } + cancelListener.subscribe(function (cancelMessage) { + // cancel ALL goals if both empty + if ( + cancelMessage.stamp.secs === 0 && + cancelMessage.stamp.secs === 0 && + cancelMessage.id === "" + ) { + that.nextGoal = null; + if (that.currentGoal) { + that.emit("cancel"); + } + } else { + // treat id and stamp independently + if ( + that.currentGoal && + cancelMessage.id === that.currentGoal.goal_id.id + ) { + that.emit("cancel"); + } else if ( + that.nextGoal && + cancelMessage.id === that.nextGoal.goal_id.id + ) { + that.nextGoal = null; + } + + if ( + that.nextGoal && + isEarlier(that.nextGoal.goal_id.stamp, cancelMessage.stamp) + ) { + that.nextGoal = null; } + if ( + that.currentGoal && + isEarlier(that.currentGoal.goal_id.stamp, cancelMessage.stamp) + ) { + that.emit("cancel"); + } + } }); // publish status at pseudo-fixed rate; required for clients to know they've connected - var statusInterval = setInterval( function() { - var currentTime = new Date(); - var secs = Math.floor(currentTime.getTime()/1000); - var nsecs = Math.round(1000000000*(currentTime.getTime()/1000-secs)); - that.statusMessage.header.stamp.secs = secs; - that.statusMessage.header.stamp.nsecs = nsecs; - statusPublisher.publish(that.statusMessage); + var statusInterval = setInterval(function () { + var currentTime = new Date(); + var secs = Math.floor(currentTime.getTime() / 1000); + var nsecs = Math.round( + 1000000000 * (currentTime.getTime() / 1000 - secs) + ); + that.statusMessage.header.stamp.secs = secs; + that.statusMessage.header.stamp.nsecs = nsecs; + statusPublisher.publish(that.statusMessage); }, 500); // publish every 500ms - -} - -SimpleActionServer.prototype.__proto__ = EventEmitter2.prototype; - -/** - * Set action state to succeeded and return to client. - * - * @param {Object} result - The result to return to the client. - */ -SimpleActionServer.prototype.setSucceeded = function(result) { + } + /** + * Set action state to succeeded and return to client. + * + * @param {Object} result - The result to return to the client. + */ + setSucceeded(result) { var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 3}, - result : result + status: { goal_id: this.currentGoal.goal_id, status: 3 }, + result: result, }); this.resultPublisher.publish(resultMessage); this.statusMessage.status_list = []; - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit("goal", this.currentGoal.goal); } else { - this.currentGoal = null; + this.currentGoal = null; } -}; - -/** - * Set action state to aborted and return to client. - * - * @param {Object} result - The result to return to the client. - */ -SimpleActionServer.prototype.setAborted = function(result) { + } + /** + * Set action state to aborted and return to client. + * + * @param {Object} result - The result to return to the client. + */ + setAborted(result) { var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 4}, - result : result + status: { goal_id: this.currentGoal.goal_id, status: 4 }, + result: result, }); this.resultPublisher.publish(resultMessage); this.statusMessage.status_list = []; - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit("goal", this.currentGoal.goal); } else { - this.currentGoal = null; + this.currentGoal = null; } -}; - -/** - * Send a feedback message. - * - * @param {Object} feedback - The feedback to send to the client. - */ -SimpleActionServer.prototype.sendFeedback = function(feedback) { + } + /** + * Send a feedback message. + * + * @param {Object} feedback - The feedback to send to the client. + */ + sendFeedback(feedback) { var feedbackMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 1}, - feedback : feedback + status: { goal_id: this.currentGoal.goal_id, status: 1 }, + feedback: feedback, }); this.feedbackPublisher.publish(feedbackMessage); -}; - -/** - * Handle case where client requests preemption. - */ -SimpleActionServer.prototype.setPreempted = function() { + } + /** + * Handle case where client requests preemption. + */ + setPreempted() { this.statusMessage.status_list = []; var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 2}, + status: { goal_id: this.currentGoal.goal_id, status: 2 }, }); this.resultPublisher.publish(resultMessage); - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit("goal", this.currentGoal.goal); } else { - this.currentGoal = null; + this.currentGoal = null; } -}; + } +} + module.exports = SimpleActionServer; diff --git a/src/core/Param.js b/src/core/Param.js index 65416eae8..36f384d50 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -14,73 +14,75 @@ var ServiceRequest = require('./ServiceRequest'); * @param {Ros} options.ros - The ROSLIB.Ros connection handle. * @param {string} options.name - The param name, like max_vel_x. */ -function Param(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; -} +class Param { + constructor(options) { + options = options || {}; + this.ros = options.ros; + this.name = options.name; + } + /** + * Fetch the value of the param. + * + * @param {function} callback - Function with the following params: + * @param {Object} callback.value - The value of the param from ROS. + */ + get(callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/get_param", + serviceType: "rosapi/GetParam", + }); -/** - * Fetch the value of the param. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.value - The value of the param from ROS. - */ -Param.prototype.get = function(callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/get_param', - serviceType : 'rosapi/GetParam' - }); + var request = new ServiceRequest({ + name: this.name, + }); - var request = new ServiceRequest({ - name : this.name - }); + paramClient.callService(request, function (result) { + var value = JSON.parse(result.value); + callback(value); + }); + } + /** + * Set the value of the param in ROS. + * + * @param {Object} value - The value to set param to. + * @param {function} callback - The callback function. + */ + set(value, callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/set_param", + serviceType: "rosapi/SetParam", + }); - paramClient.callService(request, function(result) { - var value = JSON.parse(result.value); - callback(value); - }); -}; + var request = new ServiceRequest({ + name: this.name, + value: JSON.stringify(value), + }); -/** - * Set the value of the param in ROS. - * - * @param {Object} value - The value to set param to. - * @param {function} callback - The callback function. - */ -Param.prototype.set = function(value, callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/set_param', - serviceType : 'rosapi/SetParam' - }); + paramClient.callService(request, callback); + } + /** + * Delete this parameter on the ROS server. + * + * @param {function} callback - The callback function. + */ + delete(callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/delete_param", + serviceType: "rosapi/DeleteParam", + }); - var request = new ServiceRequest({ - name : this.name, - value : JSON.stringify(value) - }); + var request = new ServiceRequest({ + name: this.name, + }); - paramClient.callService(request, callback); -}; + paramClient.callService(request, callback); + } +} -/** - * Delete this parameter on the ROS server. - * - * @param {function} callback - The callback function. - */ -Param.prototype.delete = function(callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/delete_param', - serviceType : 'rosapi/DeleteParam' - }); - var request = new ServiceRequest({ - name : this.name - }); - paramClient.callService(request, callback); -}; module.exports = Param; diff --git a/src/core/Ros.js b/src/core/Ros.js index c80607d93..1199e1f3b 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -30,699 +30,703 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. */ -function Ros(options) { - options = options || {}; - var that = this; - this.socket = null; - this.idCounter = 0; - this.isConnected = false; - this.transportLibrary = options.transportLibrary || 'websocket'; - this.transportOptions = options.transportOptions || {}; - this._sendFunc = function(msg) { that.sendEncodedMessage(msg); }; - - if (typeof options.groovyCompatibility === 'undefined') { - this.groovyCompatibility = true; - } - else { - this.groovyCompatibility = options.groovyCompatibility; - } +class Ros extends EventEmitter2 { + constructor(options) { + super(options); + options = options || {}; + var that = this; + this.socket = null; + this.idCounter = 0; + this.isConnected = false; + this.transportLibrary = options.transportLibrary || "websocket"; + this.transportOptions = options.transportOptions || {}; + this._sendFunc = function (msg) { + that.sendEncodedMessage(msg); + }; + + if (typeof options.groovyCompatibility === "undefined") { + this.groovyCompatibility = true; + } else { + this.groovyCompatibility = options.groovyCompatibility; + } - // Sets unlimited event listeners. - this.setMaxListeners(0); + // Sets unlimited event listeners. + this.setMaxListeners(0); - // begin by checking if a URL was given - if (options.url) { - this.connect(options.url); + // begin by checking if a URL was given + if (options.url) { + this.connect(options.url); + } } -} - -Ros.prototype.__proto__ = EventEmitter2.prototype; - -/** - * Connect to the specified WebSocket. - * - * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. - */ -Ros.prototype.connect = function(url) { - if (this.transportLibrary === 'socket.io') { - this.socket = assign(io(url, {'force new connection': true}), socketAdapter(this)); - this.socket.on('connect', this.socket.onopen); - this.socket.on('data', this.socket.onmessage); - this.socket.on('close', this.socket.onclose); - this.socket.on('error', this.socket.onerror); - } else if (this.transportLibrary.constructor.name === 'RTCPeerConnection') { - this.socket = assign(this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this)); - } else if (this.transportLibrary === 'websocket') { - if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { - var sock = new WebSocket(url); - sock.binaryType = 'arraybuffer'; - this.socket = assign(sock, socketAdapter(this)); + /** + * Connect to the specified WebSocket. + * + * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. + */ + connect(url) { + if (this.transportLibrary === "socket.io") { + this.socket = assign( + io(url, { "force new connection": true }), + socketAdapter(this) + ); + this.socket.on("connect", this.socket.onopen); + this.socket.on("data", this.socket.onmessage); + this.socket.on("close", this.socket.onclose); + this.socket.on("error", this.socket.onerror); + } else if (this.transportLibrary.constructor.name === "RTCPeerConnection") { + this.socket = assign( + this.transportLibrary.createDataChannel(url, this.transportOptions), + socketAdapter(this) + ); + } else if (this.transportLibrary === "websocket") { + if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { + var sock = new WebSocket(url); + sock.binaryType = "arraybuffer"; + this.socket = assign(sock, socketAdapter(this)); + } + } else if (this.transportLibrary === "workersocket") { + this.socket = assign(new WorkerSocket(url), socketAdapter(this)); + } else { + throw "Unknown transportLibrary: " + this.transportLibrary.toString(); } - } else if (this.transportLibrary === 'workersocket') { - this.socket = assign(new WorkerSocket(url), socketAdapter(this)); - } else { - throw 'Unknown transportLibrary: ' + this.transportLibrary.toString(); } - -}; - -/** - * Disconnect from the WebSocket server. - */ -Ros.prototype.close = function() { - if (this.socket) { - this.socket.close(); + /** + * Disconnect from the WebSocket server. + */ + close() { + if (this.socket) { + this.socket.close(); + } } -}; - -/** - * Send an authorization request to the server. - * - * @param {string} mac - MAC (hash) string given by the trusted source. - * @param {string} client - IP of the client. - * @param {string} dest - IP of the destination. - * @param {string} rand - Random string given by the trusted source. - * @param {Object} t - Time of the authorization request. - * @param {string} level - User level as a string given by the client. - * @param {Object} end - End time of the client's session. - */ -Ros.prototype.authenticate = function(mac, client, dest, rand, t, level, end) { - // create the request - var auth = { - op : 'auth', - mac : mac, - client : client, - dest : dest, - rand : rand, - t : t, - level : level, - end : end - }; - // send the request - this.callOnConnection(auth); -}; - -/** - * Send an encoded message over the WebSocket. - * - * @param {Object} messageEncoded - The encoded message to be sent. - */ -Ros.prototype.sendEncodedMessage = function(messageEncoded) { - var emitter = null; - var that = this; - if (this.transportLibrary === 'socket.io') { - emitter = function(msg){that.socket.emit('operation', msg);}; - } else { - emitter = function(msg){that.socket.send(msg);}; + /** + * Send an authorization request to the server. + * + * @param {string} mac - MAC (hash) string given by the trusted source. + * @param {string} client - IP of the client. + * @param {string} dest - IP of the destination. + * @param {string} rand - Random string given by the trusted source. + * @param {Object} t - Time of the authorization request. + * @param {string} level - User level as a string given by the client. + * @param {Object} end - End time of the client's session. + */ + authenticate(mac, client, dest, rand, t, level, end) { + // create the request + var auth = { + op: "auth", + mac: mac, + client: client, + dest: dest, + rand: rand, + t: t, + level: level, + end: end, + }; + // send the request + this.callOnConnection(auth); } + /** + * Send an encoded message over the WebSocket. + * + * @param {Object} messageEncoded - The encoded message to be sent. + */ + sendEncodedMessage(messageEncoded) { + var emitter = null; + var that = this; + if (this.transportLibrary === "socket.io") { + emitter = function (msg) { + that.socket.emit("operation", msg); + }; + } else { + emitter = function (msg) { + that.socket.send(msg); + }; + } - if (!this.isConnected) { - that.once('connection', function() { + if (!this.isConnected) { + that.once("connection", function () { + emitter(messageEncoded); + }); + } else { emitter(messageEncoded); - }); - } else { - emitter(messageEncoded); + } } -}; - -/** - * Send the message over the WebSocket, but queue the message up if not yet - * connected. - * - * @param {Object} message - The message to be sent. - */ -Ros.prototype.callOnConnection = function(message) { - if (this.transportOptions.encoder) { - this.transportOptions.encoder(message, this._sendFunc); - } else { - this._sendFunc(JSON.stringify(message)); + /** + * Send the message over the WebSocket, but queue the message up if not yet + * connected. + * + * @param {Object} message - The message to be sent. + */ + callOnConnection(message) { + if (this.transportOptions.encoder) { + this.transportOptions.encoder(message, this._sendFunc); + } else { + this._sendFunc(JSON.stringify(message)); + } } -}; - -/** - * Send a set_level request to the server. - * - * @param {string} level - Status level (none, error, warning, info). - * @param {number} [id] - Operation ID to change status level on. - */ -Ros.prototype.setStatusLevel = function(level, id){ - var levelMsg = { - op: 'set_level', - level: level, - id: id - }; - - this.callOnConnection(levelMsg); -}; - -/** - * Retrieve a list of action servers in ROS as an array of string. - * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.actionservers - Array of action server names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getActionServers = function(callback, failedCallback) { - var getActionServers = new Service({ - ros : this, - name : '/rosapi/action_servers', - serviceType : 'rosapi/GetActionServers' - }); + /** + * Send a set_level request to the server. + * + * @param {string} level - Status level (none, error, warning, info). + * @param {number} [id] - Operation ID to change status level on. + */ + setStatusLevel(level, id) { + var levelMsg = { + op: "set_level", + level: level, + id: id, + }; + + this.callOnConnection(levelMsg); + } + /** + * Retrieve a list of action servers in ROS as an array of string. + * + * @param {function} callback - Function with the following params: + * @param {string[]} callback.actionservers - Array of action server names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getActionServers(callback, failedCallback) { + var getActionServers = new Service({ + ros: this, + name: "/rosapi/action_servers", + serviceType: "rosapi/GetActionServers", + }); - var request = new ServiceRequest({}); - if (typeof failedCallback === 'function'){ - getActionServers.callService(request, - function(result) { + var request = new ServiceRequest({}); + if (typeof failedCallback === "function") { + getActionServers.callService( + request, + function (result) { + callback(result.action_servers); + }, + function (message) { + failedCallback(message); + } + ); + } else { + getActionServers.callService(request, function (result) { callback(result.action_servers); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - getActionServers.callService(request, function(result) { - callback(result.action_servers); - }); + }); + } } -}; - -/** - * Retrieve a list of topics in ROS as an array. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getTopics = function(callback, failedCallback) { - var topicsClient = new Service({ - ros : this, - name : '/rosapi/topics', - serviceType : 'rosapi/Topics' - }); + /** + * Retrieve a list of topics in ROS as an array. + * + * @param {function} callback - Function with the following params: + * @param {Object} callback.result - The result object with the following params: + * @param {string[]} callback.result.topics - Array of topic names. + * @param {string[]} callback.result.types - Array of message type names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getTopics(callback, failedCallback) { + var topicsClient = new Service({ + ros: this, + name: "/rosapi/topics", + serviceType: "rosapi/Topics", + }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - topicsClient.callService(request, - function(result) { + var request = new ServiceRequest(); + if (typeof failedCallback === "function") { + topicsClient.callService( + request, + function (result) { + callback(result); + }, + function (message) { + failedCallback(message); + } + ); + } else { + topicsClient.callService(request, function (result) { callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsClient.callService(request, function(result) { - callback(result); - }); + }); + } } -}; - -/** - * Retrieve a list of topics in ROS as an array of a specific type. - * - * @param {string} topicType - The topic type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of topic names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getTopicsForType = function(topicType, callback, failedCallback) { - var topicsForTypeClient = new Service({ - ros : this, - name : '/rosapi/topics_for_type', - serviceType : 'rosapi/TopicsForType' - }); + /** + * Retrieve a list of topics in ROS as an array of a specific type. + * + * @param {string} topicType - The topic type to find. + * @param {function} callback - Function with the following params: + * @param {string[]} callback.topics - Array of topic names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getTopicsForType(topicType, callback, failedCallback) { + var topicsForTypeClient = new Service({ + ros: this, + name: "/rosapi/topics_for_type", + serviceType: "rosapi/TopicsForType", + }); - var request = new ServiceRequest({ - type: topicType - }); - if (typeof failedCallback === 'function'){ - topicsForTypeClient.callService(request, - function(result) { - callback(result.topics); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsForTypeClient.callService(request, function(result) { - callback(result.topics); + var request = new ServiceRequest({ + type: topicType, }); + if (typeof failedCallback === "function") { + topicsForTypeClient.callService( + request, + function (result) { + callback(result.topics); + }, + function (message) { + failedCallback(message); + } + ); + } else { + topicsForTypeClient.callService(request, function (result) { + callback(result.topics); + }); + } } -}; - -/** - * Retrieve a list of active service names in ROS. - * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.services - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServices = function(callback, failedCallback) { - var servicesClient = new Service({ - ros : this, - name : '/rosapi/services', - serviceType : 'rosapi/Services' - }); + /** + * Retrieve a list of active service names in ROS. + * + * @param {function} callback - Function with the following params: + * @param {string[]} callback.services - Array of service names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getServices(callback, failedCallback) { + var servicesClient = new Service({ + ros: this, + name: "/rosapi/services", + serviceType: "rosapi/Services", + }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - servicesClient.callService(request, - function(result) { + var request = new ServiceRequest(); + if (typeof failedCallback === "function") { + servicesClient.callService( + request, + function (result) { + callback(result.services); + }, + function (message) { + failedCallback(message); + } + ); + } else { + servicesClient.callService(request, function (result) { callback(result.services); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - servicesClient.callService(request, function(result) { - callback(result.services); - }); + }); + } } -}; - -/** - * Retrieve a list of services in ROS as an array as specific type. - * - * @param {string} serviceType - The service type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServicesForType = function(serviceType, callback, failedCallback) { - var servicesForTypeClient = new Service({ - ros : this, - name : '/rosapi/services_for_type', - serviceType : 'rosapi/ServicesForType' - }); + /** + * Retrieve a list of services in ROS as an array as specific type. + * + * @param {string} serviceType - The service type to find. + * @param {function} callback - Function with the following params: + * @param {string[]} callback.topics - Array of service names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getServicesForType(serviceType, callback, failedCallback) { + var servicesForTypeClient = new Service({ + ros: this, + name: "/rosapi/services_for_type", + serviceType: "rosapi/ServicesForType", + }); - var request = new ServiceRequest({ - type: serviceType - }); - if (typeof failedCallback === 'function'){ - servicesForTypeClient.callService(request, - function(result) { - callback(result.services); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - servicesForTypeClient.callService(request, function(result) { - callback(result.services); + var request = new ServiceRequest({ + type: serviceType, }); + if (typeof failedCallback === "function") { + servicesForTypeClient.callService( + request, + function (result) { + callback(result.services); + }, + function (message) { + failedCallback(message); + } + ); + } else { + servicesForTypeClient.callService(request, function (result) { + callback(result.services); + }); + } } -}; - -/** - * Retrieve the details of a ROS service request. - * - * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServiceRequestDetails = function(type, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_request_details', - serviceType : 'rosapi/ServiceRequestDetails' - }); - var request = new ServiceRequest({ - type: type - }); + /** + * Retrieve the details of a ROS service request. + * + * @param {string} type - The type of the service. + * @param {function} callback - Function with the following params: + * @param {Object} callback.result - The result object with the following params: + * @param {string[]} callback.result.typedefs - An array containing the details of the service request. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getServiceRequestDetails(type, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: "/rosapi/service_request_details", + serviceType: "rosapi/ServiceRequestDetails", + }); + var request = new ServiceRequest({ + type: type, + }); - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { + if (typeof failedCallback === "function") { + serviceTypeClient.callService( + request, + function (result) { + callback(result); + }, + function (message) { + failedCallback(message); + } + ); + } else { + serviceTypeClient.callService(request, function (result) { callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result); - }); + }); + } } -}; - -/** - * Retrieve the details of a ROS service response. - * - * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service response. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServiceResponseDetails = function(type, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_response_details', - serviceType : 'rosapi/ServiceResponseDetails' - }); - var request = new ServiceRequest({ - type: type - }); + /** + * Retrieve the details of a ROS service response. + * + * @param {string} type - The type of the service. + * @param {function} callback - Function with the following params: + * @param {Object} callback.result - The result object with the following params: + * @param {string[]} callback.result.typedefs - An array containing the details of the service response. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getServiceResponseDetails(type, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: "/rosapi/service_response_details", + serviceType: "rosapi/ServiceResponseDetails", + }); + var request = new ServiceRequest({ + type: type, + }); - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { + if (typeof failedCallback === "function") { + serviceTypeClient.callService( + request, + function (result) { + callback(result); + }, + function (message) { + failedCallback(message); + } + ); + } else { + serviceTypeClient.callService(request, function (result) { callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result); - }); + }); + } } -}; - -/** - * Retrieve a list of active node names in ROS. - * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.nodes - Array of node names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getNodes = function(callback, failedCallback) { - var nodesClient = new Service({ - ros : this, - name : '/rosapi/nodes', - serviceType : 'rosapi/Nodes' - }); + /** + * Retrieve a list of active node names in ROS. + * + * @param {function} callback - Function with the following params: + * @param {string[]} callback.nodes - Array of node names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getNodes(callback, failedCallback) { + var nodesClient = new Service({ + ros: this, + name: "/rosapi/nodes", + serviceType: "rosapi/Nodes", + }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - nodesClient.callService(request, - function(result) { + var request = new ServiceRequest(); + if (typeof failedCallback === "function") { + nodesClient.callService( + request, + function (result) { + callback(result.nodes); + }, + function (message) { + failedCallback(message); + } + ); + } else { + nodesClient.callService(request, function (result) { callback(result.nodes); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - nodesClient.callService(request, function(result) { - callback(result.nodes); - }); + }); + } } -}; - -/** - * Retrieve a list of subscribed topics, publishing topics and services of a specific node. - *
- * These are the parameters if failedCallback is defined. - * - * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.subscriptions - Array of subscribed topic names. - * @param {string[]} callback.publications - Array of published topic names. - * @param {string[]} callback.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - * - * @also - * - * Retrieve a list of subscribed topics, publishing topics and services of a specific node. - *
- * These are the parameters if failedCallback is undefined. - * - * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.subscribing - Array of subscribed topic names. - * @param {string[]} callback.result.publishing - Array of published topic names. - * @param {string[]} callback.result.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getNodeDetails = function(node, callback, failedCallback) { - var nodesClient = new Service({ - ros : this, - name : '/rosapi/node_details', - serviceType : 'rosapi/NodeDetails' - }); + /** + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is defined. + * + * @param {string} node - Name of the node. + * @param {function} callback - Function with the following params: + * @param {string[]} callback.subscriptions - Array of subscribed topic names. + * @param {string[]} callback.publications - Array of published topic names. + * @param {string[]} callback.services - Array of service names hosted. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + * + * @also + * + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is undefined. + * + * @param {string} node - Name of the node. + * @param {function} callback - Function with the following params: + * @param {Object} callback.result - The result object with the following params: + * @param {string[]} callback.result.subscribing - Array of subscribed topic names. + * @param {string[]} callback.result.publishing - Array of published topic names. + * @param {string[]} callback.result.services - Array of service names hosted. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getNodeDetails(node, callback, failedCallback) { + var nodesClient = new Service({ + ros: this, + name: "/rosapi/node_details", + serviceType: "rosapi/NodeDetails", + }); - var request = new ServiceRequest({ - node: node - }); - if (typeof failedCallback === 'function'){ - nodesClient.callService(request, - function(result) { - callback(result.subscribing, result.publishing, result.services); - }, - function(message) { - failedCallback(message); - } - ); - } else { - nodesClient.callService(request, function(result) { - callback(result); + var request = new ServiceRequest({ + node: node, }); + if (typeof failedCallback === "function") { + nodesClient.callService( + request, + function (result) { + callback(result.subscribing, result.publishing, result.services); + }, + function (message) { + failedCallback(message); + } + ); + } else { + nodesClient.callService(request, function (result) { + callback(result); + }); + } } -}; - -/** - * Retrieve a list of parameter names from the ROS Parameter Server. - * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.params - Array of param names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getParams = function(callback, failedCallback) { - var paramsClient = new Service({ - ros : this, - name : '/rosapi/get_param_names', - serviceType : 'rosapi/GetParamNames' - }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - paramsClient.callService(request, - function(result) { - callback(result.names); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - paramsClient.callService(request, function(result) { - callback(result.names); + /** + * Retrieve a list of parameter names from the ROS Parameter Server. + * + * @param {function} callback - Function with the following params: + * @param {string[]} callback.params - Array of param names. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getParams(callback, failedCallback) { + var paramsClient = new Service({ + ros: this, + name: "/rosapi/get_param_names", + serviceType: "rosapi/GetParamNames", }); + var request = new ServiceRequest(); + if (typeof failedCallback === "function") { + paramsClient.callService( + request, + function (result) { + callback(result.names); + }, + function (message) { + failedCallback(message); + } + ); + } else { + paramsClient.callService(request, function (result) { + callback(result.names); + }); + } } -}; - -/** - * Retrieve the type of a ROS topic. - * - * @param {string} topic - Name of the topic. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the topic. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getTopicType = function(topic, callback, failedCallback) { - var topicTypeClient = new Service({ - ros : this, - name : '/rosapi/topic_type', - serviceType : 'rosapi/TopicType' - }); - var request = new ServiceRequest({ - topic: topic - }); + /** + * Retrieve the type of a ROS topic. + * + * @param {string} topic - Name of the topic. + * @param {function} callback - Function with the following params: + * @param {string} callback.type - The type of the topic. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getTopicType(topic, callback, failedCallback) { + var topicTypeClient = new Service({ + ros: this, + name: "/rosapi/topic_type", + serviceType: "rosapi/TopicType", + }); + var request = new ServiceRequest({ + topic: topic, + }); - if (typeof failedCallback === 'function'){ - topicTypeClient.callService(request, - function(result) { + if (typeof failedCallback === "function") { + topicTypeClient.callService( + request, + function (result) { + callback(result.type); + }, + function (message) { + failedCallback(message); + } + ); + } else { + topicTypeClient.callService(request, function (result) { callback(result.type); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicTypeClient.callService(request, function(result) { - callback(result.type); - }); + }); + } } -}; - -/** - * Retrieve the type of a ROS service. - * - * @param {string} service - Name of the service. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the service. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServiceType = function(service, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_type', - serviceType : 'rosapi/ServiceType' - }); - var request = new ServiceRequest({ - service: service - }); + /** + * Retrieve the type of a ROS service. + * + * @param {string} service - Name of the service. + * @param {function} callback - Function with the following params: + * @param {string} callback.type - The type of the service. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getServiceType(service, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: "/rosapi/service_type", + serviceType: "rosapi/ServiceType", + }); + var request = new ServiceRequest({ + service: service, + }); - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { + if (typeof failedCallback === "function") { + serviceTypeClient.callService( + request, + function (result) { + callback(result.type); + }, + function (message) { + failedCallback(message); + } + ); + } else { + serviceTypeClient.callService(request, function (result) { callback(result.type); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result.type); - }); + }); + } } -}; - -/** - * Retrieve the details of a ROS message. - * - * @param {string} message - The name of the message type. - * @param {function} callback - Function with the following params: - * @param {string} callback.details - An array of the message details. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getMessageDetails = function(message, callback, failedCallback) { - var messageDetailClient = new Service({ - ros : this, - name : '/rosapi/message_details', - serviceType : 'rosapi/MessageDetails' - }); - var request = new ServiceRequest({ - type: message - }); - - if (typeof failedCallback === 'function'){ - messageDetailClient.callService(request, - function(result) { - callback(result.typedefs); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - messageDetailClient.callService(request, function(result) { - callback(result.typedefs); + /** + * Retrieve the details of a ROS message. + * + * @param {string} message - The name of the message type. + * @param {function} callback - Function with the following params: + * @param {string} callback.details - An array of the message details. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getMessageDetails(message, callback, failedCallback) { + var messageDetailClient = new Service({ + ros: this, + name: "/rosapi/message_details", + serviceType: "rosapi/MessageDetails", + }); + var request = new ServiceRequest({ + type: message, }); - } -}; - -/** - * Decode a typedef array into a dictionary like `rosmsg show foo/bar`. - * - * @param {Object[]} defs - Array of type_def dictionary. - */ -Ros.prototype.decodeTypeDefs = function(defs) { - var that = this; - var decodeTypeDefsRec = function(theType, hints) { - // calls itself recursively to resolve type definition using hints. - var typeDefDict = {}; - for (var i = 0; i < theType.fieldnames.length; i++) { - var arrayLen = theType.fieldarraylen[i]; - var fieldName = theType.fieldnames[i]; - var fieldType = theType.fieldtypes[i]; - if (fieldType.indexOf('/') === -1) { // check the fieldType includes '/' or not - if (arrayLen === -1) { - typeDefDict[fieldName] = fieldType; - } - else { - typeDefDict[fieldName] = [fieldType]; - } - } - else { - // lookup the name - var sub = false; - for (var j = 0; j < hints.length; j++) { - if (hints[j].type.toString() === fieldType.toString()) { - sub = hints[j]; - break; - } + if (typeof failedCallback === "function") { + messageDetailClient.callService( + request, + function (result) { + callback(result.typedefs); + }, + function (message) { + failedCallback(message); } - if (sub) { - var subResult = decodeTypeDefsRec(sub, hints); + ); + } else { + messageDetailClient.callService(request, function (result) { + callback(result.typedefs); + }); + } + } + /** + * Decode a typedef array into a dictionary like `rosmsg show foo/bar`. + * + * @param {Object[]} defs - Array of type_def dictionary. + */ + decodeTypeDefs(defs) { + var that = this; + + var decodeTypeDefsRec = function (theType, hints) { + // calls itself recursively to resolve type definition using hints. + var typeDefDict = {}; + for (var i = 0; i < theType.fieldnames.length; i++) { + var arrayLen = theType.fieldarraylen[i]; + var fieldName = theType.fieldnames[i]; + var fieldType = theType.fieldtypes[i]; + if (fieldType.indexOf("/") === -1) { + // check the fieldType includes '/' or not if (arrayLen === -1) { - typeDefDict[fieldName] = subResult; // add this decoding result to dictionary + typeDefDict[fieldName] = fieldType; + } else { + typeDefDict[fieldName] = [fieldType]; } - else { - typeDefDict[fieldName] = [subResult]; + } else { + // lookup the name + var sub = false; + for (var j = 0; j < hints.length; j++) { + if (hints[j].type.toString() === fieldType.toString()) { + sub = hints[j]; + break; + } + } + if (sub) { + var subResult = decodeTypeDefsRec(sub, hints); + if (arrayLen === -1) { + typeDefDict[fieldName] = subResult; // add this decoding result to dictionary + } else { + typeDefDict[fieldName] = [subResult]; + } + } else { + that.emit( + "error", + "Cannot find " + fieldType + " in decodeTypeDefs" + ); } - } - else { - that.emit('error', 'Cannot find ' + fieldType + ' in decodeTypeDefs'); } } - } - return typeDefDict; - }; + return typeDefDict; + }; - return decodeTypeDefsRec(defs[0], defs); -}; - -/** - * Retrieve a list of topics and their associated type definitions. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {string[]} callback.result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getTopicsAndRawTypes = function(callback, failedCallback) { - var topicsAndRawTypesClient = new Service({ - ros : this, - name : '/rosapi/topics_and_raw_types', - serviceType : 'rosapi/TopicsAndRawTypes' - }); + return decodeTypeDefsRec(defs[0], defs); + } + /** + * Retrieve a list of topics and their associated type definitions. + * + * @param {function} callback - Function with the following params: + * @param {Object} callback.result - The result object with the following params: + * @param {string[]} callback.result.topics - Array of topic names. + * @param {string[]} callback.result.types - Array of message type names. + * @param {string[]} callback.result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + getTopicsAndRawTypes(callback, failedCallback) { + var topicsAndRawTypesClient = new Service({ + ros: this, + name: "/rosapi/topics_and_raw_types", + serviceType: "rosapi/TopicsAndRawTypes", + }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - topicsAndRawTypesClient.callService(request, - function(result) { + var request = new ServiceRequest(); + if (typeof failedCallback === "function") { + topicsAndRawTypesClient.callService( + request, + function (result) { + callback(result); + }, + function (message) { + failedCallback(message); + } + ); + } else { + topicsAndRawTypesClient.callService(request, function (result) { callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsAndRawTypesClient.callService(request, function(result) { - callback(result); - }); + }); + } } -}; +} module.exports = Ros; diff --git a/src/core/Service.js b/src/core/Service.js index a0b2f79e7..493b31851 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -16,108 +16,108 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * @param {string} options.name - The service name, like '/add_two_ints'. * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. */ -function Service(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.serviceType = options.serviceType; - this.isAdvertised = false; +class Service extends EventEmitter2 { + constructor(options) { + super(options); + options = options || {}; + this.ros = options.ros; + this.name = options.name; + this.serviceType = options.serviceType; + this.isAdvertised = false; - this._serviceCallback = null; -} -Service.prototype.__proto__ = EventEmitter2.prototype; -/** - * Call the service. Returns the service response in the - * callback. Does nothing if this service is currently advertised. - * - * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. - * @param {function} callback - Function with the following params: - * @param {Object} callback.response - The response from the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Service.prototype.callService = function(request, callback, failedCallback) { - if (this.isAdvertised) { - return; + this._serviceCallback = null; } + /** + * Call the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {function} callback - Function with the following params: + * @param {Object} callback.response - The response from the service request. + * @param {function} [failedCallback] - The callback function when the service call failed with params: + * @param {string} failedCallback.error - The error message reported by ROS. + */ + callService(request, callback, failedCallback) { + if (this.isAdvertised) { + return; + } - var serviceCallId = 'call_service:' + this.name + ':' + (++this.ros.idCounter); + var serviceCallId = + "call_service:" + this.name + ":" + ++this.ros.idCounter; - if (callback || failedCallback) { - this.ros.once(serviceCallId, function(message) { - if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === 'function') { - failedCallback(message.values); + if (callback || failedCallback) { + this.ros.once(serviceCallId, function (message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === "function") { + failedCallback(message.values); + } + } else if (typeof callback === "function") { + callback(new ServiceResponse(message.values)); } - } else if (typeof callback === 'function') { - callback(new ServiceResponse(message.values)); - } - }); - } + }); + } - var call = { - op : 'call_service', - id : serviceCallId, - service : this.name, - type: this.serviceType, - args : request - }; - this.ros.callOnConnection(call); -}; - -/** - * Advertise the service. This turns the Service object from a client - * into a server. The callback will be called with every request - * that's made on this service. - * - * @param {function} callback - This works similarly to the callback for a C++ service and should take the following params: - * @param {ServiceRequest} callback.request - The service request. - * @param {Object} callback.response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the service has finished successfully, - * i.e., without any fatal errors. - */ -Service.prototype.advertise = function(callback) { - if (this.isAdvertised || typeof callback !== 'function') { - return; + var call = { + op: "call_service", + id: serviceCallId, + service: this.name, + type: this.serviceType, + args: request, + }; + this.ros.callOnConnection(call); } + /** + * Advertise the service. This turns the Service object from a client + * into a server. The callback will be called with every request + * that's made on this service. + * + * @param {function} callback - This works similarly to the callback for a C++ service and should take the following params: + * @param {ServiceRequest} callback.request - The service request. + * @param {Object} callback.response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the service has finished successfully, + * i.e., without any fatal errors. + */ + advertise(callback) { + if (this.isAdvertised || typeof callback !== "function") { + return; + } - this._serviceCallback = callback; - this.ros.on(this.name, this._serviceResponse.bind(this)); - this.ros.callOnConnection({ - op: 'advertise_service', - type: this.serviceType, - service: this.name - }); - this.isAdvertised = true; -}; - -Service.prototype.unadvertise = function() { - if (!this.isAdvertised) { - return; + this._serviceCallback = callback; + this.ros.on(this.name, this._serviceResponse.bind(this)); + this.ros.callOnConnection({ + op: "advertise_service", + type: this.serviceType, + service: this.name, + }); + this.isAdvertised = true; } - this.ros.callOnConnection({ - op: 'unadvertise_service', - service: this.name - }); - this.isAdvertised = false; -}; + unadvertise() { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: "unadvertise_service", + service: this.name, + }); + this.isAdvertised = false; + } + _serviceResponse(rosbridgeRequest) { + var response = {}; + var success = this._serviceCallback(rosbridgeRequest.args, response); -Service.prototype._serviceResponse = function(rosbridgeRequest) { - var response = {}; - var success = this._serviceCallback(rosbridgeRequest.args, response); + var call = { + op: "service_response", + service: this.name, + values: new ServiceResponse(response), + result: success, + }; - var call = { - op: 'service_response', - service: this.name, - values: new ServiceResponse(response), - result: success - }; + if (rosbridgeRequest.id) { + call.id = rosbridgeRequest.id; + } - if (rosbridgeRequest.id) { - call.id = rosbridgeRequest.id; + this.ros.callOnConnection(call); } - - this.ros.callOnConnection(call); -}; +} module.exports = Service; diff --git a/src/core/Topic.js b/src/core/Topic.js index 1804de3bd..9f2c8b18d 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -25,184 +25,195 @@ var Message = require('./Message'); * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. */ -function Topic(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.messageType = options.messageType; - this.isAdvertised = false; - this.compression = options.compression || 'none'; - this.throttle_rate = options.throttle_rate || 0; - this.latch = options.latch || false; - this.queue_size = options.queue_size || 100; - this.queue_length = options.queue_length || 0; - this.reconnect_on_close = options.reconnect_on_close !== undefined ? options.reconnect_on_close : true; +class Topic extends EventEmitter2 { + constructor(options) { + super(options); + options = options || {}; + this.ros = options.ros; + this.name = options.name; + this.messageType = options.messageType; + this.isAdvertised = false; + this.compression = options.compression || "none"; + this.throttle_rate = options.throttle_rate || 0; + this.latch = options.latch || false; + this.queue_size = options.queue_size || 100; + this.queue_length = options.queue_length || 0; + this.reconnect_on_close = + options.reconnect_on_close !== undefined + ? options.reconnect_on_close + : true; + + // Check for valid compression types + if ( + this.compression && + this.compression !== "png" && + this.compression !== "cbor" && + this.compression !== "cbor-raw" && + this.compression !== "none" + ) { + this.emit( + "warning", + this.compression + + " compression is not supported. No compression will be used." + ); + this.compression = "none"; + } + + // Check if throttle rate is negative + if (this.throttle_rate < 0) { + this.emit("warning", this.throttle_rate + " is not allowed. Set to 0"); + this.throttle_rate = 0; + } - // Check for valid compression types - if (this.compression && this.compression !== 'png' && - this.compression !== 'cbor' && this.compression !== 'cbor-raw' && - this.compression !== 'none') { - this.emit('warning', this.compression + - ' compression is not supported. No compression will be used.'); - this.compression = 'none'; - } - - // Check if throttle rate is negative - if (this.throttle_rate < 0) { - this.emit('warning', this.throttle_rate + ' is not allowed. Set to 0'); - this.throttle_rate = 0; - } - - var that = this; - if (this.reconnect_on_close) { - this.callForSubscribeAndAdvertise = function(message) { - that.ros.callOnConnection(message); - - that.waitForReconnect = false; - that.reconnectFunc = function() { - if(!that.waitForReconnect) { - that.waitForReconnect = true; - that.ros.callOnConnection(message); - that.ros.once('connection', function() { - that.waitForReconnect = false; - }); - } + var that = this; + if (this.reconnect_on_close) { + this.callForSubscribeAndAdvertise = function (message) { + that.ros.callOnConnection(message); + + that.waitForReconnect = false; + that.reconnectFunc = function () { + if (!that.waitForReconnect) { + that.waitForReconnect = true; + that.ros.callOnConnection(message); + that.ros.once("connection", function () { + that.waitForReconnect = false; + }); + } + }; + that.ros.on("close", that.reconnectFunc); }; - that.ros.on('close', that.reconnectFunc); - }; - } - else { - this.callForSubscribeAndAdvertise = this.ros.callOnConnection; - } - - this._messageCallback = function(data) { - that.emit('message', new Message(data)); - }; -} -Topic.prototype.__proto__ = EventEmitter2.prototype; + } else { + this.callForSubscribeAndAdvertise = this.ros.callOnConnection; + } -/** - * Every time a message is published for the given topic, the callback - * will be called with the message object. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.message - The published message. - */ -Topic.prototype.subscribe = function(callback) { - if (typeof callback === 'function') { - this.on('message', callback); - } - - if (this.subscribeId) { return; } - this.ros.on(this.name, this._messageCallback); - this.subscribeId = 'subscribe:' + this.name + ':' + (++this.ros.idCounter); - - this.callForSubscribeAndAdvertise({ - op: 'subscribe', - id: this.subscribeId, - type: this.messageType, - topic: this.name, - compression: this.compression, - throttle_rate: this.throttle_rate, - queue_length: this.queue_length - }); -}; - -/** - * Unregister as a subscriber for the topic. Unsubscribing will stop - * and remove all subscribe callbacks. To remove a callback, you must - * explicitly pass the callback function in. - * - * @param {function} [callback] - The callback to unregister, if - * provided and other listeners are registered the topic won't - * unsubscribe, just stop emitting to the passed listener. - */ -Topic.prototype.unsubscribe = function(callback) { - if (callback) { - this.off('message', callback); - // If there is any other callbacks still subscribed don't unsubscribe - if (this.listeners('message').length) { return; } - } - if (!this.subscribeId) { return; } - // Note: Don't call this.removeAllListeners, allow client to handle that themselves - this.ros.off(this.name, this._messageCallback); - if(this.reconnect_on_close) { - this.ros.off('close', this.reconnectFunc); + this._messageCallback = function (data) { + that.emit("message", new Message(data)); + }; } - this.emit('unsubscribe'); - this.ros.callOnConnection({ - op: 'unsubscribe', - id: this.subscribeId, - topic: this.name - }); - this.subscribeId = null; -}; - - -/** - * Register as a publisher for the topic. - */ -Topic.prototype.advertise = function() { - if (this.isAdvertised) { - return; + /** + * Every time a message is published for the given topic, the callback + * will be called with the message object. + * + * @param {function} callback - Function with the following params: + * @param {Object} callback.message - The published message. + */ + subscribe(callback) { + if (typeof callback === "function") { + this.on("message", callback); + } + + if (this.subscribeId) { + return; + } + this.ros.on(this.name, this._messageCallback); + this.subscribeId = "subscribe:" + this.name + ":" + ++this.ros.idCounter; + + this.callForSubscribeAndAdvertise({ + op: "subscribe", + id: this.subscribeId, + type: this.messageType, + topic: this.name, + compression: this.compression, + throttle_rate: this.throttle_rate, + queue_length: this.queue_length, + }); } - this.advertiseId = 'advertise:' + this.name + ':' + (++this.ros.idCounter); - this.callForSubscribeAndAdvertise({ - op: 'advertise', - id: this.advertiseId, - type: this.messageType, - topic: this.name, - latch: this.latch, - queue_size: this.queue_size - }); - this.isAdvertised = true; - - if(!this.reconnect_on_close) { - var that = this; - this.ros.on('close', function() { - that.isAdvertised = false; + /** + * Unregister as a subscriber for the topic. Unsubscribing will stop + * and remove all subscribe callbacks. To remove a callback, you must + * explicitly pass the callback function in. + * + * @param {function} [callback] - The callback to unregister, if + * provided and other listeners are registered the topic won't + * unsubscribe, just stop emitting to the passed listener. + */ + unsubscribe(callback) { + if (callback) { + this.off("message", callback); + // If there is any other callbacks still subscribed don't unsubscribe + if (this.listeners("message").length) { + return; + } + } + if (!this.subscribeId) { + return; + } + // Note: Don't call this.removeAllListeners, allow client to handle that themselves + this.ros.off(this.name, this._messageCallback); + if (this.reconnect_on_close) { + this.ros.off("close", this.reconnectFunc); + } + this.emit("unsubscribe"); + this.ros.callOnConnection({ + op: "unsubscribe", + id: this.subscribeId, + topic: this.name, }); + this.subscribeId = null; } -}; - -/** - * Unregister as a publisher for the topic. - */ -Topic.prototype.unadvertise = function() { - if (!this.isAdvertised) { - return; + /** + * Register as a publisher for the topic. + */ + advertise() { + if (this.isAdvertised) { + return; + } + this.advertiseId = "advertise:" + this.name + ":" + ++this.ros.idCounter; + this.callForSubscribeAndAdvertise({ + op: "advertise", + id: this.advertiseId, + type: this.messageType, + topic: this.name, + latch: this.latch, + queue_size: this.queue_size, + }); + this.isAdvertised = true; + + if (!this.reconnect_on_close) { + var that = this; + this.ros.on("close", function () { + that.isAdvertised = false; + }); + } } - if(this.reconnect_on_close) { - this.ros.off('close', this.reconnectFunc); + /** + * Unregister as a publisher for the topic. + */ + unadvertise() { + if (!this.isAdvertised) { + return; + } + if (this.reconnect_on_close) { + this.ros.off("close", this.reconnectFunc); + } + this.emit("unadvertise"); + this.ros.callOnConnection({ + op: "unadvertise", + id: this.advertiseId, + topic: this.name, + }); + this.isAdvertised = false; } - this.emit('unadvertise'); - this.ros.callOnConnection({ - op: 'unadvertise', - id: this.advertiseId, - topic: this.name - }); - this.isAdvertised = false; -}; - -/** - * Publish the message. - * - * @param {Message} message - A ROSLIB.Message object. - */ -Topic.prototype.publish = function(message) { - if (!this.isAdvertised) { - this.advertise(); + /** + * Publish the message. + * + * @param {Message} message - A ROSLIB.Message object. + */ + publish(message) { + if (!this.isAdvertised) { + this.advertise(); + } + + this.ros.idCounter++; + var call = { + op: "publish", + id: "publish:" + this.name + ":" + this.ros.idCounter, + topic: this.name, + msg: message, + latch: this.latch, + }; + this.ros.callOnConnection(call); } - - this.ros.idCounter++; - var call = { - op: 'publish', - id: 'publish:' + this.name + ':' + this.ros.idCounter, - topic: this.name, - msg: message, - latch: this.latch - }; - this.ros.callOnConnection(call); -}; +} module.exports = Topic; diff --git a/src/math/Pose.js b/src/math/Pose.js index 0dd09a5d9..348e3ab35 100644 --- a/src/math/Pose.js +++ b/src/math/Pose.js @@ -14,59 +14,64 @@ var Quaternion = require('./Quaternion'); * @param {Vector3} options.position - The ROSLIB.Vector3 describing the position. * @param {Quaternion} options.orientation - The ROSLIB.Quaternion describing the orientation. */ -function Pose(options) { - options = options || {}; - // copy the values into this object if they exist - this.position = new Vector3(options.position); - this.orientation = new Quaternion(options.orientation); +class Pose { + constructor(options) { + options = options || {}; + // copy the values into this object if they exist + this.position = new Vector3(options.position); + this.orientation = new Quaternion(options.orientation); + } + /** + * Apply a transform against this pose. + * + * @param {Transform} tf - The transform to be applied. + */ + applyTransform(tf) { + this.position.multiplyQuaternion(tf.rotation); + this.position.add(tf.translation); + var tmp = tf.rotation.clone(); + tmp.multiply(this.orientation); + this.orientation = tmp; + } + /** + * Clone a copy of this pose. + * + * @returns {Pose} The cloned pose. + */ + clone() { + return new Pose(this); + } + /** + * Multiply this pose with another pose without altering this pose. + * + * @returns {Pose} The result of the multiplication. + */ + multiply(pose) { + var p = pose.clone(); + p.applyTransform({ + rotation: this.orientation, + translation: this.position, + }); + return p; + } + /** + * Compute the inverse of this pose. + * + * @returns {Pose} The inverse of the pose. + */ + getInverse() { + var inverse = this.clone(); + inverse.orientation.invert(); + inverse.position.multiplyQuaternion(inverse.orientation); + inverse.position.x *= -1; + inverse.position.y *= -1; + inverse.position.z *= -1; + return inverse; + } } -/** - * Apply a transform against this pose. - * - * @param {Transform} tf - The transform to be applied. - */ -Pose.prototype.applyTransform = function(tf) { - this.position.multiplyQuaternion(tf.rotation); - this.position.add(tf.translation); - var tmp = tf.rotation.clone(); - tmp.multiply(this.orientation); - this.orientation = tmp; -}; -/** - * Clone a copy of this pose. - * - * @returns {Pose} The cloned pose. - */ -Pose.prototype.clone = function() { - return new Pose(this); -}; -/** - * Multiply this pose with another pose without altering this pose. - * - * @returns {Pose} The result of the multiplication. - */ -Pose.prototype.multiply = function(pose) { - var p = pose.clone(); - p.applyTransform({ rotation: this.orientation, translation: this.position }); - return p; -}; -/** - * Compute the inverse of this pose. - * - * @returns {Pose} The inverse of the pose. - */ -Pose.prototype.getInverse = function() { - var inverse = this.clone(); - inverse.orientation.invert(); - inverse.position.multiplyQuaternion(inverse.orientation); - inverse.position.x *= -1; - inverse.position.y *= -1; - inverse.position.z *= -1; - return inverse; -}; module.exports = Pose; diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 5c70a2a8a..1c933a724 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -13,80 +13,86 @@ * @param {number} [options.z=0] - The z value. * @param {number} [options.w=1] - The w value. */ -function Quaternion(options) { - options = options || {}; - this.x = options.x || 0; - this.y = options.y || 0; - this.z = options.z || 0; - this.w = (typeof options.w === 'number') ? options.w : 1; +class Quaternion { + constructor(options) { + options = options || {}; + this.x = options.x || 0; + this.y = options.y || 0; + this.z = options.z || 0; + this.w = typeof options.w === "number" ? options.w : 1; + } + /** + * Perform a conjugation on this quaternion. + */ + conjugate() { + this.x *= -1; + this.y *= -1; + this.z *= -1; + } + /** + * Return the norm of this quaternion. + */ + norm() { + return Math.sqrt( + this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w + ); + } + /** + * Perform a normalization on this quaternion. + */ + normalize() { + var l = Math.sqrt( + this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w + ); + if (l === 0) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + } + /** + * Convert this quaternion into its inverse. + */ + invert() { + this.conjugate(); + this.normalize(); + } + /** + * Set the values of this quaternion to the product of itself and the given quaternion. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + multiply(q) { + var newX = this.x * q.w + this.y * q.z - this.z * q.y + this.w * q.x; + var newY = -this.x * q.z + this.y * q.w + this.z * q.x + this.w * q.y; + var newZ = this.x * q.y - this.y * q.x + this.z * q.w + this.w * q.z; + var newW = -this.x * q.x - this.y * q.y - this.z * q.z + this.w * q.w; + this.x = newX; + this.y = newY; + this.z = newZ; + this.w = newW; + } + /** + * Clone a copy of this quaternion. + * + * @returns {Quaternion} The cloned quaternion. + */ + clone() { + return new Quaternion(this); + } } -/** - * Perform a conjugation on this quaternion. - */ -Quaternion.prototype.conjugate = function() { - this.x *= -1; - this.y *= -1; - this.z *= -1; -}; -/** - * Return the norm of this quaternion. - */ -Quaternion.prototype.norm = function() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); -}; -/** - * Perform a normalization on this quaternion. - */ -Quaternion.prototype.normalize = function() { - var l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - if (l === 0) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - } else { - l = 1 / l; - this.x = this.x * l; - this.y = this.y * l; - this.z = this.z * l; - this.w = this.w * l; - } -}; -/** - * Convert this quaternion into its inverse. - */ -Quaternion.prototype.invert = function() { - this.conjugate(); - this.normalize(); -}; -/** - * Set the values of this quaternion to the product of itself and the given quaternion. - * - * @param {Quaternion} q - The quaternion to multiply with. - */ -Quaternion.prototype.multiply = function(q) { - var newX = this.x * q.w + this.y * q.z - this.z * q.y + this.w * q.x; - var newY = -this.x * q.z + this.y * q.w + this.z * q.x + this.w * q.y; - var newZ = this.x * q.y - this.y * q.x + this.z * q.w + this.w * q.z; - var newW = -this.x * q.x - this.y * q.y - this.z * q.z + this.w * q.w; - this.x = newX; - this.y = newY; - this.z = newZ; - this.w = newW; -}; -/** - * Clone a copy of this quaternion. - * - * @returns {Quaternion} The cloned quaternion. - */ -Quaternion.prototype.clone = function() { - return new Quaternion(this); -}; module.exports = Quaternion; diff --git a/src/math/Transform.js b/src/math/Transform.js index 8f3581d91..6df649f65 100644 --- a/src/math/Transform.js +++ b/src/math/Transform.js @@ -14,20 +14,22 @@ var Quaternion = require('./Quaternion'); * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. */ -function Transform(options) { - options = options || {}; - // Copy the values into this object if they exist - this.translation = new Vector3(options.translation); - this.rotation = new Quaternion(options.rotation); +class Transform { + constructor(options) { + options = options || {}; + // Copy the values into this object if they exist + this.translation = new Vector3(options.translation); + this.rotation = new Quaternion(options.rotation); + } + /** + * Clone a copy of this transform. + * + * @returns {Transform} The cloned transform. + */ + clone() { + return new Transform(this); + } } -/** - * Clone a copy of this transform. - * - * @returns {Transform} The cloned transform. - */ -Transform.prototype.clone = function() { - return new Transform(this); -}; module.exports = Transform; diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 398d1c8ea..245200bf9 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -12,57 +12,59 @@ * @param {number} [options.y=0] - The y value. * @param {number} [options.z=0] - The z value. */ -function Vector3(options) { - options = options || {}; - this.x = options.x || 0; - this.y = options.y || 0; - this.z = options.z || 0; +class Vector3 { + constructor(options) { + options = options || {}; + this.x = options.x || 0; + this.y = options.y || 0; + this.z = options.z || 0; + } + /** + * Set the values of this vector to the sum of itself and the given vector. + * + * @param {Vector3} v - The vector to add with. + */ + add(v) { + this.x += v.x; + this.y += v.y; + this.z += v.z; + } + /** + * Set the values of this vector to the difference of itself and the given vector. + * + * @param {Vector3} v - The vector to subtract with. + */ + subtract(v) { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + } + /** + * Multiply the given Quaternion with this vector. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + multiplyQuaternion(q) { + var ix = q.w * this.x + q.y * this.z - q.z * this.y; + var iy = q.w * this.y + q.z * this.x - q.x * this.z; + var iz = q.w * this.z + q.x * this.y - q.y * this.x; + var iw = -q.x * this.x - q.y * this.y - q.z * this.z; + this.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y; + this.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z; + this.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x; + } + /** + * Clone a copy of this vector. + * + * @returns {Vector3} The cloned vector. + */ + clone() { + return new Vector3(this); + } } -/** - * Set the values of this vector to the sum of itself and the given vector. - * - * @param {Vector3} v - The vector to add with. - */ -Vector3.prototype.add = function(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; -}; -/** - * Set the values of this vector to the difference of itself and the given vector. - * - * @param {Vector3} v - The vector to subtract with. - */ -Vector3.prototype.subtract = function(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; -}; -/** - * Multiply the given Quaternion with this vector. - * - * @param {Quaternion} q - The quaternion to multiply with. - */ -Vector3.prototype.multiplyQuaternion = function(q) { - var ix = q.w * this.x + q.y * this.z - q.z * this.y; - var iy = q.w * this.y + q.z * this.x - q.x * this.z; - var iz = q.w * this.z + q.x * this.y - q.y * this.x; - var iw = -q.x * this.x - q.y * this.y - q.z * this.z; - this.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y; - this.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z; - this.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x; -}; -/** - * Clone a copy of this vector. - * - * @returns {Vector3} The cloned vector. - */ -Vector3.prototype.clone = function() { - return new Vector3(this); -}; module.exports = Vector3; diff --git a/src/node/RosTCP.js b/src/node/RosTCP.js index de0a1f755..927f3e12f 100644 --- a/src/node/RosTCP.js +++ b/src/node/RosTCP.js @@ -1,8 +1,7 @@ var Ros = require('../core/Ros'); var SocketIO = require('./SocketIO'); var net = require('net'); -var socketAdapter = require('../core/SocketAdapter.js'); -var util = require('util'); +var socketAdapter = require("../core/SocketAdapter.js"); /** * Same as core Ros except supports TCP connections. @@ -10,52 +9,59 @@ var util = require('util'); * to connect to the front using socket.io. * @private */ -function RosTCP(options) { - options = options || {}; - if (!options.encoding) { - console.error('ROSLib uses utf8 encoding by default. ' + - 'It would be more efficient to use ascii (if possible).'); - } - this.encoding = options.encoding || 'utf8'; - Ros.call(this, options); +class RosTCP extends Ros { + constructor(options) { + super(options); + options = options || {}; + if (!options.encoding) { + console.error( + "ROSLib uses utf8 encoding by default. " + + "It would be more efficient to use ascii (if possible)." + ); + } + this.encoding = options.encoding || "utf8"; + Ros.call(this, options); - if (!this.socket && (options.host || options.port)) { - this.connect({ - host: options.host, - port: options.port - }); + if (!this.socket && (options.host || options.port)) { + this.connect({ + host: options.host, + port: options.port, + }); + } + if (options.http || options.socketio) { + this.io = new SocketIO(options, this); + } } - if(options.http || options.socketio){ - this.io = new SocketIO(options, this); + /** + * Connect to a live socket. + * + * @param {string|number|Object} url - Address and port to connect to (see http://nodejs.org/api/net.html). + * Format: {host: String, port: Int} or (port:Int) or "host:port". + */ + connect(url) { + if ( + typeof url === "string" && + (url.slice(0, 5) === "ws://" || url.slice(0, 6) === "wss://") + ) { + Ros.prototype.connect.call(this, url); + } else { + var events = socketAdapter(this); + this.socket = net + .connect(url) + .on("data", events.onmessage) + .on("close", events.onclose) + .on("error", events.onerror) + .on("connect", events.onopen); + this.socket.setEncoding(this.encoding); + this.socket.setTimeout(0); + + // Little hack for call on connection + this.socket.send = this.socket.write; + // Similarly for close + this.socket.close = this.socket.end; + } } } -util.inherits(RosTCP, Ros); - -/** - * Connect to a live socket. - * - * @param {string|number|Object} url - Address and port to connect to (see http://nodejs.org/api/net.html). - * Format: {host: String, port: Int} or (port:Int) or "host:port". - */ -RosTCP.prototype.connect = function(url) { - if (typeof url === 'string' && (url.slice(0, 5) === 'ws://' || url.slice(0, 6) === 'wss://')) { - Ros.prototype.connect.call(this, url); - } else { - var events = socketAdapter(this); - this.socket = net.connect(url) - .on('data', events.onmessage) - .on('close', events.onclose) - .on('error', events.onerror) - .on('connect', events.onopen); - this.socket.setEncoding(this.encoding); - this.socket.setTimeout(0); - - // Little hack for call on connection - this.socket.send = this.socket.write; - // Similarly for close - this.socket.close = this.socket.end; - } -}; module.exports = RosTCP; diff --git a/src/node/SocketIO.js b/src/node/SocketIO.js index 3d344a550..23aeedd14 100644 --- a/src/node/SocketIO.js +++ b/src/node/SocketIO.js @@ -1,38 +1,41 @@ var io = require('socket.io'); -function SocketIO(options, Ros){ +class SocketIO { + constructor(options, Ros) { this.socketio = null; this.socket = Ros.socket; if (options.http) { - this.socketio = io(options.http); - }else if(options.socketio){ - this.socketio = options.socketio; + this.socketio = io(options.http); + } else if (options.socketio) { + this.socketio = options.socketio; } var that = this; - this.socketio.on('connection', function(socket){ - socket.on('operation', that.sendToRosbridge.bind(that)); + this.socketio.on("connection", function (socket) { + socket.on("operation", that.sendToRosbridge.bind(that)); }); - Ros.on('connection', function(){ - that.socket.on('message', that.sendToFront('data').bind(that)) - .on('close', that.sendToFront('close').bind(that)) - .on('error', that.sendToFront('error').bind(that)) - .on('connect', that.sendToFront('connect').bind(that)); + Ros.on("connection", function () { + that.socket + .on("message", that.sendToFront("data").bind(that)) + .on("close", that.sendToFront("close").bind(that)) + .on("error", that.sendToFront("error").bind(that)) + .on("connect", that.sendToFront("connect").bind(that)); }); return this.socketio; + } + sendToFront(name, event) { + return function (event) { + this.socketio.emit(name, event); + }; + } + sendToRosbridge(msg) { + this.socket.send(msg); + } } -SocketIO.prototype.sendToFront = function(name, event){ - return function(event){ - this.socketio.emit(name, event); - }; -}; -SocketIO.prototype.sendToRosbridge = function(msg){ - this.socket.send(msg); -}; -module.exports = SocketIO; \ No newline at end of file +module.exports = SocketIO; diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index a6e2848bb..cfd2ed555 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -3,6 +3,7 @@ * @author David Gossow - dgossow@willowgarage.com */ +const { EventEmitter2 } = require("eventemitter2"); var ActionClient = require('../actionlib/ActionClient'); var Goal = require('../actionlib/Goal'); @@ -28,205 +29,205 @@ var Transform = require('../math/Transform'); * @param {string} [options.serverName=/tf2_web_republisher] - The name of the tf2_web_republisher server. * @param {string} [options.repubServiceName=/republish_tfs] - The name of the republish_tfs service (non groovy compatibility mode only). */ -function TFClient(options) { - options = options || {}; - this.ros = options.ros; - this.fixedFrame = options.fixedFrame || 'base_link'; - this.angularThres = options.angularThres || 2.0; - this.transThres = options.transThres || 0.01; - this.rate = options.rate || 10.0; - this.updateDelay = options.updateDelay || 50; - var seconds = options.topicTimeout || 2.0; - var secs = Math.floor(seconds); - var nsecs = Math.floor((seconds - secs) * 1000000000); - this.topicTimeout = { - secs: secs, - nsecs: nsecs - }; - this.serverName = options.serverName || '/tf2_web_republisher'; - this.repubServiceName = options.repubServiceName || '/republish_tfs'; - - this.currentGoal = false; - this.currentTopic = false; - this.frameInfos = {}; - this.republisherUpdateRequested = false; - this._subscribeCB = null; - this._isDisposed = false; - - // Create an Action Client - this.actionClient = new ActionClient({ - ros : options.ros, - serverName : this.serverName, - actionName : 'tf2_web_republisher/TFSubscriptionAction', - omitStatus : true, - omitResult : true - }); - - // Create a Service Client - this.serviceClient = new Service({ - ros: options.ros, - name: this.repubServiceName, - serviceType: 'tf2_web_republisher/RepublishTFs' - }); -} - -/** - * Process the incoming TF message and send them out using the callback - * functions. - * - * @param {Object} tf - The TF message from the server. - */ -TFClient.prototype.processTFArray = function(tf) { - var that = this; - tf.transforms.forEach(function(transform) { - var frameID = transform.child_frame_id; - if (frameID[0] === '/') - { - frameID = frameID.substring(1); - } - var info = this.frameInfos[frameID]; - if (info) { - info.transform = new Transform({ - translation : transform.transform.translation, - rotation : transform.transform.rotation - }); - info.cbs.forEach(function(cb) { - cb(info.transform); - }); - } - }, this); -}; - -/** - * Create and send a new goal (or service request) to the tf2_web_republisher - * based on the current list of TFs. - */ -TFClient.prototype.updateGoal = function() { - var goalMessage = { - source_frames : Object.keys(this.frameInfos), - target_frame : this.fixedFrame, - angular_thres : this.angularThres, - trans_thres : this.transThres, - rate : this.rate - }; - - // if we're running in groovy compatibility mode (the default) - // then use the action interface to tf2_web_republisher - if(this.ros.groovyCompatibility) { - if (this.currentGoal) { - this.currentGoal.cancel(); - } - this.currentGoal = new Goal({ - actionClient : this.actionClient, - goalMessage : goalMessage +class TFClient extends EventEmitter2 { + constructor(options) { + super(options); + options = options || {}; + this.ros = options.ros; + this.fixedFrame = options.fixedFrame || "base_link"; + this.angularThres = options.angularThres || 2.0; + this.transThres = options.transThres || 0.01; + this.rate = options.rate || 10.0; + this.updateDelay = options.updateDelay || 50; + var seconds = options.topicTimeout || 2.0; + var secs = Math.floor(seconds); + var nsecs = Math.floor((seconds - secs) * 1000000000); + this.topicTimeout = { + secs: secs, + nsecs: nsecs, + }; + this.serverName = options.serverName || "/tf2_web_republisher"; + this.repubServiceName = options.repubServiceName || "/republish_tfs"; + + this.currentGoal = false; + this.currentTopic = false; + this.frameInfos = {}; + this.republisherUpdateRequested = false; + this._subscribeCB = null; + this._isDisposed = false; + + // Create an Action Client + this.actionClient = new ActionClient({ + ros: options.ros, + serverName: this.serverName, + actionName: "tf2_web_republisher/TFSubscriptionAction", + omitStatus: true, + omitResult: true, }); - this.currentGoal.on('feedback', this.processTFArray.bind(this)); - this.currentGoal.send(); + // Create a Service Client + this.serviceClient = new Service({ + ros: options.ros, + name: this.repubServiceName, + serviceType: "tf2_web_republisher/RepublishTFs", + }); } - else { - // otherwise, use the service interface - // The service interface has the same parameters as the action, - // plus the timeout - goalMessage.timeout = this.topicTimeout; - var request = new ServiceRequest(goalMessage); - - this.serviceClient.callService(request, this.processResponse.bind(this)); + /** + * Process the incoming TF message and send them out using the callback + * functions. + * + * @param {Object} tf - The TF message from the server. + */ + processTFArray(tf) { + var that = this; + tf.transforms.forEach(function (transform) { + var frameID = transform.child_frame_id; + if (frameID[0] === "/") { + frameID = frameID.substring(1); + } + var info = this.frameInfos[frameID]; + if (info) { + info.transform = new Transform({ + translation: transform.transform.translation, + rotation: transform.transform.rotation, + }); + info.cbs.forEach(function (cb) { + cb(info.transform); + }); + } + }, this); } + /** + * Create and send a new goal (or service request) to the tf2_web_republisher + * based on the current list of TFs. + */ + updateGoal() { + var goalMessage = { + source_frames: Object.keys(this.frameInfos), + target_frame: this.fixedFrame, + angular_thres: this.angularThres, + trans_thres: this.transThres, + rate: this.rate, + }; - this.republisherUpdateRequested = false; -}; + // if we're running in groovy compatibility mode (the default) + // then use the action interface to tf2_web_republisher + if (this.ros.groovyCompatibility) { + if (this.currentGoal) { + this.currentGoal.cancel(); + } + this.currentGoal = new Goal({ + actionClient: this.actionClient, + goalMessage: goalMessage, + }); -/** - * Process the service response and subscribe to the tf republisher - * topic. - * - * @param {Object} response - The service response containing the topic name. - */ -TFClient.prototype.processResponse = function(response) { - // Do not setup a topic subscription if already disposed. Prevents a race condition where - // The dispose() function is called before the service call receives a response. - if (this._isDisposed) { - return; - } + this.currentGoal.on("feedback", this.processTFArray.bind(this)); + this.currentGoal.send(); + } else { + // otherwise, use the service interface + // The service interface has the same parameters as the action, + // plus the timeout + goalMessage.timeout = this.topicTimeout; + var request = new ServiceRequest(goalMessage); + + this.serviceClient.callService(request, this.processResponse.bind(this)); + } - // if we subscribed to a topic before, unsubscribe so - // the republisher stops publishing it - if (this.currentTopic) { - this.currentTopic.unsubscribe(this._subscribeCB); + this.republisherUpdateRequested = false; } + /** + * Process the service response and subscribe to the tf republisher + * topic. + * + * @param {Object} response - The service response containing the topic name. + */ + processResponse(response) { + // Do not setup a topic subscription if already disposed. Prevents a race condition where + // The dispose() function is called before the service call receives a response. + if (this._isDisposed) { + return; + } - this.currentTopic = new Topic({ - ros: this.ros, - name: response.topic_name, - messageType: 'tf2_web_republisher/TFArray' - }); - this._subscribeCB = this.processTFArray.bind(this); - this.currentTopic.subscribe(this._subscribeCB); -}; + // if we subscribed to a topic before, unsubscribe so + // the republisher stops publishing it + if (this.currentTopic) { + this.currentTopic.unsubscribe(this._subscribeCB); + } -/** - * Subscribe to the given TF frame. - * - * @param {string} frameID - The TF frame to subscribe to. - * @param {function} callback - Function with the following params: - * @param {Transform} callback.transform - The transform data. - */ -TFClient.prototype.subscribe = function(frameID, callback) { - // remove leading slash, if it's there - if (frameID[0] === '/') - { - frameID = frameID.substring(1); + this.currentTopic = new Topic({ + ros: this.ros, + name: response.topic_name, + messageType: "tf2_web_republisher/TFArray", + }); + this._subscribeCB = this.processTFArray.bind(this); + this.currentTopic.subscribe(this._subscribeCB); } - // if there is no callback registered for the given frame, create empty callback list - if (!this.frameInfos[frameID]) { - this.frameInfos[frameID] = { - cbs: [] - }; - if (!this.republisherUpdateRequested) { - setTimeout(this.updateGoal.bind(this), this.updateDelay); - this.republisherUpdateRequested = true; + /** + * Subscribe to the given TF frame. + * + * @param {string} frameID - The TF frame to subscribe to. + * @param {function} callback - Function with the following params: + * @param {Transform} callback.transform - The transform data. + */ + subscribe(frameID, callback) { + // remove leading slash, if it's there + if (frameID[0] === "/") { + frameID = frameID.substring(1); + } + // if there is no callback registered for the given frame, create empty callback list + if (!this.frameInfos[frameID]) { + this.frameInfos[frameID] = { + cbs: [], + }; + if (!this.republisherUpdateRequested) { + setTimeout(this.updateGoal.bind(this), this.updateDelay); + this.republisherUpdateRequested = true; + } } - } - // if we already have a transform, callback immediately - else if (this.frameInfos[frameID].transform) { - callback(this.frameInfos[frameID].transform); - } - this.frameInfos[frameID].cbs.push(callback); -}; -/** - * Unsubscribe from the given TF frame. - * - * @param {string} frameID - The TF frame to unsubscribe from. - * @param {function} callback - The callback function to remove. - */ -TFClient.prototype.unsubscribe = function(frameID, callback) { - // remove leading slash, if it's there - if (frameID[0] === '/') - { - frameID = frameID.substring(1); + // if we already have a transform, callback immediately + else if (this.frameInfos[frameID].transform) { + callback(this.frameInfos[frameID].transform); + } + this.frameInfos[frameID].cbs.push(callback); } - var info = this.frameInfos[frameID]; - for (var cbs = info && info.cbs || [], idx = cbs.length; idx--;) { - if (cbs[idx] === callback) { - cbs.splice(idx, 1); + /** + * Unsubscribe from the given TF frame. + * + * @param {string} frameID - The TF frame to unsubscribe from. + * @param {function} callback - The callback function to remove. + */ + unsubscribe(frameID, callback) { + // remove leading slash, if it's there + if (frameID[0] === "/") { + frameID = frameID.substring(1); + } + var info = this.frameInfos[frameID]; + for (var cbs = (info && info.cbs) || [], idx = cbs.length; idx--; ) { + if (cbs[idx] === callback) { + cbs.splice(idx, 1); + } + } + if (!callback || cbs.length === 0) { + delete this.frameInfos[frameID]; } } - if (!callback || cbs.length === 0) { - delete this.frameInfos[frameID]; + /** + * Unsubscribe and unadvertise all topics associated with this TFClient. + */ + dispose() { + this._isDisposed = true; + this.actionClient.dispose(); + if (this.currentTopic) { + this.currentTopic.unsubscribe(this._subscribeCB); + } } -}; +} + + + + + -/** - * Unsubscribe and unadvertise all topics associated with this TFClient. - */ -TFClient.prototype.dispose = function() { - this._isDisposed = true; - this.actionClient.dispose(); - if (this.currentTopic) { - this.currentTopic.unsubscribe(this._subscribeCB); - } -}; module.exports = TFClient; diff --git a/src/urdf/UrdfBox.js b/src/urdf/UrdfBox.js index cf9ba5a69..b2a745af1 100644 --- a/src/urdf/UrdfBox.js +++ b/src/urdf/UrdfBox.js @@ -14,17 +14,19 @@ var UrdfTypes = require('./UrdfTypes'); * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfBox(options) { - this.dimension = null; - this.type = UrdfTypes.URDF_BOX; +class UrdfBox { + constructor(options) { + this.dimension = null; + this.type = UrdfTypes.URDF_BOX; - // Parse the xml string - var xyz = options.xml.getAttribute('size').split(' '); - this.dimension = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); + // Parse the xml string + var xyz = options.xml.getAttribute("size").split(" "); + this.dimension = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } } module.exports = UrdfBox; diff --git a/src/urdf/UrdfColor.js b/src/urdf/UrdfColor.js index e7b492cd0..0a02b17ea 100644 --- a/src/urdf/UrdfColor.js +++ b/src/urdf/UrdfColor.js @@ -11,13 +11,15 @@ * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfColor(options) { - // Parse the xml string - var rgba = options.xml.getAttribute('rgba').split(' '); - this.r = parseFloat(rgba[0]); - this.g = parseFloat(rgba[1]); - this.b = parseFloat(rgba[2]); - this.a = parseFloat(rgba[3]); +class UrdfColor { + constructor(options) { + // Parse the xml string + var rgba = options.xml.getAttribute("rgba").split(" "); + this.r = parseFloat(rgba[0]); + this.g = parseFloat(rgba[1]); + this.b = parseFloat(rgba[2]); + this.a = parseFloat(rgba[3]); + } } module.exports = UrdfColor; diff --git a/src/urdf/UrdfCylinder.js b/src/urdf/UrdfCylinder.js index 17fe36038..0fd0ab6fd 100644 --- a/src/urdf/UrdfCylinder.js +++ b/src/urdf/UrdfCylinder.js @@ -13,10 +13,12 @@ var UrdfTypes = require('./UrdfTypes'); * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfCylinder(options) { - this.type = UrdfTypes.URDF_CYLINDER; - this.length = parseFloat(options.xml.getAttribute('length')); - this.radius = parseFloat(options.xml.getAttribute('radius')); +class UrdfCylinder { + constructor(options) { + this.type = UrdfTypes.URDF_CYLINDER; + this.length = parseFloat(options.xml.getAttribute("length")); + this.radius = parseFloat(options.xml.getAttribute("radius")); + } } module.exports = UrdfCylinder; diff --git a/src/urdf/UrdfJoint.js b/src/urdf/UrdfJoint.js index 02c95c021..8e47659c1 100644 --- a/src/urdf/UrdfJoint.js +++ b/src/urdf/UrdfJoint.js @@ -14,77 +14,83 @@ var Quaternion = require('../math/Quaternion'); * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfJoint(options) { - this.name = options.xml.getAttribute('name'); - this.type = options.xml.getAttribute('type'); +class UrdfJoint { + constructor(options) { + this.name = options.xml.getAttribute("name"); + this.type = options.xml.getAttribute("type"); - var parents = options.xml.getElementsByTagName('parent'); - if(parents.length > 0) { - this.parent = parents[0].getAttribute('link'); - } - - var children = options.xml.getElementsByTagName('child'); - if(children.length > 0) { - this.child = children[0].getAttribute('link'); - } + var parents = options.xml.getElementsByTagName("parent"); + if (parents.length > 0) { + this.parent = parents[0].getAttribute("link"); + } - var limits = options.xml.getElementsByTagName('limit'); - if (limits.length > 0) { - this.minval = parseFloat( limits[0].getAttribute('lower') ); - this.maxval = parseFloat( limits[0].getAttribute('upper') ); - } + var children = options.xml.getElementsByTagName("child"); + if (children.length > 0) { + this.child = children[0].getAttribute("link"); + } - // Origin - var origins = options.xml.getElementsByTagName('origin'); - if (origins.length === 0) { - // use the identity as the default - this.origin = new Pose(); - } else { - // Check the XYZ - var xyz = origins[0].getAttribute('xyz'); - var position = new Vector3(); - if (xyz) { - xyz = xyz.split(' '); - position = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); + var limits = options.xml.getElementsByTagName("limit"); + if (limits.length > 0) { + this.minval = parseFloat(limits[0].getAttribute("lower")); + this.maxval = parseFloat(limits[0].getAttribute("upper")); } - // Check the RPY - var rpy = origins[0].getAttribute('rpy'); - var orientation = new Quaternion(); - if (rpy) { - rpy = rpy.split(' '); - // Convert from RPY - var roll = parseFloat(rpy[0]); - var pitch = parseFloat(rpy[1]); - var yaw = parseFloat(rpy[2]); - var phi = roll / 2.0; - var the = pitch / 2.0; - var psi = yaw / 2.0; - var x = Math.sin(phi) * Math.cos(the) * Math.cos(psi) - Math.cos(phi) * Math.sin(the) - * Math.sin(psi); - var y = Math.cos(phi) * Math.sin(the) * Math.cos(psi) + Math.sin(phi) * Math.cos(the) - * Math.sin(psi); - var z = Math.cos(phi) * Math.cos(the) * Math.sin(psi) - Math.sin(phi) * Math.sin(the) - * Math.cos(psi); - var w = Math.cos(phi) * Math.cos(the) * Math.cos(psi) + Math.sin(phi) * Math.sin(the) - * Math.sin(psi); + // Origin + var origins = options.xml.getElementsByTagName("origin"); + if (origins.length === 0) { + // use the identity as the default + this.origin = new Pose(); + } else { + // Check the XYZ + var xyz = origins[0].getAttribute("xyz"); + var position = new Vector3(); + if (xyz) { + xyz = xyz.split(" "); + position = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } + + // Check the RPY + var rpy = origins[0].getAttribute("rpy"); + var orientation = new Quaternion(); + if (rpy) { + rpy = rpy.split(" "); + // Convert from RPY + var roll = parseFloat(rpy[0]); + var pitch = parseFloat(rpy[1]); + var yaw = parseFloat(rpy[2]); + var phi = roll / 2.0; + var the = pitch / 2.0; + var psi = yaw / 2.0; + var x = + Math.sin(phi) * Math.cos(the) * Math.cos(psi) - + Math.cos(phi) * Math.sin(the) * Math.sin(psi); + var y = + Math.cos(phi) * Math.sin(the) * Math.cos(psi) + + Math.sin(phi) * Math.cos(the) * Math.sin(psi); + var z = + Math.cos(phi) * Math.cos(the) * Math.sin(psi) - + Math.sin(phi) * Math.sin(the) * Math.cos(psi); + var w = + Math.cos(phi) * Math.cos(the) * Math.cos(psi) + + Math.sin(phi) * Math.sin(the) * Math.sin(psi); - orientation = new Quaternion({ - x : x, - y : y, - z : z, - w : w + orientation = new Quaternion({ + x: x, + y: y, + z: z, + w: w, + }); + orientation.normalize(); + } + this.origin = new Pose({ + position: position, + orientation: orientation, }); - orientation.normalize(); } - this.origin = new Pose({ - position : position, - orientation : orientation - }); } } diff --git a/src/urdf/UrdfLink.js b/src/urdf/UrdfLink.js index b259857ab..3fffd3ebe 100644 --- a/src/urdf/UrdfLink.js +++ b/src/urdf/UrdfLink.js @@ -13,15 +13,19 @@ var UrdfVisual = require('./UrdfVisual'); * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfLink(options) { - this.name = options.xml.getAttribute('name'); - this.visuals = []; - var visuals = options.xml.getElementsByTagName('visual'); +class UrdfLink { + constructor(options) { + this.name = options.xml.getAttribute("name"); + this.visuals = []; + var visuals = options.xml.getElementsByTagName("visual"); - for( var i=0; i 0) { - this.textureFilename = textures[0].getAttribute('filename'); +class UrdfMaterial { + constructor(options) { + this.textureFilename = null; + this.color = null; + + this.name = options.xml.getAttribute("name"); + + // Texture + var textures = options.xml.getElementsByTagName("texture"); + if (textures.length > 0) { + this.textureFilename = textures[0].getAttribute("filename"); + } + + // Color + var colors = options.xml.getElementsByTagName("color"); + if (colors.length > 0) { + // Parse the RBGA string + this.color = new UrdfColor({ + xml: colors[0], + }); + } } - - // Color - var colors = options.xml.getElementsByTagName('color'); - if (colors.length > 0) { - // Parse the RBGA string - this.color = new UrdfColor({ - xml : colors[0] - }); + isLink() { + return this.color === null && this.textureFilename === null; + } + assign(obj) { + return assign(this, obj); } } -UrdfMaterial.prototype.isLink = function() { - return this.color === null && this.textureFilename === null; -}; var assign = require('object-assign'); -UrdfMaterial.prototype.assign = function(obj) { - return assign(this, obj); -}; module.exports = UrdfMaterial; diff --git a/src/urdf/UrdfMesh.js b/src/urdf/UrdfMesh.js index 719843ed2..dab878e0c 100644 --- a/src/urdf/UrdfMesh.js +++ b/src/urdf/UrdfMesh.js @@ -14,22 +14,24 @@ var UrdfTypes = require('./UrdfTypes'); * @param {Object} options * @param {Element} options.xml - The XML element to parse. */ -function UrdfMesh(options) { - this.scale = null; +class UrdfMesh { + constructor(options) { + this.scale = null; - this.type = UrdfTypes.URDF_MESH; - this.filename = options.xml.getAttribute('filename'); + this.type = UrdfTypes.URDF_MESH; + this.filename = options.xml.getAttribute("filename"); - // Check for a scale - var scale = options.xml.getAttribute('scale'); - if (scale) { - // Get the XYZ - var xyz = scale.split(' '); - this.scale = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); + // Check for a scale + var scale = options.xml.getAttribute("scale"); + if (scale) { + // Get the XYZ + var xyz = scale.split(" "); + this.scale = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } } } diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index a7e68eba9..ac57a25e9 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -20,74 +20,75 @@ var XPATH_FIRST_ORDERED_NODE_TYPE = 9; * @param {Element} options.xml - The XML element to parse. * @param {string} options.string - The XML element to parse as a string. */ -function UrdfModel(options) { - options = options || {}; - var xmlDoc = options.xml; - var string = options.string; - this.materials = {}; - this.links = {}; - this.joints = {}; +class UrdfModel { + constructor(options) { + options = options || {}; + var xmlDoc = options.xml; + var string = options.string; + this.materials = {}; + this.links = {}; + this.joints = {}; - // Check if we are using a string or an XML element - if (string) { - // Parse the string - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(string, 'text/xml'); - } + // Check if we are using a string or an XML element + if (string) { + // Parse the string + var parser = new DOMParser(); + xmlDoc = parser.parseFromString(string, "text/xml"); + } - // Initialize the model with the given XML node. - // Get the robot tag - var robotXml = xmlDoc.documentElement; + // Initialize the model with the given XML node. + // Get the robot tag + var robotXml = xmlDoc.documentElement; - // Get the robot name - this.name = robotXml.getAttribute('name'); + // Get the robot name + this.name = robotXml.getAttribute("name"); - // Parse all the visual elements we need - for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (node.tagName === 'material') { - var material = new UrdfMaterial({ - xml : node - }); - // Make sure this is unique - if (this.materials[material.name] !== void 0) { - if( this.materials[material.name].isLink() ) { - this.materials[material.name].assign( material ); + // Parse all the visual elements we need + for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (node.tagName === "material") { + var material = new UrdfMaterial({ + xml: node, + }); + // Make sure this is unique + if (this.materials[material.name] !== void 0) { + if (this.materials[material.name].isLink()) { + this.materials[material.name].assign(material); + } else { + console.warn("Material " + material.name + "is not unique."); + } } else { - console.warn('Material ' + material.name + 'is not unique.'); + this.materials[material.name] = material; } - } else { - this.materials[material.name] = material; - } - } else if (node.tagName === 'link') { - var link = new UrdfLink({ - xml : node - }); - // Make sure this is unique - if (this.links[link.name] !== void 0) { - console.warn('Link ' + link.name + ' is not unique.'); - } else { - // Check for a material - for( var j=0; j 0) { - var geom = geoms[0]; - var shape = null; - // Check for the shape - for (var i = 0; i < geom.childNodes.length; i++) { - var node = geom.childNodes[i]; - if (node.nodeType === 1) { - shape = node; - break; + // Geometry + var geoms = xml.getElementsByTagName("geometry"); + if (geoms.length > 0) { + var geom = geoms[0]; + var shape = null; + // Check for the shape + for (var i = 0; i < geom.childNodes.length; i++) { + var node = geom.childNodes[i]; + if (node.nodeType === 1) { + shape = node; + break; + } + } + // Check the type + var type = shape.nodeName; + if (type === "sphere") { + this.geometry = new UrdfSphere({ + xml: shape, + }); + } else if (type === "box") { + this.geometry = new UrdfBox({ + xml: shape, + }); + } else if (type === "cylinder") { + this.geometry = new UrdfCylinder({ + xml: shape, + }); + } else if (type === "mesh") { + this.geometry = new UrdfMesh({ + xml: shape, + }); + } else { + console.warn("Unknown geometry type " + type); } } - // Check the type - var type = shape.nodeName; - if (type === 'sphere') { - this.geometry = new UrdfSphere({ - xml : shape - }); - } else if (type === 'box') { - this.geometry = new UrdfBox({ - xml : shape - }); - } else if (type === 'cylinder') { - this.geometry = new UrdfCylinder({ - xml : shape - }); - } else if (type === 'mesh') { - this.geometry = new UrdfMesh({ - xml : shape + + // Material + var materials = xml.getElementsByTagName("material"); + if (materials.length > 0) { + this.material = new UrdfMaterial({ + xml: materials[0], }); - } else { - console.warn('Unknown geometry type ' + type); } } - - // Material - var materials = xml.getElementsByTagName('material'); - if (materials.length > 0) { - this.material = new UrdfMaterial({ - xml : materials[0] - }); - } } module.exports = UrdfVisual; diff --git a/src/util/workerSocket.js b/src/util/workerSocket.js index 1db935b00..c22223bc0 100644 --- a/src/util/workerSocket.js +++ b/src/util/workerSocket.js @@ -6,44 +6,49 @@ try { } var workerSocketImpl = require('./workerSocketImpl'); -function WorkerSocket(uri) { - this.socket_ = work(workerSocketImpl); +class WorkerSocket { + constructor(uri) { + this.socket_ = work(workerSocketImpl); - this.socket_.addEventListener('message', this.handleWorkerMessage_.bind(this)); + this.socket_.addEventListener( + "message", + this.handleWorkerMessage_.bind(this) + ); - this.socket_.postMessage({ - uri: uri, - }); -} - -WorkerSocket.prototype.handleWorkerMessage_ = function(ev) { - var data = ev.data; - if (data instanceof ArrayBuffer || typeof data === 'string') { - // binary or JSON message from rosbridge - this.onmessage(ev); - } else { - // control message from the wrapped WebSocket - var type = data.type; - if (type === 'close') { - this.onclose(null); - } else if (type === 'open') { - this.onopen(null); - } else if (type === 'error') { - this.onerror(null); + this.socket_.postMessage({ + uri: uri, + }); + } + handleWorkerMessage_(ev) { + var data = ev.data; + if (data instanceof ArrayBuffer || typeof data === "string") { + // binary or JSON message from rosbridge + this.onmessage(ev); } else { - throw 'Unknown message from workersocket'; + // control message from the wrapped WebSocket + var type = data.type; + if (type === "close") { + this.onclose(null); + } else if (type === "open") { + this.onopen(null); + } else if (type === "error") { + this.onerror(null); + } else { + throw "Unknown message from workersocket"; + } } } -}; + send(data) { + this.socket_.postMessage(data); + } + close() { + this.socket_.postMessage({ + close: true, + }); + } +} + -WorkerSocket.prototype.send = function(data) { - this.socket_.postMessage(data); -}; -WorkerSocket.prototype.close = function() { - this.socket_.postMessage({ - close: true - }); -}; module.exports = WorkerSocket; From 3b7cc6a0c2c1af44c7726727f07f193962c6ee59 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 14:42:35 -0700 Subject: [PATCH 03/66] Fix some missing imports --- src/actionlib/ActionClient.js | 1 + src/actionlib/ActionListener.js | 1 + src/actionlib/Goal.js | 1 + src/actionlib/SimpleActionServer.js | 1 + src/core/Param.js | 1 + src/core/Service.js | 1 + src/core/Topic.js | 1 + src/math/Pose.js | 1 + src/math/Vector3.js | 2 ++ src/tf/TFClient.js | 2 ++ 10 files changed, 12 insertions(+) diff --git a/src/actionlib/ActionClient.js b/src/actionlib/ActionClient.js index 9f4e6f148..6831cb02e 100644 --- a/src/actionlib/ActionClient.js +++ b/src/actionlib/ActionClient.js @@ -6,6 +6,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require("../core/Ros"); /** * An actionlib action client. diff --git a/src/actionlib/ActionListener.js b/src/actionlib/ActionListener.js index 912cb7906..4e1e7e071 100644 --- a/src/actionlib/ActionListener.js +++ b/src/actionlib/ActionListener.js @@ -7,6 +7,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require("../core/Ros"); /** * An actionlib action listener. diff --git a/src/actionlib/Goal.js b/src/actionlib/Goal.js index a8c333b31..7358e557c 100644 --- a/src/actionlib/Goal.js +++ b/src/actionlib/Goal.js @@ -5,6 +5,7 @@ var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var ActionClient = require("./ActionClient"); /** * An actionlib goal that is associated with an action server. diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index c500a9ba6..7146a1044 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -6,6 +6,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require("../core/Ros"); /** * An actionlib action server client. diff --git a/src/core/Param.js b/src/core/Param.js index 36f384d50..b6c90fb41 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -5,6 +5,7 @@ var Service = require('./Service'); var ServiceRequest = require('./ServiceRequest'); +var Ros = require("../core/Ros"); /** * A ROS parameter. diff --git a/src/core/Service.js b/src/core/Service.js index 493b31851..777d938c0 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -6,6 +6,7 @@ var ServiceResponse = require('./ServiceResponse'); var ServiceRequest = require('./ServiceRequest'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require("../core/Ros"); /** * A ROS service client. diff --git a/src/core/Topic.js b/src/core/Topic.js index 9f2c8b18d..c0e2a3cc7 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -5,6 +5,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Message = require('./Message'); +var Ros = require("../core/Ros"); /** * Publish and/or subscribe to a topic in ROS. diff --git a/src/math/Pose.js b/src/math/Pose.js index 348e3ab35..8c750801a 100644 --- a/src/math/Pose.js +++ b/src/math/Pose.js @@ -5,6 +5,7 @@ var Vector3 = require('./Vector3'); var Quaternion = require('./Quaternion'); +var Transform = require("./Transform"); /** * A Pose in 3D space. Values are copied into this object. diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 245200bf9..0c3d27dd2 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -3,6 +3,8 @@ * @author David Gossow - dgossow@willowgarage.com */ +var Quaternion = require("./Quaternion"); + /** * A 3D vector. * diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index cfd2ed555..67144b52b 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -13,6 +13,8 @@ var Topic = require('../core/Topic.js'); var Transform = require('../math/Transform'); +var Ros = require("../core/Ros"); + /** * A TF Client that listens to TFs from tf2_web_republisher. * From 1d88c5d3bde102f890d7920579a238b384ca8cfa Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:09:09 -0700 Subject: [PATCH 04/66] JSDoc syntax fixes for Ros.js --- src/core/Message.js | 6 +- src/core/Ros.js | 231 +++++++++++++++++++++++++------------ src/core/ServiceRequest.js | 6 +- 3 files changed, 165 insertions(+), 78 deletions(-) diff --git a/src/core/Message.js b/src/core/Message.js index 4dbec3e16..e1b61d472 100644 --- a/src/core/Message.js +++ b/src/core/Message.js @@ -9,10 +9,10 @@ var assign = require('object-assign'); * Message objects are used for publishing and subscribing to and from topics. * * @constructor - * @param {Object} values - An object matching the fields defined in the .msg definition file. + * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. */ function Message(values) { - assign(this, values); + assign(this, values || {}); } -module.exports = Message; \ No newline at end of file +module.exports = Message; diff --git a/src/core/Ros.js b/src/core/Ros.js index 1199e1f3b..18364f224 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -178,13 +178,19 @@ class Ros extends EventEmitter2 { this.callOnConnection(levelMsg); } + /** + * @callback getActionServersCallback + * @param {string[]} actionservers - Array of action server names. + */ + /** + * @callback getActionServersFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of action servers in ROS as an array of string. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.actionservers - Array of action server names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getActionServersCallback} callback - Function with the following params: + * @param {getActionServersFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getActionServers(callback, failedCallback) { var getActionServers = new Service({ @@ -210,15 +216,21 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getTopicsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + */ + /** + * @callback getTopicsFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of topics in ROS as an array. * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getTopicsCallback} callback - Function with the following params: + * @param {getTopicsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getTopics(callback, failedCallback) { var topicsClient = new Service({ @@ -244,14 +256,20 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getTopicsForTypeCallback + * @param {string[]} topics - Array of topic names. + */ + /** + * @callback getTopicsForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of topics in ROS as an array of a specific type. * * @param {string} topicType - The topic type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of topic names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getTopicsForTypeCallback} callback - Function with the following params: + * @param {getTopicsForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getTopicsForType(topicType, callback, failedCallback) { var topicsForTypeClient = new Service({ @@ -279,13 +297,19 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getServicesCallback + * @param {string[]} services - Array of service names. + */ + /** + * @callback getServicesFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of active service names in ROS. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.services - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getServicesCallback} callback - Function with the following params: + * @param {getServicesFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServices(callback, failedCallback) { var servicesClient = new Service({ @@ -311,14 +335,20 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getServicesForTypeCallback + * @param {string[]} topics - Array of service names. + */ + /** + * @callback getServicesForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of services in ROS as an array as specific type. * * @param {string} serviceType - The service type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getServicesForTypeCallback} callback - Function with the following params: + * @param {getServicesForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServicesForType(serviceType, callback, failedCallback) { var servicesForTypeClient = new Service({ @@ -346,15 +376,21 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getServiceRequestDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service request. + */ + /** + * @callback getServiceRequestDetailsFailedCallback + * @param {string} failedCallback.error - The error message reported by ROS. + */ /** * Retrieve the details of a ROS service request. * * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getServiceRequestDetailsCallback} callback - Function with the following params: + * @param {getServiceRequestDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServiceRequestDetails(type, callback, failedCallback) { var serviceTypeClient = new Service({ @@ -382,15 +418,21 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getServiceResponseDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service response. + */ + /** + * @callback getServiceResponseDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve the details of a ROS service response. * * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service response. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getServiceResponseDetailsCallback} callback - Function with the following params: + * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServiceResponseDetails(type, callback, failedCallback) { var serviceTypeClient = new Service({ @@ -418,13 +460,19 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getNodesCallback + * @param {string[]} nodes - Array of node names. + */ + /** + * @callback getNodesFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of active node names in ROS. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.nodes - Array of node names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getNodesCallback} callback - Function with the following params: + * @param {getNodesFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getNodes(callback, failedCallback) { var nodesClient = new Service({ @@ -450,18 +498,31 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getNodeDetailsCallback + * @param {string[]} subscriptions - Array of subscribed topic names. + * @param {string[]} publications - Array of published topic names. + * @param {string[]} services - Array of service names hosted. + */ + /** + * @callback getNodeDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * @callback getNodeDetailsLegacyCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.subscribing - Array of subscribed topic names. + * @param {string[]} result.publishing - Array of published topic names. + * @param {string[]} result.services - Array of service names hosted. + */ /** * Retrieve a list of subscribed topics, publishing topics and services of a specific node. *
* These are the parameters if failedCallback is defined. * * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.subscriptions - Array of subscribed topic names. - * @param {string[]} callback.publications - Array of published topic names. - * @param {string[]} callback.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getNodeDetailsCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: * * @also * @@ -470,13 +531,8 @@ class Ros extends EventEmitter2 { * These are the parameters if failedCallback is undefined. * * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.subscribing - Array of subscribed topic names. - * @param {string[]} callback.result.publishing - Array of published topic names. - * @param {string[]} callback.result.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getNodeDetailsLegacyCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getNodeDetails(node, callback, failedCallback) { var nodesClient = new Service({ @@ -500,17 +556,24 @@ class Ros extends EventEmitter2 { ); } else { nodesClient.callService(request, function (result) { + // @ts-expect-error -- callback parameter polymorphism, see JSDoc comment above callback(result); }); } } + /** + * @callback getParamsCallback + * @param {string[]} params - Array of param names. + */ + /** + * @callback getParamsFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of parameter names from the ROS Parameter Server. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.params - Array of param names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getParamsCallback} callback - Function with the following params: + * @param {getParamsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getParams(callback, failedCallback) { var paramsClient = new Service({ @@ -535,14 +598,20 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getTopicTypeCallback + * @param {string} type - The type of the topic. + */ + /** + * @callback getTopicTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve the type of a ROS topic. * * @param {string} topic - Name of the topic. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the topic. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getTopicTypeCallback} callback - Function with the following params: + * @param {getTopicTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getTopicType(topic, callback, failedCallback) { var topicTypeClient = new Service({ @@ -570,14 +639,20 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getServiceTypeCallback + * @param {string} type - The type of the service. + */ + /** + * @callback getServiceTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve the type of a ROS service. * * @param {string} service - Name of the service. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the service. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getServiceTypeCallback} callback - Function with the following params: + * @param {getServiceTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServiceType(service, callback, failedCallback) { var serviceTypeClient = new Service({ @@ -605,14 +680,20 @@ class Ros extends EventEmitter2 { }); } } + /** + * @callback getMessageDetailsCallback + * @param {string} details - An array of the message details. + */ + /** + * @callback getMessageDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve the details of a ROS message. * * @param {string} message - The name of the message type. - * @param {function} callback - Function with the following params: - * @param {string} callback.details - An array of the message details. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getMessageDetailsCallback} callback - Function with the following params: + * @param {getMessageDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getMessageDetails(message, callback, failedCallback) { var messageDetailClient = new Service({ @@ -691,16 +772,22 @@ class Ros extends EventEmitter2 { return decodeTypeDefsRec(defs[0], defs); } + /** + * @callback getTopicsAndRawTypesCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + * @param {string[]} result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. + */ + /** + * @callback getTopicsAndRawTypesFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Retrieve a list of topics and their associated type definitions. * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {string[]} callback.result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {getTopicsAndRawTypesCallback} callback - Function with the following params: + * @param {getTopicsAndRawTypesFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getTopicsAndRawTypes(callback, failedCallback) { var topicsAndRawTypesClient = new Service({ diff --git a/src/core/ServiceRequest.js b/src/core/ServiceRequest.js index 32db480ad..ff9e64d48 100644 --- a/src/core/ServiceRequest.js +++ b/src/core/ServiceRequest.js @@ -9,10 +9,10 @@ var assign = require('object-assign'); * A ServiceRequest is passed into the service call. * * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. + * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. */ function ServiceRequest(values) { - assign(this, values); + assign(this, values || {}); } -module.exports = ServiceRequest; \ No newline at end of file +module.exports = ServiceRequest; From c2de6955a4f4afd1ae56be09d9d0032ef5a0ffbf Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:17:48 -0700 Subject: [PATCH 05/66] fix more callback jsdoc issues --- src/core/Param.js | 7 +++++-- src/core/Ros.js | 2 +- src/core/Service.js | 27 ++++++++++++++++++--------- src/core/Topic.js | 9 ++++++--- src/tf/TFClient.js | 7 +++++-- src/util/decompressPng.js | 9 ++++++--- src/util/shim/decompressPng.js | 7 +++++-- 7 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/core/Param.js b/src/core/Param.js index b6c90fb41..20b7e6c30 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -21,11 +21,14 @@ class Param { this.ros = options.ros; this.name = options.name; } + /** + * @callback getCallback + * @param {Object} value - The value of the param from ROS. + */ /** * Fetch the value of the param. * - * @param {function} callback - Function with the following params: - * @param {Object} callback.value - The value of the param from ROS. + * @param {getCallback} callback - Function with the following params: */ get(callback) { var paramClient = new Service({ diff --git a/src/core/Ros.js b/src/core/Ros.js index 18364f224..79575384e 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -383,7 +383,7 @@ class Ros extends EventEmitter2 { */ /** * @callback getServiceRequestDetailsFailedCallback - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {string} error - The error message reported by ROS. */ /** * Retrieve the details of a ROS service request. diff --git a/src/core/Service.js b/src/core/Service.js index 777d938c0..2a5f801f6 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -28,15 +28,21 @@ class Service extends EventEmitter2 { this._serviceCallback = null; } + /** + * @callback callServiceCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback callServiceFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. - * @param {function} callback - Function with the following params: - * @param {Object} callback.response - The response from the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @param {callServiceCallback} callback - Function with the following params: + * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ callService(request, callback, failedCallback) { if (this.isAdvertised) { @@ -67,16 +73,19 @@ class Service extends EventEmitter2 { }; this.ros.callOnConnection(call); } + /** + * @callback advertiseCallback + * @param {ServiceRequest} request - The service request. + * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the service has finished successfully, + * i.e., without any fatal errors. + */ /** * Advertise the service. This turns the Service object from a client * into a server. The callback will be called with every request * that's made on this service. * - * @param {function} callback - This works similarly to the callback for a C++ service and should take the following params: - * @param {ServiceRequest} callback.request - The service request. - * @param {Object} callback.response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the service has finished successfully, - * i.e., without any fatal errors. + * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params */ advertise(callback) { if (this.isAdvertised || typeof callback !== "function") { diff --git a/src/core/Topic.js b/src/core/Topic.js index c0e2a3cc7..af8058d2e 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -91,12 +91,15 @@ class Topic extends EventEmitter2 { that.emit("message", new Message(data)); }; } + /** + * @callback subscribeCallback + * @param {Object} message - The published message. + */ /** * Every time a message is published for the given topic, the callback * will be called with the message object. * - * @param {function} callback - Function with the following params: - * @param {Object} callback.message - The published message. + * @param {subscribeCallback} callback - Function with the following params: */ subscribe(callback) { if (typeof callback === "function") { @@ -124,7 +127,7 @@ class Topic extends EventEmitter2 { * and remove all subscribe callbacks. To remove a callback, you must * explicitly pass the callback function in. * - * @param {function} [callback] - The callback to unregister, if + * @param {import('eventemitter2').ListenerFn} [callback] - The callback to unregister, if * provided and other listeners are registered the topic won't * unsubscribe, just stop emitting to the passed listener. */ diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index 67144b52b..a7d078184 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -164,12 +164,15 @@ class TFClient extends EventEmitter2 { this._subscribeCB = this.processTFArray.bind(this); this.currentTopic.subscribe(this._subscribeCB); } + /** + * @callback subscribeCallback + * @param {Transform} callback.transform - The transform data. + */ /** * Subscribe to the given TF frame. * * @param {string} frameID - The TF frame to subscribe to. - * @param {function} callback - Function with the following params: - * @param {Transform} callback.transform - The transform data. + * @param {subscribeCallback} callback - Function with the following params: */ subscribe(frameID, callback) { // remove leading slash, if it's there diff --git a/src/util/decompressPng.js b/src/util/decompressPng.js index 5b66d56c1..32a536d55 100644 --- a/src/util/decompressPng.js +++ b/src/util/decompressPng.js @@ -7,6 +7,10 @@ var pngparse = require('pngparse'); +/** + * @callback decompressPngCallback + * @param data - The uncompressed data. + */ /** * If a message was compressed as a PNG image (a compression hack since * gzipping over WebSockets * is not supported yet), this function decodes @@ -14,8 +18,7 @@ var pngparse = require('pngparse'); * * @private * @param data - An object containing the PNG data. - * @param callback - Function with the following params: - * @param callback.data - The uncompressed data. + * @param {decompressPngCallback} callback - Function with the following params: */ function decompressPng(data, callback) { var buffer = new Buffer(data, 'base64'); @@ -30,4 +33,4 @@ function decompressPng(data, callback) { }); } -module.exports = decompressPng; \ No newline at end of file +module.exports = decompressPng; diff --git a/src/util/shim/decompressPng.js b/src/util/shim/decompressPng.js index a3ed5e00f..c4f3bad13 100644 --- a/src/util/shim/decompressPng.js +++ b/src/util/shim/decompressPng.js @@ -8,6 +8,10 @@ var Canvas = require('canvas'); var Image = Canvas.Image || window.Image; +/** + * @callback decompressPngCallback + * @param data - The uncompressed data. + */ /** * If a message was compressed as a PNG image (a compression hack since * gzipping over WebSockets * is not supported yet), this function places the @@ -15,8 +19,7 @@ var Image = Canvas.Image || window.Image; * * @private * @param data - An object containing the PNG data. - * @param callback - Function with the following params: - * @param callback.data - The uncompressed data. + * @param {decompressPngCallback} callback - Function with the following params: */ function decompressPng(data, callback) { // Uncompresses the data before sending it through (use image/canvas to do so). From db78330825f0ae1163f527095cd19dd0c5994e88 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:29:58 -0700 Subject: [PATCH 06/66] fix constructor docs --- src/actionlib/ActionClient.js | 21 +++++++++++---------- src/actionlib/ActionListener.js | 14 ++++++++------ src/actionlib/Goal.js | 10 +++++----- src/actionlib/SimpleActionServer.js | 12 ++++++------ src/core/Param.js | 10 +++++----- src/core/Ros.js | 14 +++++++------- src/core/Service.js | 12 ++++++------ src/core/Topic.js | 24 ++++++++++++------------ src/math/Pose.js | 10 +++++----- src/math/Quaternion.js | 14 +++++++------- src/math/Transform.js | 10 +++++----- src/math/Vector3.js | 12 ++++++------ src/tf/TFClient.js | 26 +++++++++++++------------- src/urdf/UrdfBox.js | 8 ++++---- src/urdf/UrdfColor.js | 8 ++++---- src/urdf/UrdfCylinder.js | 8 ++++---- src/urdf/UrdfJoint.js | 8 ++++---- src/urdf/UrdfLink.js | 8 ++++---- src/urdf/UrdfMaterial.js | 8 ++++---- src/urdf/UrdfMesh.js | 8 ++++---- src/urdf/UrdfModel.js | 10 +++++----- src/urdf/UrdfSphere.js | 8 ++++---- src/urdf/UrdfVisual.js | 8 ++++---- 23 files changed, 137 insertions(+), 134 deletions(-) diff --git a/src/actionlib/ActionClient.js b/src/actionlib/ActionClient.js index 6831cb02e..26262766c 100644 --- a/src/actionlib/ActionClient.js +++ b/src/actionlib/ActionClient.js @@ -17,19 +17,20 @@ var Ros = require("../core/Ros"); * * 'feedback' - The feedback messages received from the action server. * * 'result' - The result returned from the action server. * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. - * @param {number} [options.timeout] - The timeout length when connecting to the action server. - * @param {boolean} [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not. - * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. - * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. */ class ActionClient extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + * @param {number} [options.timeout] - The timeout length when connecting to the action server. + * @param {boolean} [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not. + * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. + * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. + */ constructor(options) { - super(options); + super(); var that = this; options = options || {}; this.ros = options.ros; diff --git a/src/actionlib/ActionListener.js b/src/actionlib/ActionListener.js index 4e1e7e071..c67deece8 100644 --- a/src/actionlib/ActionListener.js +++ b/src/actionlib/ActionListener.js @@ -17,15 +17,17 @@ var Ros = require("../core/Ros"); * * 'feedback' - The feedback messages received from the action server. * * 'result' - The result returned from the action server. * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ class ActionListener extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ constructor(options) { - super(options); + super(); var that = this; options = options || {}; this.ros = options.ros; diff --git a/src/actionlib/Goal.js b/src/actionlib/Goal.js index 7358e557c..255c0b5b9 100644 --- a/src/actionlib/Goal.js +++ b/src/actionlib/Goal.js @@ -12,13 +12,13 @@ var ActionClient = require("./ActionClient"); * * Emits the following events: * * 'timeout' - If a timeout occurred while sending a goal. - * - * @constructor - * @param {Object} options - * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. - * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. */ class Goal extends EventEmitter2 { + /** + * @param {Object} options + * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. + * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. + */ constructor(options) { super(options); var that = this; diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index 7146a1044..3f90257ea 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -14,14 +14,14 @@ var Ros = require("../core/Ros"); * Emits the following events: * * 'goal' - Goal sent by action client. * * 'cancel' - Action client has canceled the request. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. */ class SimpleActionServer extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ constructor(options) { super(options); var that = this; diff --git a/src/core/Param.js b/src/core/Param.js index 20b7e6c30..7d42245b0 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -9,13 +9,13 @@ var Ros = require("../core/Ros"); /** * A ROS parameter. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The param name, like max_vel_x. */ class Param { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The param name, like max_vel_x. + */ constructor(options) { options = options || {}; this.ros = options.ros; diff --git a/src/core/Ros.js b/src/core/Ros.js index 79575384e..96b28e346 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -22,15 +22,15 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * * 'close' - Disconnected to the WebSocket server. * * <topicName> - A message came from rosbridge with the given topic name. * * <serviceID> - A service response came from rosbridge with the given ID. - * - * @constructor - * @param {Object} options - * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. - * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. - * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. - * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. */ class Ros extends EventEmitter2 { + /** + * @param {Object} options + * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. + * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. + * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. + * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. + */ constructor(options) { super(options); options = options || {}; diff --git a/src/core/Service.js b/src/core/Service.js index 2a5f801f6..e7ed7f5ad 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -10,14 +10,14 @@ var Ros = require("../core/Ros"); /** * A ROS service client. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The service name, like '/add_two_ints'. - * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. */ class Service extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The service name, like '/add_two_ints'. + * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. + */ constructor(options) { super(options); options = options || {}; diff --git a/src/core/Topic.js b/src/core/Topic.js index af8058d2e..5d4d8924e 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -13,20 +13,20 @@ var Ros = require("../core/Ros"); * Emits the following events: * * 'warning' - If there are any warning during the Topic creation. * * 'message' - The message data from rosbridge. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The topic name, like '/cmd_vel'. - * @param {string} options.messageType - The message type, like 'std_msgs/String'. - * @param {string} [options.compression=none] - The type of compression to use, like 'png', 'cbor', or 'cbor-raw'. - * @param {number} [options.throttle_rate=0] - The rate (in ms in between messages) at which to throttle the topics. - * @param {number} [options.queue_size=100] - The queue created at bridge side for re-publishing webtopics. - * @param {boolean} [options.latch=false] - Latch the topic when publishing. - * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. - * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. */ class Topic extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The topic name, like '/cmd_vel'. + * @param {string} options.messageType - The message type, like 'std_msgs/String'. + * @param {string} [options.compression=none] - The type of compression to use, like 'png', 'cbor', or 'cbor-raw'. + * @param {number} [options.throttle_rate=0] - The rate (in ms in between messages) at which to throttle the topics. + * @param {number} [options.queue_size=100] - The queue created at bridge side for re-publishing webtopics. + * @param {boolean} [options.latch=false] - Latch the topic when publishing. + * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. + * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. + */ constructor(options) { super(options); options = options || {}; diff --git a/src/math/Pose.js b/src/math/Pose.js index 8c750801a..6225e7f46 100644 --- a/src/math/Pose.js +++ b/src/math/Pose.js @@ -9,13 +9,13 @@ var Transform = require("./Transform"); /** * A Pose in 3D space. Values are copied into this object. - * - * @constructor - * @param {Object} options - * @param {Vector3} options.position - The ROSLIB.Vector3 describing the position. - * @param {Quaternion} options.orientation - The ROSLIB.Quaternion describing the orientation. */ class Pose { + /** + * @param {Object} options + * @param {Vector3} options.position - The ROSLIB.Vector3 describing the position. + * @param {Quaternion} options.orientation - The ROSLIB.Quaternion describing the orientation. + */ constructor(options) { options = options || {}; // copy the values into this object if they exist diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 1c933a724..8849a0bf1 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -5,15 +5,15 @@ /** * A Quaternion. - * - * @constructor - * @param {Object} options - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. - * @param {number} [options.w=1] - The w value. */ class Quaternion { + /** + * @param {Object} options + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + * @param {number} [options.w=1] - The w value. + */ constructor(options) { options = options || {}; this.x = options.x || 0; diff --git a/src/math/Transform.js b/src/math/Transform.js index 6df649f65..52aa4dc42 100644 --- a/src/math/Transform.js +++ b/src/math/Transform.js @@ -8,13 +8,13 @@ var Quaternion = require('./Quaternion'); /** * A Transform in 3-space. Values are copied into this object. - * - * @constructor - * @param {Object} options - * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. - * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. */ class Transform { + /** + * @param {Object} options + * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. + * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. + */ constructor(options) { options = options || {}; // Copy the values into this object if they exist diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 0c3d27dd2..3e4ac1ecc 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -7,14 +7,14 @@ var Quaternion = require("./Quaternion"); /** * A 3D vector. - * - * @constructor - * @param {Object} options - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. */ class Vector3 { + /** + * @param {Object} options + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + */ constructor(options) { options = options || {}; this.x = options.x || 0; diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index a7d078184..feeb23769 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -17,21 +17,21 @@ var Ros = require("../core/Ros"); /** * A TF Client that listens to TFs from tf2_web_republisher. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} [options.fixedFrame=base_link] - The fixed frame. - * @param {number} [options.angularThres=2.0] - The angular threshold for the TF republisher. - * @param {number} [options.transThres=0.01] - The translation threshold for the TF republisher. - * @param {number} [options.rate=10.0] - The rate for the TF republisher. - * @param {number} [options.updateDelay=50] - The time (in ms) to wait after a new subscription - * to update the TF republisher's list of TFs. - * @param {number} [options.topicTimeout=2.0] - The timeout parameter for the TF republisher. - * @param {string} [options.serverName=/tf2_web_republisher] - The name of the tf2_web_republisher server. - * @param {string} [options.repubServiceName=/republish_tfs] - The name of the republish_tfs service (non groovy compatibility mode only). */ class TFClient extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} [options.fixedFrame=base_link] - The fixed frame. + * @param {number} [options.angularThres=2.0] - The angular threshold for the TF republisher. + * @param {number} [options.transThres=0.01] - The translation threshold for the TF republisher. + * @param {number} [options.rate=10.0] - The rate for the TF republisher. + * @param {number} [options.updateDelay=50] - The time (in ms) to wait after a new subscription + * to update the TF republisher's list of TFs. + * @param {number} [options.topicTimeout=2.0] - The timeout parameter for the TF republisher. + * @param {string} [options.serverName="/tf2_web_republisher"] - The name of the tf2_web_republisher server. + * @param {string} [options.repubServiceName="/republish_tfs"] - The name of the republish_tfs service (non groovy compatibility mode only). + */ constructor(options) { super(options); options = options || {}; diff --git a/src/urdf/UrdfBox.js b/src/urdf/UrdfBox.js index b2a745af1..0c8b27b78 100644 --- a/src/urdf/UrdfBox.js +++ b/src/urdf/UrdfBox.js @@ -9,12 +9,12 @@ var UrdfTypes = require('./UrdfTypes'); /** * A Box element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfBox { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.dimension = null; this.type = UrdfTypes.URDF_BOX; diff --git a/src/urdf/UrdfColor.js b/src/urdf/UrdfColor.js index 0a02b17ea..0aea98d10 100644 --- a/src/urdf/UrdfColor.js +++ b/src/urdf/UrdfColor.js @@ -6,12 +6,12 @@ /** * A Color element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfColor { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { // Parse the xml string var rgba = options.xml.getAttribute("rgba").split(" "); diff --git a/src/urdf/UrdfCylinder.js b/src/urdf/UrdfCylinder.js index 0fd0ab6fd..6363872f4 100644 --- a/src/urdf/UrdfCylinder.js +++ b/src/urdf/UrdfCylinder.js @@ -8,12 +8,12 @@ var UrdfTypes = require('./UrdfTypes'); /** * A Cylinder element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfCylinder { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.type = UrdfTypes.URDF_CYLINDER; this.length = parseFloat(options.xml.getAttribute("length")); diff --git a/src/urdf/UrdfJoint.js b/src/urdf/UrdfJoint.js index 8e47659c1..f5d482e56 100644 --- a/src/urdf/UrdfJoint.js +++ b/src/urdf/UrdfJoint.js @@ -9,12 +9,12 @@ var Quaternion = require('../math/Quaternion'); /** * A Joint element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfJoint { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.name = options.xml.getAttribute("name"); this.type = options.xml.getAttribute("type"); diff --git a/src/urdf/UrdfLink.js b/src/urdf/UrdfLink.js index 3fffd3ebe..459c66350 100644 --- a/src/urdf/UrdfLink.js +++ b/src/urdf/UrdfLink.js @@ -8,12 +8,12 @@ var UrdfVisual = require('./UrdfVisual'); /** * A Link element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfLink { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.name = options.xml.getAttribute("name"); this.visuals = []; diff --git a/src/urdf/UrdfMaterial.js b/src/urdf/UrdfMaterial.js index a112c75ba..175b2af89 100644 --- a/src/urdf/UrdfMaterial.js +++ b/src/urdf/UrdfMaterial.js @@ -8,12 +8,12 @@ var UrdfColor = require('./UrdfColor'); /** * A Material element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfMaterial { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.textureFilename = null; this.color = null; diff --git a/src/urdf/UrdfMesh.js b/src/urdf/UrdfMesh.js index dab878e0c..c8d3da47b 100644 --- a/src/urdf/UrdfMesh.js +++ b/src/urdf/UrdfMesh.js @@ -9,12 +9,12 @@ var UrdfTypes = require('./UrdfTypes'); /** * A Mesh element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfMesh { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.scale = null; diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index ac57a25e9..f19e45e51 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -14,13 +14,13 @@ var XPATH_FIRST_ORDERED_NODE_TYPE = 9; /** * A URDF Model can be used to parse a given URDF into the appropriate elements. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. - * @param {string} options.string - The XML element to parse as a string. */ class UrdfModel { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + * @param {string} options.string - The XML element to parse as a string. + */ constructor(options) { options = options || {}; var xmlDoc = options.xml; diff --git a/src/urdf/UrdfSphere.js b/src/urdf/UrdfSphere.js index d7fbfd45c..b00dcd5e2 100644 --- a/src/urdf/UrdfSphere.js +++ b/src/urdf/UrdfSphere.js @@ -8,12 +8,12 @@ var UrdfTypes = require('./UrdfTypes'); /** * A Sphere element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfSphere { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { this.type = UrdfTypes.URDF_SPHERE; this.radius = parseFloat(options.xml.getAttribute("radius")); diff --git a/src/urdf/UrdfVisual.js b/src/urdf/UrdfVisual.js index 6fe741a53..7b460324f 100644 --- a/src/urdf/UrdfVisual.js +++ b/src/urdf/UrdfVisual.js @@ -16,12 +16,12 @@ var UrdfSphere = require('./UrdfSphere'); /** * A Visual element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ class UrdfVisual { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ constructor(options) { var xml = options.xml; this.origin = null; From c17d2e66dabe67c0685a741c0e891f0374d9d95d Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:31:10 -0700 Subject: [PATCH 07/66] remove non-type-overlapping superconstructors --- src/actionlib/Goal.js | 2 +- src/actionlib/SimpleActionServer.js | 2 +- src/core/Ros.js | 2 +- src/core/Service.js | 2 +- src/core/Topic.js | 2 +- src/tf/TFClient.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/actionlib/Goal.js b/src/actionlib/Goal.js index 255c0b5b9..566ddad36 100644 --- a/src/actionlib/Goal.js +++ b/src/actionlib/Goal.js @@ -20,7 +20,7 @@ class Goal extends EventEmitter2 { * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. */ constructor(options) { - super(options); + super(); var that = this; this.actionClient = options.actionClient; this.goalMessage = options.goalMessage; diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index 3f90257ea..a49822668 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -23,7 +23,7 @@ class SimpleActionServer extends EventEmitter2 { * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. */ constructor(options) { - super(options); + super(); var that = this; options = options || {}; this.ros = options.ros; diff --git a/src/core/Ros.js b/src/core/Ros.js index 96b28e346..e70d73dae 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -32,7 +32,7 @@ class Ros extends EventEmitter2 { * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. */ constructor(options) { - super(options); + super(); options = options || {}; var that = this; this.socket = null; diff --git a/src/core/Service.js b/src/core/Service.js index e7ed7f5ad..603ea4308 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -19,7 +19,7 @@ class Service extends EventEmitter2 { * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. */ constructor(options) { - super(options); + super(); options = options || {}; this.ros = options.ros; this.name = options.name; diff --git a/src/core/Topic.js b/src/core/Topic.js index 5d4d8924e..40c00afeb 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -28,7 +28,7 @@ class Topic extends EventEmitter2 { * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. */ constructor(options) { - super(options); + super(); options = options || {}; this.ros = options.ros; this.name = options.name; diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index feeb23769..620eb0e82 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -33,7 +33,7 @@ class TFClient extends EventEmitter2 { * @param {string} [options.repubServiceName="/republish_tfs"] - The name of the republish_tfs service (non groovy compatibility mode only). */ constructor(options) { - super(options); + super(); options = options || {}; this.ros = options.ros; this.fixedFrame = options.fixedFrame || "base_link"; From 7e084c799c7bdfce9df15b6832d3c6ed262d7186 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:51:21 -0700 Subject: [PATCH 08/66] Comment on weird type --- src/core/Ros.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/Ros.js b/src/core/Ros.js index e70d73dae..ace06a5c7 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -75,6 +75,7 @@ class Ros extends EventEmitter2 { this.socket.on("error", this.socket.onerror); } else if (this.transportLibrary.constructor.name === "RTCPeerConnection") { this.socket = assign( + // @ts-expect-error -- this is kinda wild. `this.transportLibrary` can either be a string or an RTCDataChannel. This needs fixing. this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this) ); From 1090db7144fb359f5f94965d1dcefc71f434eddf Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 16 Nov 2023 15:51:32 -0700 Subject: [PATCH 09/66] couple more callback docs --- src/core/Param.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/Param.js b/src/core/Param.js index 7d42245b0..d209c169e 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -46,11 +46,19 @@ class Param { callback(value); }); } + /** + * @callback setParamCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback setParamFailedCallback + * @param {Object} response - The response from the service request. + */ /** * Set the value of the param in ROS. * * @param {Object} value - The value to set param to. - * @param {function} callback - The callback function. + * @param {setParamCallback} callback - The callback function. */ set(value, callback) { var paramClient = new Service({ @@ -69,7 +77,7 @@ class Param { /** * Delete this parameter on the ROS server. * - * @param {function} callback - The callback function. + * @param {setParamCallback} callback - The callback function. */ delete(callback) { var paramClient = new Service({ From 92e5c967b2c527df7c31e3c67e597a69c2bd9e79 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:10:10 -0700 Subject: [PATCH 10/66] Vector3 options actually are optional --- src/math/Vector3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 3e4ac1ecc..3a755c854 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -10,7 +10,7 @@ var Quaternion = require("./Quaternion"); */ class Vector3 { /** - * @param {Object} options + * @param {Object} [options] * @param {number} [options.x=0] - The x value. * @param {number} [options.y=0] - The y value. * @param {number} [options.z=0] - The z value. From b1ef2bbdeeef7b739a8afe0b5d718f884beb9c91 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:11:39 -0700 Subject: [PATCH 11/66] Quaternion options are also actually optional --- src/math/Quaternion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 8849a0bf1..0b027944c 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -8,7 +8,7 @@ */ class Quaternion { /** - * @param {Object} options + * @param {Object} [options] * @param {number} [options.x=0] - The x value. * @param {number} [options.y=0] - The y value. * @param {number} [options.z=0] - The z value. From a7d0f053b42549fa92c85d8f3ed3cebf1618a020 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:12:07 -0700 Subject: [PATCH 12/66] Pose options are actually optional as well --- src/math/Pose.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/math/Pose.js b/src/math/Pose.js index 6225e7f46..b90eeed1c 100644 --- a/src/math/Pose.js +++ b/src/math/Pose.js @@ -12,13 +12,14 @@ var Transform = require("./Transform"); */ class Pose { /** - * @param {Object} options - * @param {Vector3} options.position - The ROSLIB.Vector3 describing the position. - * @param {Quaternion} options.orientation - The ROSLIB.Quaternion describing the orientation. + * @param {Object} [options] + * @param {Vector3} [options.position] - The ROSLIB.Vector3 describing the position. + * @param {Quaternion} [options.orientation] - The ROSLIB.Quaternion describing the orientation. */ constructor(options) { options = options || {}; // copy the values into this object if they exist + options = options || {}; this.position = new Vector3(options.position); this.orientation = new Quaternion(options.orientation); } From b4970e496413e80d39661148484f0cbf6d262aa3 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:13:02 -0700 Subject: [PATCH 13/66] Fix name clobbering in UrdfJoint --- src/urdf/UrdfJoint.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/urdf/UrdfJoint.js b/src/urdf/UrdfJoint.js index f5d482e56..0dffea007 100644 --- a/src/urdf/UrdfJoint.js +++ b/src/urdf/UrdfJoint.js @@ -31,8 +31,8 @@ class UrdfJoint { var limits = options.xml.getElementsByTagName("limit"); if (limits.length > 0) { - this.minval = parseFloat(limits[0].getAttribute("lower")); - this.maxval = parseFloat(limits[0].getAttribute("upper")); + this.minval = parseFloat(limits[0].getAttribute("lower") || "NaN"); + this.maxval = parseFloat(limits[0].getAttribute("upper") || "NaN"); } // Origin @@ -42,10 +42,10 @@ class UrdfJoint { this.origin = new Pose(); } else { // Check the XYZ - var xyz = origins[0].getAttribute("xyz"); + var xyzValue = origins[0].getAttribute("xyz"); var position = new Vector3(); - if (xyz) { - xyz = xyz.split(" "); + if (xyzValue) { + var xyz = xyzValue.split(" "); position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), @@ -54,10 +54,10 @@ class UrdfJoint { } // Check the RPY - var rpy = origins[0].getAttribute("rpy"); + var rpyValue = origins[0].getAttribute("rpy"); var orientation = new Quaternion(); - if (rpy) { - rpy = rpy.split(" "); + if (rpyValue) { + var rpy = rpyValue.split(" "); // Convert from RPY var roll = parseFloat(rpy[0]); var pitch = parseFloat(rpy[1]); From b5d2314869e20d6729f94a498aa9dbd9609280e9 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:14:53 -0700 Subject: [PATCH 14/66] Fix null case in UrdfSphere --- src/urdf/UrdfSphere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/urdf/UrdfSphere.js b/src/urdf/UrdfSphere.js index b00dcd5e2..6c60135d5 100644 --- a/src/urdf/UrdfSphere.js +++ b/src/urdf/UrdfSphere.js @@ -16,7 +16,7 @@ class UrdfSphere { */ constructor(options) { this.type = UrdfTypes.URDF_SPHERE; - this.radius = parseFloat(options.xml.getAttribute("radius")); + this.radius = parseFloat(options.xml.getAttribute("radius") || "NaN"); } } From 2bafd13d03634c1c40f82569e115822cca2368ca Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:17:06 -0700 Subject: [PATCH 15/66] fix variable clobbering in `UrdfVisual` --- src/urdf/UrdfVisual.js | 58 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/urdf/UrdfVisual.js b/src/urdf/UrdfVisual.js index 7b460324f..39d86c9e5 100644 --- a/src/urdf/UrdfVisual.js +++ b/src/urdf/UrdfVisual.js @@ -37,10 +37,10 @@ class UrdfVisual { this.origin = new Pose(); } else { // Check the XYZ - var xyz = origins[0].getAttribute("xyz"); + var xyzValue = origins[0].getAttribute("xyz"); var position = new Vector3(); - if (xyz) { - xyz = xyz.split(" "); + if (xyzValue) { + var xyz = xyzValue.split(" "); position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), @@ -49,10 +49,10 @@ class UrdfVisual { } // Check the RPY - var rpy = origins[0].getAttribute("rpy"); + var rpyValue = origins[0].getAttribute("rpy"); var orientation = new Quaternion(); - if (rpy) { - rpy = rpy.split(" "); + if (rpyValue) { + var rpy = rpyValue.split(" "); // Convert from RPY var roll = parseFloat(rpy[0]); var pitch = parseFloat(rpy[1]); @@ -93,33 +93,35 @@ class UrdfVisual { var geom = geoms[0]; var shape = null; // Check for the shape - for (var i = 0; i < geom.childNodes.length; i++) { - var node = geom.childNodes[i]; + for (var i = 0; i < geom.children.length; i++) { + var node = geom.children[i]; if (node.nodeType === 1) { shape = node; break; } } - // Check the type - var type = shape.nodeName; - if (type === "sphere") { - this.geometry = new UrdfSphere({ - xml: shape, - }); - } else if (type === "box") { - this.geometry = new UrdfBox({ - xml: shape, - }); - } else if (type === "cylinder") { - this.geometry = new UrdfCylinder({ - xml: shape, - }); - } else if (type === "mesh") { - this.geometry = new UrdfMesh({ - xml: shape, - }); - } else { - console.warn("Unknown geometry type " + type); + if (shape) { + // Check the type + var type = shape.nodeName; + if (type === "sphere") { + this.geometry = new UrdfSphere({ + xml: shape, + }); + } else if (type === "box") { + this.geometry = new UrdfBox({ + xml: shape, + }); + } else if (type === "cylinder") { + this.geometry = new UrdfCylinder({ + xml: shape, + }); + } else if (type === "mesh") { + this.geometry = new UrdfMesh({ + xml: shape, + }); + } else { + console.warn("Unknown geometry type " + type); + } } } From 193a7b1a22b87a2c380aa4b15510aef1943805d4 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:17:54 -0700 Subject: [PATCH 16/66] fix type of decodeNativeArray --- src/util/cborTypedArrayTags.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/cborTypedArrayTags.js b/src/util/cborTypedArrayTags.js index 2a8476e02..3df9096ba 100644 --- a/src/util/cborTypedArrayTags.js +++ b/src/util/cborTypedArrayTags.js @@ -64,7 +64,7 @@ function decodeInt64LE(bytes) { /** * Unpack typed array from byte array. * @param {Uint8Array} bytes - * @param {type} ArrayType - Desired output array type + * @param {ArrayConstructor} ArrayType - Desired output array type */ function decodeNativeArray(bytes, ArrayType) { var byteLen = bytes.byteLength; From a4f01d82671c05f13c5783a5fdf25909b80740c6 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:19:37 -0700 Subject: [PATCH 17/66] Ignore some issues that aren't trivially fixable --- src/util/shim/decompressPng.js | 1 + src/util/workerSocket.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/shim/decompressPng.js b/src/util/shim/decompressPng.js index c4f3bad13..ac5ce623a 100644 --- a/src/util/shim/decompressPng.js +++ b/src/util/shim/decompressPng.js @@ -5,6 +5,7 @@ 'use strict'; +// @ts-expect-error -- this is for optionally polyfilling canvas var Canvas = require('canvas'); var Image = Canvas.Image || window.Image; diff --git a/src/util/workerSocket.js b/src/util/workerSocket.js index c22223bc0..60bab5cfa 100644 --- a/src/util/workerSocket.js +++ b/src/util/workerSocket.js @@ -1,8 +1,10 @@ try { - var work = require('webworkify'); + // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now + var work = require("webworkify"); } catch(ReferenceError) { - // webworkify raises ReferenceError when required inside webpack - var work = require('webworkify-webpack'); + // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now + // webworkify raises ReferenceError when required inside webpack + var work = require("webworkify-webpack"); } var workerSocketImpl = require('./workerSocketImpl'); From 570581536cf2de5c46c963a9d98d45d8003e0a95 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:23:34 -0700 Subject: [PATCH 18/66] fix XML order of operations issue in urdfmodel --- src/urdf/UrdfModel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index f19e45e51..cec7f5d61 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -33,18 +33,18 @@ class UrdfModel { if (string) { // Parse the string var parser = new DOMParser(); - xmlDoc = parser.parseFromString(string, "text/xml"); + xmlDoc = parser.parseFromString(string, "text/xml").documentElement; } // Initialize the model with the given XML node. // Get the robot tag - var robotXml = xmlDoc.documentElement; + var robotXml = xmlDoc; // Get the robot name this.name = robotXml.getAttribute("name"); // Parse all the visual elements we need - for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { + for (var nodes = robotXml.children, i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node.tagName === "material") { var material = new UrdfMaterial({ From e1aea21b220488d140163e3ee640db014e50761c Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:27:38 -0700 Subject: [PATCH 19/66] Mark last non-trivial errors with ts-expect-error --- src/actionlib/SimpleActionServer.js | 6 ++++++ src/core/Ros.js | 1 + src/core/SocketAdapter.js | 5 ++++- src/node/SocketIO.js | 2 ++ src/node/TopicStream.js | 18 +++++++++--------- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index a49822668..5f2c868dd 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -84,6 +84,7 @@ class SimpleActionServer extends EventEmitter2 { // needs to happen AFTER rest is set up that.emit("cancel"); } else { + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. that.statusMessage.status_list = [ { goal_id: goalMessage.goal_id, status: 1 }, ]; @@ -157,7 +158,9 @@ class SimpleActionServer extends EventEmitter2 { var nsecs = Math.round( 1000000000 * (currentTime.getTime() / 1000 - secs) ); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. that.statusMessage.header.stamp.secs = secs; + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. that.statusMessage.header.stamp.nsecs = nsecs; statusPublisher.publish(that.statusMessage); }, 500); // publish every 500ms @@ -174,6 +177,7 @@ class SimpleActionServer extends EventEmitter2 { }); this.resultPublisher.publish(resultMessage); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. this.statusMessage.status_list = []; if (this.nextGoal) { this.currentGoal = this.nextGoal; @@ -195,6 +199,7 @@ class SimpleActionServer extends EventEmitter2 { }); this.resultPublisher.publish(resultMessage); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. this.statusMessage.status_list = []; if (this.nextGoal) { this.currentGoal = this.nextGoal; @@ -220,6 +225,7 @@ class SimpleActionServer extends EventEmitter2 { * Handle case where client requests preemption. */ setPreempted() { + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. this.statusMessage.status_list = []; var resultMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 2 }, diff --git a/src/core/Ros.js b/src/core/Ros.js index ace06a5c7..3f5e7493a 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -66,6 +66,7 @@ class Ros extends EventEmitter2 { connect(url) { if (this.transportLibrary === "socket.io") { this.socket = assign( + // @ts-expect-error -- this doesn't seem to work io(url, { "force new connection": true }), socketAdapter(this) ); diff --git a/src/core/SocketAdapter.js b/src/core/SocketAdapter.js index 7c7b8af0b..3dc754f5a 100644 --- a/src/core/SocketAdapter.js +++ b/src/core/SocketAdapter.js @@ -12,8 +12,10 @@ var decompressPng = require('../util/decompressPng'); var CBOR = require('cbor-js'); var typedArrayTagger = require('../util/cborTypedArrayTags'); var BSON = null; +// @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit if(typeof bson !== 'undefined'){ - BSON = bson().BSON; + // @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit + BSON = bson().BSON; } /** @@ -60,6 +62,7 @@ function SocketAdapter(client) { } var reader = new FileReader(); reader.onload = function() { + // @ts-expect-error -- this doesn't seem right, but don't want to break current type coercion assumption var uint8Array = new Uint8Array(this.result); var msg = BSON.deserialize(uint8Array); callback(msg); diff --git a/src/node/SocketIO.js b/src/node/SocketIO.js index 23aeedd14..7ff78585b 100644 --- a/src/node/SocketIO.js +++ b/src/node/SocketIO.js @@ -5,6 +5,7 @@ class SocketIO { this.socketio = null; this.socket = Ros.socket; if (options.http) { + // @ts-expect-error -- this doesn't seem to work. this.socketio = io(options.http); } else if (options.socketio) { this.socketio = options.socketio; @@ -28,6 +29,7 @@ class SocketIO { } sendToFront(name, event) { return function (event) { + // @ts-expect-error -- this doesn't seem to work. this.socketio.emit(name, event); }; } diff --git a/src/node/TopicStream.js b/src/node/TopicStream.js index 0c1808acf..a9a0dc47c 100644 --- a/src/node/TopicStream.js +++ b/src/node/TopicStream.js @@ -5,17 +5,17 @@ var DuplexStream = require('stream').Duplex; * Publish a connected ROS topic to a duplex * stream. This stream can be piped to, which will * publish to the topic. - * - * @param {Object} options - * @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. - * @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. - * @param {boolean} [options.transform] - A function to change the data to be published or filter it if false is returned. - */ +* +* @param {Object} options +* @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. +* @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. +* @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. +*/ +// @ts-expect-error -- prototype call here is unhappy - maybe we need to get rid of this or roll it into Topic. Topic.prototype.toStream = function(options) { options = options || {subscribe: true, publish: true}; var topic = this; - var hasTransform = typeof options.transform === 'function'; var stream = new DuplexStream({ objectMode: true @@ -24,8 +24,8 @@ Topic.prototype.toStream = function(options) { // Publish to the topic if someone pipes to stream stream._write = function(chunk, encoding, callback) { - if (hasTransform) { - chunk = options.transform(chunk); + if (typeof options.transform === "function") { + chunk = options.transform(chunk); } if (chunk === false) { topic.publish(chunk); From 30f4b39ffc014c90e20c2bae8503748196f7106b Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 08:54:22 -0700 Subject: [PATCH 20/66] Oops, my autoformat broke single-quote standard --- src/RosLib.js | 2 +- src/RosLibBrowser.js | 2 +- src/RosLibNode.js | 4 +- src/actionlib/ActionClient.js | 35 ++++--- src/actionlib/ActionListener.js | 30 +++--- src/actionlib/Goal.js | 21 ++-- src/actionlib/SimpleActionServer.js | 55 +++++------ src/actionlib/index.js | 12 +-- src/core/Param.js | 23 ++--- src/core/Ros.js | 147 ++++++++++++++-------------- src/core/Service.js | 26 ++--- src/core/ServiceResponse.js | 2 +- src/core/SocketAdapter.js | 10 +- src/core/Topic.js | 70 ++++++------- src/core/index.js | 18 ++-- src/math/Pose.js | 8 +- src/math/Quaternion.js | 8 +- src/math/Transform.js | 3 +- src/math/Vector3.js | 6 +- src/math/index.js | 8 +- src/mixin.js | 16 +-- src/node/RosTCP.js | 23 +++-- src/node/SocketIO.js | 16 ++- src/node/TopicStream.js | 68 ++++++------- src/tf/TFClient.js | 42 ++++---- src/tf/index.js | 8 +- src/urdf/UrdfBox.js | 4 +- src/urdf/UrdfColor.js | 2 +- src/urdf/UrdfCylinder.js | 4 +- src/urdf/UrdfJoint.js | 34 +++---- src/urdf/UrdfLink.js | 6 +- src/urdf/UrdfMaterial.js | 12 +-- src/urdf/UrdfMesh.js | 8 +- src/urdf/UrdfModel.js | 20 ++-- src/urdf/UrdfSphere.js | 2 +- src/urdf/UrdfTypes.js | 8 +- src/urdf/UrdfVisual.js | 42 ++++---- src/urdf/index.js | 7 +- src/util/cborTypedArrayTags.js | 14 +-- src/util/decompressPng.js | 4 +- src/util/shim/canvas.js | 4 +- src/util/shim/decompressPng.js | 8 +- src/util/workerSocket.js | 25 +++-- src/util/workerSocketImpl.js | 6 +- 44 files changed, 423 insertions(+), 450 deletions(-) diff --git a/src/RosLib.js b/src/RosLib.js index 81397fb84..26edb8e7e 100644 --- a/src/RosLib.js +++ b/src/RosLib.js @@ -13,7 +13,7 @@ var ROSLIB = this.ROSLIB || { * @default * @description Library version */ - REVISION : '1.3.0' + REVISION: '1.3.0' }; var assign = require('object-assign'); diff --git a/src/RosLibBrowser.js b/src/RosLibBrowser.js index 96799a3c3..f134db6da 100644 --- a/src/RosLibBrowser.js +++ b/src/RosLibBrowser.js @@ -1 +1 @@ -global.ROSLIB = require('./RosLib'); \ No newline at end of file +global.ROSLIB = require('./RosLib'); diff --git a/src/RosLibNode.js b/src/RosLibNode.js index 7000df650..8a622a4d2 100644 --- a/src/RosLibNode.js +++ b/src/RosLibNode.js @@ -1,9 +1,9 @@ /** - * @fileOverview ROSLIB Node exclusive extensions + * @fileOverview ROSLIB Node exclusive extensions */ var assign = require('object-assign'); module.exports = assign(require('./RosLib'), { Ros: require('./node/RosTCP.js'), Topic: require('./node/TopicStream') -}); \ No newline at end of file +}); diff --git a/src/actionlib/ActionClient.js b/src/actionlib/ActionClient.js index 26262766c..51cfe432c 100644 --- a/src/actionlib/ActionClient.js +++ b/src/actionlib/ActionClient.js @@ -6,7 +6,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * An actionlib action client. @@ -48,32 +48,32 @@ class ActionClient extends EventEmitter2 { // create the topics associated with actionlib this.feedbackListener = new Topic({ ros: this.ros, - name: this.serverName + "/feedback", - messageType: this.actionName + "Feedback", + name: this.serverName + '/feedback', + messageType: this.actionName + 'Feedback' }); this.statusListener = new Topic({ ros: this.ros, - name: this.serverName + "/status", - messageType: "actionlib_msgs/GoalStatusArray", + name: this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray' }); this.resultListener = new Topic({ ros: this.ros, - name: this.serverName + "/result", - messageType: this.actionName + "Result", + name: this.serverName + '/result', + messageType: this.actionName + 'Result' }); this.goalTopic = new Topic({ ros: this.ros, - name: this.serverName + "/goal", - messageType: this.actionName + "Goal", + name: this.serverName + '/goal', + messageType: this.actionName + 'Goal' }); this.cancelTopic = new Topic({ ros: this.ros, - name: this.serverName + "/cancel", - messageType: "actionlib_msgs/GoalID", + name: this.serverName + '/cancel', + messageType: 'actionlib_msgs/GoalID' }); // advertise the goal and cancel topics @@ -87,7 +87,7 @@ class ActionClient extends EventEmitter2 { statusMessage.status_list.forEach(function (status) { var goal = that.goals[status.goal_id.id]; if (goal) { - goal.emit("status", status); + goal.emit('status', status); } }); }); @@ -98,8 +98,8 @@ class ActionClient extends EventEmitter2 { this.feedbackListener.subscribe(function (feedbackMessage) { var goal = that.goals[feedbackMessage.status.goal_id.id]; if (goal) { - goal.emit("status", feedbackMessage.status); - goal.emit("feedback", feedbackMessage.feedback); + goal.emit('status', feedbackMessage.status); + goal.emit('feedback', feedbackMessage.feedback); } }); } @@ -110,8 +110,8 @@ class ActionClient extends EventEmitter2 { var goal = that.goals[resultMessage.status.goal_id.id]; if (goal) { - goal.emit("status", resultMessage.status); - goal.emit("result", resultMessage.result); + goal.emit('status', resultMessage.status); + goal.emit('result', resultMessage.result); } }); } @@ -120,7 +120,7 @@ class ActionClient extends EventEmitter2 { if (this.timeout) { setTimeout(function () { if (!receivedStatus) { - that.emit("timeout"); + that.emit('timeout'); } }, this.timeout); } @@ -150,5 +150,4 @@ class ActionClient extends EventEmitter2 { } } - module.exports = ActionClient; diff --git a/src/actionlib/ActionListener.js b/src/actionlib/ActionListener.js index c67deece8..f3a389184 100644 --- a/src/actionlib/ActionListener.js +++ b/src/actionlib/ActionListener.js @@ -7,7 +7,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * An actionlib action listener. @@ -37,47 +37,47 @@ class ActionListener extends EventEmitter2 { // create the topics associated with actionlib var goalListener = new Topic({ ros: this.ros, - name: this.serverName + "/goal", - messageType: this.actionName + "Goal", + name: this.serverName + '/goal', + messageType: this.actionName + 'Goal' }); var feedbackListener = new Topic({ ros: this.ros, - name: this.serverName + "/feedback", - messageType: this.actionName + "Feedback", + name: this.serverName + '/feedback', + messageType: this.actionName + 'Feedback' }); var statusListener = new Topic({ ros: this.ros, - name: this.serverName + "/status", - messageType: "actionlib_msgs/GoalStatusArray", + name: this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray' }); var resultListener = new Topic({ ros: this.ros, - name: this.serverName + "/result", - messageType: this.actionName + "Result", + name: this.serverName + '/result', + messageType: this.actionName + 'Result' }); goalListener.subscribe(function (goalMessage) { - that.emit("goal", goalMessage); + that.emit('goal', goalMessage); }); statusListener.subscribe(function (statusMessage) { statusMessage.status_list.forEach(function (status) { - that.emit("status", status); + that.emit('status', status); }); }); feedbackListener.subscribe(function (feedbackMessage) { - that.emit("status", feedbackMessage.status); - that.emit("feedback", feedbackMessage.feedback); + that.emit('status', feedbackMessage.status); + that.emit('feedback', feedbackMessage.feedback); }); // subscribe to the result topic resultListener.subscribe(function (resultMessage) { - that.emit("status", resultMessage.status); - that.emit("result", resultMessage.result); + that.emit('status', resultMessage.status); + that.emit('result', resultMessage.result); }); } } diff --git a/src/actionlib/Goal.js b/src/actionlib/Goal.js index 566ddad36..f26b99da4 100644 --- a/src/actionlib/Goal.js +++ b/src/actionlib/Goal.js @@ -5,7 +5,7 @@ var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; -var ActionClient = require("./ActionClient"); +var ActionClient = require('./ActionClient'); /** * An actionlib goal that is associated with an action server. @@ -30,29 +30,29 @@ class Goal extends EventEmitter2 { var date = new Date(); // Create a random ID - this.goalID = "goal_" + Math.random() + "_" + date.getTime(); + this.goalID = 'goal_' + Math.random() + '_' + date.getTime(); // Fill in the goal message this.goalMessage = new Message({ goal_id: { stamp: { secs: 0, - nsecs: 0, + nsecs: 0 }, - id: this.goalID, + id: this.goalID }, - goal: this.goalMessage, + goal: this.goalMessage }); - this.on("status", function (status) { + this.on('status', function (status) { that.status = status; }); - this.on("result", function (result) { + this.on('result', function (result) { that.isFinished = true; that.result = result; }); - this.on("feedback", function (feedback) { + this.on('feedback', function (feedback) { that.feedback = feedback; }); @@ -70,7 +70,7 @@ class Goal extends EventEmitter2 { if (timeout) { setTimeout(function () { if (!that.isFinished) { - that.emit("timeout"); + that.emit('timeout'); } }, timeout); } @@ -80,11 +80,10 @@ class Goal extends EventEmitter2 { */ cancel() { var cancelMessage = new Message({ - id: this.goalID, + id: this.goalID }); this.actionClient.cancelTopic.publish(cancelMessage); } } - module.exports = Goal; diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index 5f2c868dd..cd3db856e 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -6,7 +6,7 @@ var Topic = require('../core/Topic'); var Message = require('../core/Message'); var EventEmitter2 = require('eventemitter2').EventEmitter2; -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * An actionlib action server client. @@ -33,45 +33,45 @@ class SimpleActionServer extends EventEmitter2 { // create and advertise publishers this.feedbackPublisher = new Topic({ ros: this.ros, - name: this.serverName + "/feedback", - messageType: this.actionName + "Feedback", + name: this.serverName + '/feedback', + messageType: this.actionName + 'Feedback' }); this.feedbackPublisher.advertise(); var statusPublisher = new Topic({ ros: this.ros, - name: this.serverName + "/status", - messageType: "actionlib_msgs/GoalStatusArray", + name: this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray' }); statusPublisher.advertise(); this.resultPublisher = new Topic({ ros: this.ros, - name: this.serverName + "/result", - messageType: this.actionName + "Result", + name: this.serverName + '/result', + messageType: this.actionName + 'Result' }); this.resultPublisher.advertise(); // create and subscribe to listeners var goalListener = new Topic({ ros: this.ros, - name: this.serverName + "/goal", - messageType: this.actionName + "Goal", + name: this.serverName + '/goal', + messageType: this.actionName + 'Goal' }); var cancelListener = new Topic({ ros: this.ros, - name: this.serverName + "/cancel", - messageType: "actionlib_msgs/GoalID", + name: this.serverName + '/cancel', + messageType: 'actionlib_msgs/GoalID' }); // Track the goals and their status in order to publish status... this.statusMessage = new Message({ header: { stamp: { secs: 0, nsecs: 100 }, - frame_id: "", + frame_id: '' }, - status_list: [], + status_list: [] }); // needed for handling preemption prompted by a new goal being received @@ -82,14 +82,14 @@ class SimpleActionServer extends EventEmitter2 { if (that.currentGoal) { that.nextGoal = goalMessage; // needs to happen AFTER rest is set up - that.emit("cancel"); + that.emit('cancel'); } else { // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. that.statusMessage.status_list = [ - { goal_id: goalMessage.goal_id, status: 1 }, + { goal_id: goalMessage.goal_id, status: 1 } ]; that.currentGoal = goalMessage; - that.emit("goal", goalMessage.goal); + that.emit('goal', goalMessage.goal); } }); @@ -116,11 +116,11 @@ class SimpleActionServer extends EventEmitter2 { if ( cancelMessage.stamp.secs === 0 && cancelMessage.stamp.secs === 0 && - cancelMessage.id === "" + cancelMessage.id === '' ) { that.nextGoal = null; if (that.currentGoal) { - that.emit("cancel"); + that.emit('cancel'); } } else { // treat id and stamp independently @@ -128,7 +128,7 @@ class SimpleActionServer extends EventEmitter2 { that.currentGoal && cancelMessage.id === that.currentGoal.goal_id.id ) { - that.emit("cancel"); + that.emit('cancel'); } else if ( that.nextGoal && cancelMessage.id === that.nextGoal.goal_id.id @@ -146,7 +146,7 @@ class SimpleActionServer extends EventEmitter2 { that.currentGoal && isEarlier(that.currentGoal.goal_id.stamp, cancelMessage.stamp) ) { - that.emit("cancel"); + that.emit('cancel'); } } }); @@ -173,7 +173,7 @@ class SimpleActionServer extends EventEmitter2 { setSucceeded(result) { var resultMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 3 }, - result: result, + result: result }); this.resultPublisher.publish(resultMessage); @@ -182,7 +182,7 @@ class SimpleActionServer extends EventEmitter2 { if (this.nextGoal) { this.currentGoal = this.nextGoal; this.nextGoal = null; - this.emit("goal", this.currentGoal.goal); + this.emit('goal', this.currentGoal.goal); } else { this.currentGoal = null; } @@ -195,7 +195,7 @@ class SimpleActionServer extends EventEmitter2 { setAborted(result) { var resultMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 4 }, - result: result, + result: result }); this.resultPublisher.publish(resultMessage); @@ -204,7 +204,7 @@ class SimpleActionServer extends EventEmitter2 { if (this.nextGoal) { this.currentGoal = this.nextGoal; this.nextGoal = null; - this.emit("goal", this.currentGoal.goal); + this.emit('goal', this.currentGoal.goal); } else { this.currentGoal = null; } @@ -217,7 +217,7 @@ class SimpleActionServer extends EventEmitter2 { sendFeedback(feedback) { var feedbackMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 1 }, - feedback: feedback, + feedback: feedback }); this.feedbackPublisher.publish(feedbackMessage); } @@ -228,19 +228,18 @@ class SimpleActionServer extends EventEmitter2 { // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. this.statusMessage.status_list = []; var resultMessage = new Message({ - status: { goal_id: this.currentGoal.goal_id, status: 2 }, + status: { goal_id: this.currentGoal.goal_id, status: 2 } }); this.resultPublisher.publish(resultMessage); if (this.nextGoal) { this.currentGoal = this.nextGoal; this.nextGoal = null; - this.emit("goal", this.currentGoal.goal); + this.emit('goal', this.currentGoal.goal); } else { this.currentGoal = null; } } } - module.exports = SimpleActionServer; diff --git a/src/actionlib/index.js b/src/actionlib/index.js index 58838aeaa..a9dd8bbce 100644 --- a/src/actionlib/index.js +++ b/src/actionlib/index.js @@ -1,11 +1,11 @@ var Ros = require('../core/Ros'); var mixin = require('../mixin'); -var action = module.exports = { - ActionClient: require('./ActionClient'), - ActionListener: require('./ActionListener'), - Goal: require('./Goal'), - SimpleActionServer: require('./SimpleActionServer') -}; +var action = (module.exports = { + ActionClient: require('./ActionClient'), + ActionListener: require('./ActionListener'), + Goal: require('./Goal'), + SimpleActionServer: require('./SimpleActionServer') +}); mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); diff --git a/src/core/Param.js b/src/core/Param.js index d209c169e..7f199997d 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -5,7 +5,7 @@ var Service = require('./Service'); var ServiceRequest = require('./ServiceRequest'); -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * A ROS parameter. @@ -33,12 +33,12 @@ class Param { get(callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/get_param", - serviceType: "rosapi/GetParam", + name: '/rosapi/get_param', + serviceType: 'rosapi/GetParam' }); var request = new ServiceRequest({ - name: this.name, + name: this.name }); paramClient.callService(request, function (result) { @@ -63,13 +63,13 @@ class Param { set(value, callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/set_param", - serviceType: "rosapi/SetParam", + name: '/rosapi/set_param', + serviceType: 'rosapi/SetParam' }); var request = new ServiceRequest({ name: this.name, - value: JSON.stringify(value), + value: JSON.stringify(value) }); paramClient.callService(request, callback); @@ -82,19 +82,16 @@ class Param { delete(callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/delete_param", - serviceType: "rosapi/DeleteParam", + name: '/rosapi/delete_param', + serviceType: 'rosapi/DeleteParam' }); var request = new ServiceRequest({ - name: this.name, + name: this.name }); paramClient.callService(request, callback); } } - - - module.exports = Param; diff --git a/src/core/Ros.js b/src/core/Ros.js index 3f5e7493a..e3264a5f3 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -38,13 +38,13 @@ class Ros extends EventEmitter2 { this.socket = null; this.idCounter = 0; this.isConnected = false; - this.transportLibrary = options.transportLibrary || "websocket"; + this.transportLibrary = options.transportLibrary || 'websocket'; this.transportOptions = options.transportOptions || {}; this._sendFunc = function (msg) { that.sendEncodedMessage(msg); }; - if (typeof options.groovyCompatibility === "undefined") { + if (typeof options.groovyCompatibility === 'undefined') { this.groovyCompatibility = true; } else { this.groovyCompatibility = options.groovyCompatibility; @@ -64,32 +64,32 @@ class Ros extends EventEmitter2 { * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. */ connect(url) { - if (this.transportLibrary === "socket.io") { + if (this.transportLibrary === 'socket.io') { this.socket = assign( // @ts-expect-error -- this doesn't seem to work - io(url, { "force new connection": true }), + io(url, { 'force new connection': true }), socketAdapter(this) ); - this.socket.on("connect", this.socket.onopen); - this.socket.on("data", this.socket.onmessage); - this.socket.on("close", this.socket.onclose); - this.socket.on("error", this.socket.onerror); - } else if (this.transportLibrary.constructor.name === "RTCPeerConnection") { + this.socket.on('connect', this.socket.onopen); + this.socket.on('data', this.socket.onmessage); + this.socket.on('close', this.socket.onclose); + this.socket.on('error', this.socket.onerror); + } else if (this.transportLibrary.constructor.name === 'RTCPeerConnection') { this.socket = assign( // @ts-expect-error -- this is kinda wild. `this.transportLibrary` can either be a string or an RTCDataChannel. This needs fixing. this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this) ); - } else if (this.transportLibrary === "websocket") { + } else if (this.transportLibrary === 'websocket') { if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { var sock = new WebSocket(url); - sock.binaryType = "arraybuffer"; + sock.binaryType = 'arraybuffer'; this.socket = assign(sock, socketAdapter(this)); } - } else if (this.transportLibrary === "workersocket") { + } else if (this.transportLibrary === 'workersocket') { this.socket = assign(new WorkerSocket(url), socketAdapter(this)); } else { - throw "Unknown transportLibrary: " + this.transportLibrary.toString(); + throw 'Unknown transportLibrary: ' + this.transportLibrary.toString(); } } /** @@ -114,14 +114,14 @@ class Ros extends EventEmitter2 { authenticate(mac, client, dest, rand, t, level, end) { // create the request var auth = { - op: "auth", + op: 'auth', mac: mac, client: client, dest: dest, rand: rand, t: t, level: level, - end: end, + end: end }; // send the request this.callOnConnection(auth); @@ -134,9 +134,9 @@ class Ros extends EventEmitter2 { sendEncodedMessage(messageEncoded) { var emitter = null; var that = this; - if (this.transportLibrary === "socket.io") { + if (this.transportLibrary === 'socket.io') { emitter = function (msg) { - that.socket.emit("operation", msg); + that.socket.emit('operation', msg); }; } else { emitter = function (msg) { @@ -145,7 +145,7 @@ class Ros extends EventEmitter2 { } if (!this.isConnected) { - that.once("connection", function () { + that.once('connection', function () { emitter(messageEncoded); }); } else { @@ -173,9 +173,9 @@ class Ros extends EventEmitter2 { */ setStatusLevel(level, id) { var levelMsg = { - op: "set_level", + op: 'set_level', level: level, - id: id, + id: id }; this.callOnConnection(levelMsg); @@ -197,12 +197,12 @@ class Ros extends EventEmitter2 { getActionServers(callback, failedCallback) { var getActionServers = new Service({ ros: this, - name: "/rosapi/action_servers", - serviceType: "rosapi/GetActionServers", + name: '/rosapi/action_servers', + serviceType: 'rosapi/GetActionServers' }); var request = new ServiceRequest({}); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { getActionServers.callService( request, function (result) { @@ -237,12 +237,12 @@ class Ros extends EventEmitter2 { getTopics(callback, failedCallback) { var topicsClient = new Service({ ros: this, - name: "/rosapi/topics", - serviceType: "rosapi/Topics", + name: '/rosapi/topics', + serviceType: 'rosapi/Topics' }); var request = new ServiceRequest(); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { topicsClient.callService( request, function (result) { @@ -276,14 +276,14 @@ class Ros extends EventEmitter2 { getTopicsForType(topicType, callback, failedCallback) { var topicsForTypeClient = new Service({ ros: this, - name: "/rosapi/topics_for_type", - serviceType: "rosapi/TopicsForType", + name: '/rosapi/topics_for_type', + serviceType: 'rosapi/TopicsForType' }); var request = new ServiceRequest({ - type: topicType, + type: topicType }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { topicsForTypeClient.callService( request, function (result) { @@ -316,12 +316,12 @@ class Ros extends EventEmitter2 { getServices(callback, failedCallback) { var servicesClient = new Service({ ros: this, - name: "/rosapi/services", - serviceType: "rosapi/Services", + name: '/rosapi/services', + serviceType: 'rosapi/Services' }); var request = new ServiceRequest(); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { servicesClient.callService( request, function (result) { @@ -355,14 +355,14 @@ class Ros extends EventEmitter2 { getServicesForType(serviceType, callback, failedCallback) { var servicesForTypeClient = new Service({ ros: this, - name: "/rosapi/services_for_type", - serviceType: "rosapi/ServicesForType", + name: '/rosapi/services_for_type', + serviceType: 'rosapi/ServicesForType' }); var request = new ServiceRequest({ - type: serviceType, + type: serviceType }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { servicesForTypeClient.callService( request, function (result) { @@ -397,14 +397,14 @@ class Ros extends EventEmitter2 { getServiceRequestDetails(type, callback, failedCallback) { var serviceTypeClient = new Service({ ros: this, - name: "/rosapi/service_request_details", - serviceType: "rosapi/ServiceRequestDetails", + name: '/rosapi/service_request_details', + serviceType: 'rosapi/ServiceRequestDetails' }); var request = new ServiceRequest({ - type: type, + type: type }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { serviceTypeClient.callService( request, function (result) { @@ -439,14 +439,14 @@ class Ros extends EventEmitter2 { getServiceResponseDetails(type, callback, failedCallback) { var serviceTypeClient = new Service({ ros: this, - name: "/rosapi/service_response_details", - serviceType: "rosapi/ServiceResponseDetails", + name: '/rosapi/service_response_details', + serviceType: 'rosapi/ServiceResponseDetails' }); var request = new ServiceRequest({ - type: type, + type: type }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { serviceTypeClient.callService( request, function (result) { @@ -479,12 +479,12 @@ class Ros extends EventEmitter2 { getNodes(callback, failedCallback) { var nodesClient = new Service({ ros: this, - name: "/rosapi/nodes", - serviceType: "rosapi/Nodes", + name: '/rosapi/nodes', + serviceType: 'rosapi/Nodes' }); var request = new ServiceRequest(); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { nodesClient.callService( request, function (result) { @@ -539,14 +539,14 @@ class Ros extends EventEmitter2 { getNodeDetails(node, callback, failedCallback) { var nodesClient = new Service({ ros: this, - name: "/rosapi/node_details", - serviceType: "rosapi/NodeDetails", + name: '/rosapi/node_details', + serviceType: 'rosapi/NodeDetails' }); var request = new ServiceRequest({ - node: node, + node: node }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { nodesClient.callService( request, function (result) { @@ -580,11 +580,11 @@ class Ros extends EventEmitter2 { getParams(callback, failedCallback) { var paramsClient = new Service({ ros: this, - name: "/rosapi/get_param_names", - serviceType: "rosapi/GetParamNames", + name: '/rosapi/get_param_names', + serviceType: 'rosapi/GetParamNames' }); var request = new ServiceRequest(); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { paramsClient.callService( request, function (result) { @@ -618,14 +618,14 @@ class Ros extends EventEmitter2 { getTopicType(topic, callback, failedCallback) { var topicTypeClient = new Service({ ros: this, - name: "/rosapi/topic_type", - serviceType: "rosapi/TopicType", + name: '/rosapi/topic_type', + serviceType: 'rosapi/TopicType' }); var request = new ServiceRequest({ - topic: topic, + topic: topic }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { topicTypeClient.callService( request, function (result) { @@ -659,14 +659,14 @@ class Ros extends EventEmitter2 { getServiceType(service, callback, failedCallback) { var serviceTypeClient = new Service({ ros: this, - name: "/rosapi/service_type", - serviceType: "rosapi/ServiceType", + name: '/rosapi/service_type', + serviceType: 'rosapi/ServiceType' }); var request = new ServiceRequest({ - service: service, + service: service }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { serviceTypeClient.callService( request, function (result) { @@ -700,14 +700,14 @@ class Ros extends EventEmitter2 { getMessageDetails(message, callback, failedCallback) { var messageDetailClient = new Service({ ros: this, - name: "/rosapi/message_details", - serviceType: "rosapi/MessageDetails", + name: '/rosapi/message_details', + serviceType: 'rosapi/MessageDetails' }); var request = new ServiceRequest({ - type: message, + type: message }); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { messageDetailClient.callService( request, function (result) { @@ -738,7 +738,7 @@ class Ros extends EventEmitter2 { var arrayLen = theType.fieldarraylen[i]; var fieldName = theType.fieldnames[i]; var fieldType = theType.fieldtypes[i]; - if (fieldType.indexOf("/") === -1) { + if (fieldType.indexOf('/') === -1) { // check the fieldType includes '/' or not if (arrayLen === -1) { typeDefDict[fieldName] = fieldType; @@ -763,8 +763,8 @@ class Ros extends EventEmitter2 { } } else { that.emit( - "error", - "Cannot find " + fieldType + " in decodeTypeDefs" + 'error', + 'Cannot find ' + fieldType + ' in decodeTypeDefs' ); } } @@ -794,12 +794,12 @@ class Ros extends EventEmitter2 { getTopicsAndRawTypes(callback, failedCallback) { var topicsAndRawTypesClient = new Service({ ros: this, - name: "/rosapi/topics_and_raw_types", - serviceType: "rosapi/TopicsAndRawTypes", + name: '/rosapi/topics_and_raw_types', + serviceType: 'rosapi/TopicsAndRawTypes' }); var request = new ServiceRequest(); - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { topicsAndRawTypesClient.callService( request, function (result) { @@ -817,5 +817,4 @@ class Ros extends EventEmitter2 { } } - module.exports = Ros; diff --git a/src/core/Service.js b/src/core/Service.js index 603ea4308..d60da469b 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -6,7 +6,7 @@ var ServiceResponse = require('./ServiceResponse'); var ServiceRequest = require('./ServiceRequest'); var EventEmitter2 = require('eventemitter2').EventEmitter2; -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * A ROS service client. @@ -50,26 +50,26 @@ class Service extends EventEmitter2 { } var serviceCallId = - "call_service:" + this.name + ":" + ++this.ros.idCounter; + 'call_service:' + this.name + ':' + ++this.ros.idCounter; if (callback || failedCallback) { this.ros.once(serviceCallId, function (message) { if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === "function") { + if (typeof failedCallback === 'function') { failedCallback(message.values); } - } else if (typeof callback === "function") { + } else if (typeof callback === 'function') { callback(new ServiceResponse(message.values)); } }); } var call = { - op: "call_service", + op: 'call_service', id: serviceCallId, service: this.name, type: this.serviceType, - args: request, + args: request }; this.ros.callOnConnection(call); } @@ -88,16 +88,16 @@ class Service extends EventEmitter2 { * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params */ advertise(callback) { - if (this.isAdvertised || typeof callback !== "function") { + if (this.isAdvertised || typeof callback !== 'function') { return; } this._serviceCallback = callback; this.ros.on(this.name, this._serviceResponse.bind(this)); this.ros.callOnConnection({ - op: "advertise_service", + op: 'advertise_service', type: this.serviceType, - service: this.name, + service: this.name }); this.isAdvertised = true; } @@ -106,8 +106,8 @@ class Service extends EventEmitter2 { return; } this.ros.callOnConnection({ - op: "unadvertise_service", - service: this.name, + op: 'unadvertise_service', + service: this.name }); this.isAdvertised = false; } @@ -116,10 +116,10 @@ class Service extends EventEmitter2 { var success = this._serviceCallback(rosbridgeRequest.args, response); var call = { - op: "service_response", + op: 'service_response', service: this.name, values: new ServiceResponse(response), - result: success, + result: success }; if (rosbridgeRequest.id) { diff --git a/src/core/ServiceResponse.js b/src/core/ServiceResponse.js index 01d8311c3..1c891b987 100644 --- a/src/core/ServiceResponse.js +++ b/src/core/ServiceResponse.js @@ -15,4 +15,4 @@ function ServiceResponse(values) { assign(this, values); } -module.exports = ServiceResponse; \ No newline at end of file +module.exports = ServiceResponse; diff --git a/src/core/SocketAdapter.js b/src/core/SocketAdapter.js index 3dc754f5a..664562fe4 100644 --- a/src/core/SocketAdapter.js +++ b/src/core/SocketAdapter.js @@ -13,7 +13,7 @@ var CBOR = require('cbor-js'); var typedArrayTagger = require('../util/cborTypedArrayTags'); var BSON = null; // @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit -if(typeof bson !== 'undefined'){ +if (typeof bson !== 'undefined') { // @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit BSON = bson().BSON; } @@ -39,9 +39,9 @@ function SocketAdapter(client) { client.emit(message.id, message); } else if (message.op === 'call_service') { client.emit(message.service, message); - } else if(message.op === 'status'){ - if(message.id){ - client.emit('status:'+message.id, message); + } else if (message.op === 'status') { + if (message.id) { + client.emit('status:' + message.id, message); } else { client.emit('status', message); } @@ -61,7 +61,7 @@ function SocketAdapter(client) { throw 'Cannot process BSON encoded message without BSON header.'; } var reader = new FileReader(); - reader.onload = function() { + reader.onload = function () { // @ts-expect-error -- this doesn't seem right, but don't want to break current type coercion assumption var uint8Array = new Uint8Array(this.result); var msg = BSON.deserialize(uint8Array); diff --git a/src/core/Topic.js b/src/core/Topic.js index 40c00afeb..8a32e43ae 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -5,7 +5,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Message = require('./Message'); -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * Publish and/or subscribe to a topic in ROS. @@ -34,7 +34,7 @@ class Topic extends EventEmitter2 { this.name = options.name; this.messageType = options.messageType; this.isAdvertised = false; - this.compression = options.compression || "none"; + this.compression = options.compression || 'none'; this.throttle_rate = options.throttle_rate || 0; this.latch = options.latch || false; this.queue_size = options.queue_size || 100; @@ -47,22 +47,22 @@ class Topic extends EventEmitter2 { // Check for valid compression types if ( this.compression && - this.compression !== "png" && - this.compression !== "cbor" && - this.compression !== "cbor-raw" && - this.compression !== "none" + this.compression !== 'png' && + this.compression !== 'cbor' && + this.compression !== 'cbor-raw' && + this.compression !== 'none' ) { this.emit( - "warning", + 'warning', this.compression + - " compression is not supported. No compression will be used." + ' compression is not supported. No compression will be used.' ); - this.compression = "none"; + this.compression = 'none'; } // Check if throttle rate is negative if (this.throttle_rate < 0) { - this.emit("warning", this.throttle_rate + " is not allowed. Set to 0"); + this.emit('warning', this.throttle_rate + ' is not allowed. Set to 0'); this.throttle_rate = 0; } @@ -76,19 +76,19 @@ class Topic extends EventEmitter2 { if (!that.waitForReconnect) { that.waitForReconnect = true; that.ros.callOnConnection(message); - that.ros.once("connection", function () { + that.ros.once('connection', function () { that.waitForReconnect = false; }); } }; - that.ros.on("close", that.reconnectFunc); + that.ros.on('close', that.reconnectFunc); }; } else { this.callForSubscribeAndAdvertise = this.ros.callOnConnection; } this._messageCallback = function (data) { - that.emit("message", new Message(data)); + that.emit('message', new Message(data)); }; } /** @@ -102,24 +102,24 @@ class Topic extends EventEmitter2 { * @param {subscribeCallback} callback - Function with the following params: */ subscribe(callback) { - if (typeof callback === "function") { - this.on("message", callback); + if (typeof callback === 'function') { + this.on('message', callback); } if (this.subscribeId) { return; } this.ros.on(this.name, this._messageCallback); - this.subscribeId = "subscribe:" + this.name + ":" + ++this.ros.idCounter; + this.subscribeId = 'subscribe:' + this.name + ':' + ++this.ros.idCounter; this.callForSubscribeAndAdvertise({ - op: "subscribe", + op: 'subscribe', id: this.subscribeId, type: this.messageType, topic: this.name, compression: this.compression, throttle_rate: this.throttle_rate, - queue_length: this.queue_length, + queue_length: this.queue_length }); } /** @@ -133,9 +133,9 @@ class Topic extends EventEmitter2 { */ unsubscribe(callback) { if (callback) { - this.off("message", callback); + this.off('message', callback); // If there is any other callbacks still subscribed don't unsubscribe - if (this.listeners("message").length) { + if (this.listeners('message').length) { return; } } @@ -145,13 +145,13 @@ class Topic extends EventEmitter2 { // Note: Don't call this.removeAllListeners, allow client to handle that themselves this.ros.off(this.name, this._messageCallback); if (this.reconnect_on_close) { - this.ros.off("close", this.reconnectFunc); + this.ros.off('close', this.reconnectFunc); } - this.emit("unsubscribe"); + this.emit('unsubscribe'); this.ros.callOnConnection({ - op: "unsubscribe", + op: 'unsubscribe', id: this.subscribeId, - topic: this.name, + topic: this.name }); this.subscribeId = null; } @@ -162,20 +162,20 @@ class Topic extends EventEmitter2 { if (this.isAdvertised) { return; } - this.advertiseId = "advertise:" + this.name + ":" + ++this.ros.idCounter; + this.advertiseId = 'advertise:' + this.name + ':' + ++this.ros.idCounter; this.callForSubscribeAndAdvertise({ - op: "advertise", + op: 'advertise', id: this.advertiseId, type: this.messageType, topic: this.name, latch: this.latch, - queue_size: this.queue_size, + queue_size: this.queue_size }); this.isAdvertised = true; if (!this.reconnect_on_close) { var that = this; - this.ros.on("close", function () { + this.ros.on('close', function () { that.isAdvertised = false; }); } @@ -188,13 +188,13 @@ class Topic extends EventEmitter2 { return; } if (this.reconnect_on_close) { - this.ros.off("close", this.reconnectFunc); + this.ros.off('close', this.reconnectFunc); } - this.emit("unadvertise"); + this.emit('unadvertise'); this.ros.callOnConnection({ - op: "unadvertise", + op: 'unadvertise', id: this.advertiseId, - topic: this.name, + topic: this.name }); this.isAdvertised = false; } @@ -210,11 +210,11 @@ class Topic extends EventEmitter2 { this.ros.idCounter++; var call = { - op: "publish", - id: "publish:" + this.name + ":" + this.ros.idCounter, + op: 'publish', + id: 'publish:' + this.name + ':' + this.ros.idCounter, topic: this.name, msg: message, - latch: this.latch, + latch: this.latch }; this.ros.callOnConnection(call); } diff --git a/src/core/index.js b/src/core/index.js index 3e775f9c4..38d337621 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -1,13 +1,13 @@ var mixin = require('../mixin'); -var core = module.exports = { - Ros: require('./Ros'), - Topic: require('./Topic'), - Message: require('./Message'), - Param: require('./Param'), - Service: require('./Service'), - ServiceRequest: require('./ServiceRequest'), - ServiceResponse: require('./ServiceResponse') -}; +var core = (module.exports = { + Ros: require('./Ros'), + Topic: require('./Topic'), + Message: require('./Message'), + Param: require('./Param'), + Service: require('./Service'), + ServiceRequest: require('./ServiceRequest'), + ServiceResponse: require('./ServiceResponse') +}); mixin(core.Ros, ['Param', 'Service', 'Topic'], core); diff --git a/src/math/Pose.js b/src/math/Pose.js index b90eeed1c..260f6752d 100644 --- a/src/math/Pose.js +++ b/src/math/Pose.js @@ -5,7 +5,7 @@ var Vector3 = require('./Vector3'); var Quaternion = require('./Quaternion'); -var Transform = require("./Transform"); +var Transform = require('./Transform'); /** * A Pose in 3D space. Values are copied into this object. @@ -52,7 +52,7 @@ class Pose { var p = pose.clone(); p.applyTransform({ rotation: this.orientation, - translation: this.position, + translation: this.position }); return p; } @@ -72,8 +72,4 @@ class Pose { } } - - - - module.exports = Pose; diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 0b027944c..fbf4fe6ba 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -19,7 +19,7 @@ class Quaternion { this.x = options.x || 0; this.y = options.y || 0; this.z = options.z || 0; - this.w = typeof options.w === "number" ? options.w : 1; + this.w = typeof options.w === 'number' ? options.w : 1; } /** * Perform a conjugation on this quaternion. @@ -89,10 +89,4 @@ class Quaternion { } } - - - - - - module.exports = Quaternion; diff --git a/src/math/Transform.js b/src/math/Transform.js index 52aa4dc42..b6390764e 100644 --- a/src/math/Transform.js +++ b/src/math/Transform.js @@ -14,7 +14,7 @@ class Transform { * @param {Object} options * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. - */ + */ constructor(options) { options = options || {}; // Copy the values into this object if they exist @@ -31,5 +31,4 @@ class Transform { } } - module.exports = Transform; diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 3a755c854..4511e2d6f 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -3,7 +3,7 @@ * @author David Gossow - dgossow@willowgarage.com */ -var Quaternion = require("./Quaternion"); +var Quaternion = require('./Quaternion'); /** * A 3D vector. @@ -65,8 +65,4 @@ class Vector3 { } } - - - - module.exports = Vector3; diff --git a/src/math/index.js b/src/math/index.js index cd0cb47be..a7934aa27 100644 --- a/src/math/index.js +++ b/src/math/index.js @@ -1,6 +1,6 @@ module.exports = { - Pose: require('./Pose'), - Quaternion: require('./Quaternion'), - Transform: require('./Transform'), - Vector3: require('./Vector3') + Pose: require('./Pose'), + Quaternion: require('./Quaternion'), + Transform: require('./Transform'), + Vector3: require('./Vector3') }; diff --git a/src/mixin.js b/src/mixin.js index 23ccbaeb4..d2b2640ff 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -6,12 +6,12 @@ * * @author Graeme Yeates - github.com/megawac */ -module.exports = function(Ros, classes, features) { - classes.forEach(function(className) { - var Class = features[className]; - Ros.prototype[className] = function(options) { - options.ros = this; - return new Class(options); - }; - }); +module.exports = function (Ros, classes, features) { + classes.forEach(function (className) { + var Class = features[className]; + Ros.prototype[className] = function (options) { + options.ros = this; + return new Class(options); + }; + }); }; diff --git a/src/node/RosTCP.js b/src/node/RosTCP.js index 927f3e12f..0563ecdcf 100644 --- a/src/node/RosTCP.js +++ b/src/node/RosTCP.js @@ -1,7 +1,7 @@ var Ros = require('../core/Ros'); var SocketIO = require('./SocketIO'); var net = require('net'); -var socketAdapter = require("../core/SocketAdapter.js"); +var socketAdapter = require('../core/SocketAdapter.js'); /** * Same as core Ros except supports TCP connections. @@ -15,17 +15,17 @@ class RosTCP extends Ros { options = options || {}; if (!options.encoding) { console.error( - "ROSLib uses utf8 encoding by default. " + - "It would be more efficient to use ascii (if possible)." + 'ROSLib uses utf8 encoding by default. ' + + 'It would be more efficient to use ascii (if possible).' ); } - this.encoding = options.encoding || "utf8"; + this.encoding = options.encoding || 'utf8'; Ros.call(this, options); if (!this.socket && (options.host || options.port)) { this.connect({ host: options.host, - port: options.port, + port: options.port }); } if (options.http || options.socketio) { @@ -40,18 +40,18 @@ class RosTCP extends Ros { */ connect(url) { if ( - typeof url === "string" && - (url.slice(0, 5) === "ws://" || url.slice(0, 6) === "wss://") + typeof url === 'string' && + (url.slice(0, 5) === 'ws://' || url.slice(0, 6) === 'wss://') ) { Ros.prototype.connect.call(this, url); } else { var events = socketAdapter(this); this.socket = net .connect(url) - .on("data", events.onmessage) - .on("close", events.onclose) - .on("error", events.onerror) - .on("connect", events.onopen); + .on('data', events.onmessage) + .on('close', events.onclose) + .on('error', events.onerror) + .on('connect', events.onopen); this.socket.setEncoding(this.encoding); this.socket.setTimeout(0); @@ -63,5 +63,4 @@ class RosTCP extends Ros { } } - module.exports = RosTCP; diff --git a/src/node/SocketIO.js b/src/node/SocketIO.js index 7ff78585b..adaffa456 100644 --- a/src/node/SocketIO.js +++ b/src/node/SocketIO.js @@ -13,16 +13,16 @@ class SocketIO { var that = this; - this.socketio.on("connection", function (socket) { - socket.on("operation", that.sendToRosbridge.bind(that)); + this.socketio.on('connection', function (socket) { + socket.on('operation', that.sendToRosbridge.bind(that)); }); - Ros.on("connection", function () { + Ros.on('connection', function () { that.socket - .on("message", that.sendToFront("data").bind(that)) - .on("close", that.sendToFront("close").bind(that)) - .on("error", that.sendToFront("error").bind(that)) - .on("connect", that.sendToFront("connect").bind(that)); + .on('message', that.sendToFront('data').bind(that)) + .on('close', that.sendToFront('close').bind(that)) + .on('error', that.sendToFront('error').bind(that)) + .on('connect', that.sendToFront('connect').bind(that)); }); return this.socketio; @@ -38,6 +38,4 @@ class SocketIO { } } - - module.exports = SocketIO; diff --git a/src/node/TopicStream.js b/src/node/TopicStream.js index a9a0dc47c..5601f5b8a 100644 --- a/src/node/TopicStream.js +++ b/src/node/TopicStream.js @@ -5,46 +5,46 @@ var DuplexStream = require('stream').Duplex; * Publish a connected ROS topic to a duplex * stream. This stream can be piped to, which will * publish to the topic. -* -* @param {Object} options -* @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. -* @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. -* @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. -*/ + * + * @param {Object} options + * @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. + * @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. + * @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. + */ // @ts-expect-error -- prototype call here is unhappy - maybe we need to get rid of this or roll it into Topic. -Topic.prototype.toStream = function(options) { - options = options || {subscribe: true, publish: true}; +Topic.prototype.toStream = function (options) { + options = options || { subscribe: true, publish: true }; - var topic = this; + var topic = this; - var stream = new DuplexStream({ - objectMode: true - }); - stream._read = function() {}; - - // Publish to the topic if someone pipes to stream - stream._write = function(chunk, encoding, callback) { - if (typeof options.transform === "function") { - chunk = options.transform(chunk); - } - if (chunk === false) { - topic.publish(chunk); - } - callback(); - }; - - if (options.subscribe) { - this.subscribe(function(message) { - stream.push(message); - }); - this.on('unsubscribe', stream.push.bind(stream, null)); - } + var stream = new DuplexStream({ + objectMode: true + }); + stream._read = function () {}; - if (options.publish) { - this.advertise(); + // Publish to the topic if someone pipes to stream + stream._write = function (chunk, encoding, callback) { + if (typeof options.transform === 'function') { + chunk = options.transform(chunk); + } + if (chunk === false) { + topic.publish(chunk); } + callback(); + }; + + if (options.subscribe) { + this.subscribe(function (message) { + stream.push(message); + }); + this.on('unsubscribe', stream.push.bind(stream, null)); + } + + if (options.publish) { + this.advertise(); + } - return stream; + return stream; }; module.exports = Topic; diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index 620eb0e82..fa6b3130c 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -3,7 +3,7 @@ * @author David Gossow - dgossow@willowgarage.com */ -const { EventEmitter2 } = require("eventemitter2"); +const { EventEmitter2 } = require('eventemitter2'); var ActionClient = require('../actionlib/ActionClient'); var Goal = require('../actionlib/Goal'); @@ -13,7 +13,7 @@ var Topic = require('../core/Topic.js'); var Transform = require('../math/Transform'); -var Ros = require("../core/Ros"); +var Ros = require('../core/Ros'); /** * A TF Client that listens to TFs from tf2_web_republisher. @@ -36,7 +36,7 @@ class TFClient extends EventEmitter2 { super(); options = options || {}; this.ros = options.ros; - this.fixedFrame = options.fixedFrame || "base_link"; + this.fixedFrame = options.fixedFrame || 'base_link'; this.angularThres = options.angularThres || 2.0; this.transThres = options.transThres || 0.01; this.rate = options.rate || 10.0; @@ -46,10 +46,10 @@ class TFClient extends EventEmitter2 { var nsecs = Math.floor((seconds - secs) * 1000000000); this.topicTimeout = { secs: secs, - nsecs: nsecs, + nsecs: nsecs }; - this.serverName = options.serverName || "/tf2_web_republisher"; - this.repubServiceName = options.repubServiceName || "/republish_tfs"; + this.serverName = options.serverName || '/tf2_web_republisher'; + this.repubServiceName = options.repubServiceName || '/republish_tfs'; this.currentGoal = false; this.currentTopic = false; @@ -62,16 +62,16 @@ class TFClient extends EventEmitter2 { this.actionClient = new ActionClient({ ros: options.ros, serverName: this.serverName, - actionName: "tf2_web_republisher/TFSubscriptionAction", + actionName: 'tf2_web_republisher/TFSubscriptionAction', omitStatus: true, - omitResult: true, + omitResult: true }); // Create a Service Client this.serviceClient = new Service({ ros: options.ros, name: this.repubServiceName, - serviceType: "tf2_web_republisher/RepublishTFs", + serviceType: 'tf2_web_republisher/RepublishTFs' }); } /** @@ -84,14 +84,14 @@ class TFClient extends EventEmitter2 { var that = this; tf.transforms.forEach(function (transform) { var frameID = transform.child_frame_id; - if (frameID[0] === "/") { + if (frameID[0] === '/') { frameID = frameID.substring(1); } var info = this.frameInfos[frameID]; if (info) { info.transform = new Transform({ translation: transform.transform.translation, - rotation: transform.transform.rotation, + rotation: transform.transform.rotation }); info.cbs.forEach(function (cb) { cb(info.transform); @@ -109,7 +109,7 @@ class TFClient extends EventEmitter2 { target_frame: this.fixedFrame, angular_thres: this.angularThres, trans_thres: this.transThres, - rate: this.rate, + rate: this.rate }; // if we're running in groovy compatibility mode (the default) @@ -120,10 +120,10 @@ class TFClient extends EventEmitter2 { } this.currentGoal = new Goal({ actionClient: this.actionClient, - goalMessage: goalMessage, + goalMessage: goalMessage }); - this.currentGoal.on("feedback", this.processTFArray.bind(this)); + this.currentGoal.on('feedback', this.processTFArray.bind(this)); this.currentGoal.send(); } else { // otherwise, use the service interface @@ -159,7 +159,7 @@ class TFClient extends EventEmitter2 { this.currentTopic = new Topic({ ros: this.ros, name: response.topic_name, - messageType: "tf2_web_republisher/TFArray", + messageType: 'tf2_web_republisher/TFArray' }); this._subscribeCB = this.processTFArray.bind(this); this.currentTopic.subscribe(this._subscribeCB); @@ -176,13 +176,13 @@ class TFClient extends EventEmitter2 { */ subscribe(frameID, callback) { // remove leading slash, if it's there - if (frameID[0] === "/") { + if (frameID[0] === '/') { frameID = frameID.substring(1); } // if there is no callback registered for the given frame, create empty callback list if (!this.frameInfos[frameID]) { this.frameInfos[frameID] = { - cbs: [], + cbs: [] }; if (!this.republisherUpdateRequested) { setTimeout(this.updateGoal.bind(this), this.updateDelay); @@ -204,7 +204,7 @@ class TFClient extends EventEmitter2 { */ unsubscribe(frameID, callback) { // remove leading slash, if it's there - if (frameID[0] === "/") { + if (frameID[0] === '/') { frameID = frameID.substring(1); } var info = this.frameInfos[frameID]; @@ -229,10 +229,4 @@ class TFClient extends EventEmitter2 { } } - - - - - - module.exports = TFClient; diff --git a/src/tf/index.js b/src/tf/index.js index c6fbd4ec7..5d40cf09d 100644 --- a/src/tf/index.js +++ b/src/tf/index.js @@ -1,8 +1,8 @@ var Ros = require('../core/Ros'); var mixin = require('../mixin'); -var tf = module.exports = { - TFClient: require('./TFClient') -}; +var tf = (module.exports = { + TFClient: require('./TFClient') +}); -mixin(Ros, ['TFClient'], tf); \ No newline at end of file +mixin(Ros, ['TFClient'], tf); diff --git a/src/urdf/UrdfBox.js b/src/urdf/UrdfBox.js index 0c8b27b78..aba6efa08 100644 --- a/src/urdf/UrdfBox.js +++ b/src/urdf/UrdfBox.js @@ -20,11 +20,11 @@ class UrdfBox { this.type = UrdfTypes.URDF_BOX; // Parse the xml string - var xyz = options.xml.getAttribute("size").split(" "); + var xyz = options.xml.getAttribute('size').split(' '); this.dimension = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } } diff --git a/src/urdf/UrdfColor.js b/src/urdf/UrdfColor.js index 0aea98d10..aec99f7f8 100644 --- a/src/urdf/UrdfColor.js +++ b/src/urdf/UrdfColor.js @@ -14,7 +14,7 @@ class UrdfColor { */ constructor(options) { // Parse the xml string - var rgba = options.xml.getAttribute("rgba").split(" "); + var rgba = options.xml.getAttribute('rgba').split(' '); this.r = parseFloat(rgba[0]); this.g = parseFloat(rgba[1]); this.b = parseFloat(rgba[2]); diff --git a/src/urdf/UrdfCylinder.js b/src/urdf/UrdfCylinder.js index 6363872f4..38b63a012 100644 --- a/src/urdf/UrdfCylinder.js +++ b/src/urdf/UrdfCylinder.js @@ -16,8 +16,8 @@ class UrdfCylinder { */ constructor(options) { this.type = UrdfTypes.URDF_CYLINDER; - this.length = parseFloat(options.xml.getAttribute("length")); - this.radius = parseFloat(options.xml.getAttribute("radius")); + this.length = parseFloat(options.xml.getAttribute('length')); + this.radius = parseFloat(options.xml.getAttribute('radius')); } } diff --git a/src/urdf/UrdfJoint.js b/src/urdf/UrdfJoint.js index 0dffea007..ffd3a3de9 100644 --- a/src/urdf/UrdfJoint.js +++ b/src/urdf/UrdfJoint.js @@ -16,48 +16,48 @@ class UrdfJoint { * @param {Element} options.xml - The XML element to parse. */ constructor(options) { - this.name = options.xml.getAttribute("name"); - this.type = options.xml.getAttribute("type"); + this.name = options.xml.getAttribute('name'); + this.type = options.xml.getAttribute('type'); - var parents = options.xml.getElementsByTagName("parent"); + var parents = options.xml.getElementsByTagName('parent'); if (parents.length > 0) { - this.parent = parents[0].getAttribute("link"); + this.parent = parents[0].getAttribute('link'); } - var children = options.xml.getElementsByTagName("child"); + var children = options.xml.getElementsByTagName('child'); if (children.length > 0) { - this.child = children[0].getAttribute("link"); + this.child = children[0].getAttribute('link'); } - var limits = options.xml.getElementsByTagName("limit"); + var limits = options.xml.getElementsByTagName('limit'); if (limits.length > 0) { - this.minval = parseFloat(limits[0].getAttribute("lower") || "NaN"); - this.maxval = parseFloat(limits[0].getAttribute("upper") || "NaN"); + this.minval = parseFloat(limits[0].getAttribute('lower') || 'NaN'); + this.maxval = parseFloat(limits[0].getAttribute('upper') || 'NaN'); } // Origin - var origins = options.xml.getElementsByTagName("origin"); + var origins = options.xml.getElementsByTagName('origin'); if (origins.length === 0) { // use the identity as the default this.origin = new Pose(); } else { // Check the XYZ - var xyzValue = origins[0].getAttribute("xyz"); + var xyzValue = origins[0].getAttribute('xyz'); var position = new Vector3(); if (xyzValue) { - var xyz = xyzValue.split(" "); + var xyz = xyzValue.split(' '); position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } // Check the RPY - var rpyValue = origins[0].getAttribute("rpy"); + var rpyValue = origins[0].getAttribute('rpy'); var orientation = new Quaternion(); if (rpyValue) { - var rpy = rpyValue.split(" "); + var rpy = rpyValue.split(' '); // Convert from RPY var roll = parseFloat(rpy[0]); var pitch = parseFloat(rpy[1]); @@ -82,13 +82,13 @@ class UrdfJoint { x: x, y: y, z: z, - w: w, + w: w }); orientation.normalize(); } this.origin = new Pose({ position: position, - orientation: orientation, + orientation: orientation }); } } diff --git a/src/urdf/UrdfLink.js b/src/urdf/UrdfLink.js index 459c66350..847c24f14 100644 --- a/src/urdf/UrdfLink.js +++ b/src/urdf/UrdfLink.js @@ -15,14 +15,14 @@ class UrdfLink { * @param {Element} options.xml - The XML element to parse. */ constructor(options) { - this.name = options.xml.getAttribute("name"); + this.name = options.xml.getAttribute('name'); this.visuals = []; - var visuals = options.xml.getElementsByTagName("visual"); + var visuals = options.xml.getElementsByTagName('visual'); for (var i = 0; i < visuals.length; i++) { this.visuals.push( new UrdfVisual({ - xml: visuals[i], + xml: visuals[i] }) ); } diff --git a/src/urdf/UrdfMaterial.js b/src/urdf/UrdfMaterial.js index 175b2af89..1d55d1230 100644 --- a/src/urdf/UrdfMaterial.js +++ b/src/urdf/UrdfMaterial.js @@ -18,20 +18,20 @@ class UrdfMaterial { this.textureFilename = null; this.color = null; - this.name = options.xml.getAttribute("name"); + this.name = options.xml.getAttribute('name'); // Texture - var textures = options.xml.getElementsByTagName("texture"); + var textures = options.xml.getElementsByTagName('texture'); if (textures.length > 0) { - this.textureFilename = textures[0].getAttribute("filename"); + this.textureFilename = textures[0].getAttribute('filename'); } // Color - var colors = options.xml.getElementsByTagName("color"); + var colors = options.xml.getElementsByTagName('color'); if (colors.length > 0) { // Parse the RBGA string this.color = new UrdfColor({ - xml: colors[0], + xml: colors[0] }); } } @@ -43,8 +43,6 @@ class UrdfMaterial { } } - var assign = require('object-assign'); - module.exports = UrdfMaterial; diff --git a/src/urdf/UrdfMesh.js b/src/urdf/UrdfMesh.js index c8d3da47b..15cb1485e 100644 --- a/src/urdf/UrdfMesh.js +++ b/src/urdf/UrdfMesh.js @@ -19,17 +19,17 @@ class UrdfMesh { this.scale = null; this.type = UrdfTypes.URDF_MESH; - this.filename = options.xml.getAttribute("filename"); + this.filename = options.xml.getAttribute('filename'); // Check for a scale - var scale = options.xml.getAttribute("scale"); + var scale = options.xml.getAttribute('scale'); if (scale) { // Get the XYZ - var xyz = scale.split(" "); + var xyz = scale.split(' '); this.scale = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } } diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index cec7f5d61..598db8739 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -33,7 +33,7 @@ class UrdfModel { if (string) { // Parse the string var parser = new DOMParser(); - xmlDoc = parser.parseFromString(string, "text/xml").documentElement; + xmlDoc = parser.parseFromString(string, 'text/xml').documentElement; } // Initialize the model with the given XML node. @@ -41,32 +41,32 @@ class UrdfModel { var robotXml = xmlDoc; // Get the robot name - this.name = robotXml.getAttribute("name"); + this.name = robotXml.getAttribute('name'); // Parse all the visual elements we need for (var nodes = robotXml.children, i = 0; i < nodes.length; i++) { var node = nodes[i]; - if (node.tagName === "material") { + if (node.tagName === 'material') { var material = new UrdfMaterial({ - xml: node, + xml: node }); // Make sure this is unique if (this.materials[material.name] !== void 0) { if (this.materials[material.name].isLink()) { this.materials[material.name].assign(material); } else { - console.warn("Material " + material.name + "is not unique."); + console.warn('Material ' + material.name + 'is not unique.'); } } else { this.materials[material.name] = material; } - } else if (node.tagName === "link") { + } else if (node.tagName === 'link') { var link = new UrdfLink({ - xml: node, + xml: node }); // Make sure this is unique if (this.links[link.name] !== void 0) { - console.warn("Link " + link.name + " is not unique."); + console.warn('Link ' + link.name + ' is not unique.'); } else { // Check for a material for (var j = 0; j < link.visuals.length; j++) { @@ -83,9 +83,9 @@ class UrdfModel { // Add the link this.links[link.name] = link; } - } else if (node.tagName === "joint") { + } else if (node.tagName === 'joint') { var joint = new UrdfJoint({ - xml: node, + xml: node }); this.joints[joint.name] = joint; } diff --git a/src/urdf/UrdfSphere.js b/src/urdf/UrdfSphere.js index 6c60135d5..a5e0ab737 100644 --- a/src/urdf/UrdfSphere.js +++ b/src/urdf/UrdfSphere.js @@ -16,7 +16,7 @@ class UrdfSphere { */ constructor(options) { this.type = UrdfTypes.URDF_SPHERE; - this.radius = parseFloat(options.xml.getAttribute("radius") || "NaN"); + this.radius = parseFloat(options.xml.getAttribute('radius') || 'NaN'); } } diff --git a/src/urdf/UrdfTypes.js b/src/urdf/UrdfTypes.js index 99572cc7c..f9d4c4f8b 100644 --- a/src/urdf/UrdfTypes.js +++ b/src/urdf/UrdfTypes.js @@ -1,6 +1,6 @@ module.exports = { - URDF_SPHERE : 0, - URDF_BOX : 1, - URDF_CYLINDER : 2, - URDF_MESH : 3 + URDF_SPHERE: 0, + URDF_BOX: 1, + URDF_CYLINDER: 2, + URDF_MESH: 3 }; diff --git a/src/urdf/UrdfVisual.js b/src/urdf/UrdfVisual.js index 39d86c9e5..d62808a9d 100644 --- a/src/urdf/UrdfVisual.js +++ b/src/urdf/UrdfVisual.js @@ -28,31 +28,31 @@ class UrdfVisual { this.geometry = null; this.material = null; - this.name = options.xml.getAttribute("name"); + this.name = options.xml.getAttribute('name'); // Origin - var origins = xml.getElementsByTagName("origin"); + var origins = xml.getElementsByTagName('origin'); if (origins.length === 0) { // use the identity as the default this.origin = new Pose(); } else { // Check the XYZ - var xyzValue = origins[0].getAttribute("xyz"); + var xyzValue = origins[0].getAttribute('xyz'); var position = new Vector3(); if (xyzValue) { - var xyz = xyzValue.split(" "); + var xyz = xyzValue.split(' '); position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } // Check the RPY - var rpyValue = origins[0].getAttribute("rpy"); + var rpyValue = origins[0].getAttribute('rpy'); var orientation = new Quaternion(); if (rpyValue) { - var rpy = rpyValue.split(" "); + var rpy = rpyValue.split(' '); // Convert from RPY var roll = parseFloat(rpy[0]); var pitch = parseFloat(rpy[1]); @@ -77,18 +77,18 @@ class UrdfVisual { x: x, y: y, z: z, - w: w, + w: w }); orientation.normalize(); } this.origin = new Pose({ position: position, - orientation: orientation, + orientation: orientation }); } // Geometry - var geoms = xml.getElementsByTagName("geometry"); + var geoms = xml.getElementsByTagName('geometry'); if (geoms.length > 0) { var geom = geoms[0]; var shape = null; @@ -103,33 +103,33 @@ class UrdfVisual { if (shape) { // Check the type var type = shape.nodeName; - if (type === "sphere") { + if (type === 'sphere') { this.geometry = new UrdfSphere({ - xml: shape, + xml: shape }); - } else if (type === "box") { + } else if (type === 'box') { this.geometry = new UrdfBox({ - xml: shape, + xml: shape }); - } else if (type === "cylinder") { + } else if (type === 'cylinder') { this.geometry = new UrdfCylinder({ - xml: shape, + xml: shape }); - } else if (type === "mesh") { + } else if (type === 'mesh') { this.geometry = new UrdfMesh({ - xml: shape, + xml: shape }); } else { - console.warn("Unknown geometry type " + type); + console.warn('Unknown geometry type ' + type); } } } // Material - var materials = xml.getElementsByTagName("material"); + var materials = xml.getElementsByTagName('material'); if (materials.length > 0) { this.material = new UrdfMaterial({ - xml: materials[0], + xml: materials[0] }); } } diff --git a/src/urdf/index.js b/src/urdf/index.js index c84b0d2d3..9687feb8b 100644 --- a/src/urdf/index.js +++ b/src/urdf/index.js @@ -1,4 +1,5 @@ -module.exports = require('object-assign')({ +module.exports = require('object-assign')( + { UrdfBox: require('./UrdfBox'), UrdfColor: require('./UrdfColor'), UrdfCylinder: require('./UrdfCylinder'), @@ -8,4 +9,6 @@ module.exports = require('object-assign')({ UrdfModel: require('./UrdfModel'), UrdfSphere: require('./UrdfSphere'), UrdfVisual: require('./UrdfVisual') -}, require('./UrdfTypes')); + }, + require('./UrdfTypes') +); diff --git a/src/util/cborTypedArrayTags.js b/src/util/cborTypedArrayTags.js index 3df9096ba..2e3dd92df 100644 --- a/src/util/cborTypedArrayTags.js +++ b/src/util/cborTypedArrayTags.js @@ -6,14 +6,16 @@ var warnedPrecision = false; function warnPrecision() { if (!warnedPrecision) { warnedPrecision = true; - console.warn('CBOR 64-bit integer array values may lose precision. No further warnings.'); + console.warn( + 'CBOR 64-bit integer array values may lose precision. No further warnings.' + ); } } /** * Unpack 64-bit unsigned integer from byte array. * @param {Uint8Array} bytes -*/ + */ function decodeUint64LE(bytes) { warnPrecision(); @@ -28,7 +30,7 @@ function decodeUint64LE(bytes) { for (var i = 0; i < arrLen; i++) { var si = i * 2; var lo = uint32View[si]; - var hi = uint32View[si+1]; + var hi = uint32View[si + 1]; arr[i] = lo + UPPER32 * hi; } @@ -38,7 +40,7 @@ function decodeUint64LE(bytes) { /** * Unpack 64-bit signed integer from byte array. * @param {Uint8Array} bytes -*/ + */ function decodeInt64LE(bytes) { warnPrecision(); @@ -54,7 +56,7 @@ function decodeInt64LE(bytes) { for (var i = 0; i < arrLen; i++) { var si = i * 2; var lo = uint32View[si]; - var hi = int32View[si+1]; + var hi = int32View[si + 1]; arr[i] = lo + UPPER32 * hi; } @@ -65,7 +67,7 @@ function decodeInt64LE(bytes) { * Unpack typed array from byte array. * @param {Uint8Array} bytes * @param {ArrayConstructor} ArrayType - Desired output array type -*/ + */ function decodeNativeArray(bytes, ArrayType) { var byteLen = bytes.byteLength; var offset = bytes.byteOffset; diff --git a/src/util/decompressPng.js b/src/util/decompressPng.js index 32a536d55..687f8865b 100644 --- a/src/util/decompressPng.js +++ b/src/util/decompressPng.js @@ -23,8 +23,8 @@ var pngparse = require('pngparse'); function decompressPng(data, callback) { var buffer = new Buffer(data, 'base64'); - pngparse.parse(buffer, function(err, data) { - if(err) { + pngparse.parse(buffer, function (err, data) { + if (err) { console.warn('Cannot process PNG encoded message '); } else { var jsonData = data.data.toString(); diff --git a/src/util/shim/canvas.js b/src/util/shim/canvas.js index 15845d668..8fdbf5a66 100644 --- a/src/util/shim/canvas.js +++ b/src/util/shim/canvas.js @@ -1,4 +1,4 @@ /* global document */ module.exports = function Canvas() { - return document.createElement('canvas'); -}; \ No newline at end of file + return document.createElement('canvas'); +}; diff --git a/src/util/shim/decompressPng.js b/src/util/shim/decompressPng.js index ac5ce623a..6acdd011e 100644 --- a/src/util/shim/decompressPng.js +++ b/src/util/shim/decompressPng.js @@ -26,7 +26,7 @@ function decompressPng(data, callback) { // Uncompresses the data before sending it through (use image/canvas to do so). var image = new Image(); // When the image loads, extracts the raw data (JSON message). - image.onload = function() { + image.onload = function () { // Creates a local canvas to draw on. var canvas = new Canvas(); var context = canvas.getContext('2d'); @@ -49,7 +49,11 @@ function decompressPng(data, callback) { var jsonData = ''; for (var i = 0; i < imageData.length; i += 4) { // RGB - jsonData += String.fromCharCode(imageData[i], imageData[i + 1], imageData[i + 2]); + jsonData += String.fromCharCode( + imageData[i], + imageData[i + 1], + imageData[i + 2] + ); } callback(JSON.parse(jsonData)); }; diff --git a/src/util/workerSocket.js b/src/util/workerSocket.js index 60bab5cfa..8c0b96e39 100644 --- a/src/util/workerSocket.js +++ b/src/util/workerSocket.js @@ -1,10 +1,10 @@ try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now - var work = require("webworkify"); -} catch(ReferenceError) { + var work = require('webworkify'); +} catch (ReferenceError) { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now // webworkify raises ReferenceError when required inside webpack - var work = require("webworkify-webpack"); + var work = require('webworkify-webpack'); } var workerSocketImpl = require('./workerSocketImpl'); @@ -13,30 +13,30 @@ class WorkerSocket { this.socket_ = work(workerSocketImpl); this.socket_.addEventListener( - "message", + 'message', this.handleWorkerMessage_.bind(this) ); this.socket_.postMessage({ - uri: uri, + uri: uri }); } handleWorkerMessage_(ev) { var data = ev.data; - if (data instanceof ArrayBuffer || typeof data === "string") { + if (data instanceof ArrayBuffer || typeof data === 'string') { // binary or JSON message from rosbridge this.onmessage(ev); } else { // control message from the wrapped WebSocket var type = data.type; - if (type === "close") { + if (type === 'close') { this.onclose(null); - } else if (type === "open") { + } else if (type === 'open') { this.onopen(null); - } else if (type === "error") { + } else if (type === 'error') { this.onerror(null); } else { - throw "Unknown message from workersocket"; + throw 'Unknown message from workersocket'; } } } @@ -45,12 +45,9 @@ class WorkerSocket { } close() { this.socket_.postMessage({ - close: true, + close: true }); } } - - - module.exports = WorkerSocket; diff --git a/src/util/workerSocketImpl.js b/src/util/workerSocketImpl.js index 07c49de0c..bfcc98828 100644 --- a/src/util/workerSocketImpl.js +++ b/src/util/workerSocketImpl.js @@ -1,6 +1,6 @@ var WebSocket = WebSocket || require('ws'); -module.exports = function(self) { +module.exports = function (self) { var socket = null; function handleSocketMessage(ev) { @@ -16,10 +16,10 @@ module.exports = function(self) { } function handleSocketControl(ev) { - self.postMessage({type: ev.type}); + self.postMessage({ type: ev.type }); } - self.addEventListener('message', function(ev) { + self.addEventListener('message', function (ev) { var data = ev.data; if (typeof data === 'string') { From 2e42eb1485d4f6590b938d797ee88cc6ee6f3c1e Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 09:06:10 -0700 Subject: [PATCH 21/66] Bump esversion in jshint, decrease it in tsconfig --- .jshintrc | 4 +++- tsconfig.json | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.jshintrc b/.jshintrc index 596f0c1d2..1391a0a8e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -22,6 +22,8 @@ "trailing": true, "quotmark": "single", "proto": true, - "laxbreak": true + "laxbreak": true, + // TypeScript will compile down to es5. + "esversion": 8 } diff --git a/tsconfig.json b/tsconfig.json index b38a2eb77..ea90ddba8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ @@ -25,8 +25,8 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - "rootDir": "./src", /* Specify the root folder within your source files. */ + "module": "commonjs" /* Specify what module code is generated. */, + "rootDir": "./src" /* Specify the root folder within your source files. */, // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ @@ -44,8 +44,8 @@ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */, + "checkJs": true /* Enable error reporting in type-checked JavaScript files. */, // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ @@ -55,7 +55,7 @@ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./tsbuild", /* Specify an output folder for all emitted files. */ + "outDir": "./tsbuild" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -77,13 +77,13 @@ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */, // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ @@ -104,7 +104,7 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "include": ["src"] } From 5a4ec4477ad4ad44d879dacf3ffe1c5697bffbe3 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 09:14:58 -0700 Subject: [PATCH 22/66] make jshint happy about "confusing pluses" --- src/core/Service.js | 2 +- src/core/Topic.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/Service.js b/src/core/Service.js index d60da469b..dadc1f27a 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -50,7 +50,7 @@ class Service extends EventEmitter2 { } var serviceCallId = - 'call_service:' + this.name + ':' + ++this.ros.idCounter; + 'call_service:' + this.name + ':' + (++this.ros.idCounter).toString(); if (callback || failedCallback) { this.ros.once(serviceCallId, function (message) { diff --git a/src/core/Topic.js b/src/core/Topic.js index 8a32e43ae..64c0ccdbb 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -110,7 +110,8 @@ class Topic extends EventEmitter2 { return; } this.ros.on(this.name, this._messageCallback); - this.subscribeId = 'subscribe:' + this.name + ':' + ++this.ros.idCounter; + this.subscribeId = + 'subscribe:' + this.name + ':' + (++this.ros.idCounter).toString(); this.callForSubscribeAndAdvertise({ op: 'subscribe', @@ -162,7 +163,8 @@ class Topic extends EventEmitter2 { if (this.isAdvertised) { return; } - this.advertiseId = 'advertise:' + this.name + ':' + ++this.ros.idCounter; + this.advertiseId = + 'advertise:' + this.name + ':' + (++this.ros.idCounter).toString(); this.callForSubscribeAndAdvertise({ op: 'advertise', id: this.advertiseId, From 2515fb82f2c253a77066112835153c5922b687b7 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 09:29:46 -0700 Subject: [PATCH 23/66] Fix URDF tests with a quick hack --- src/urdf/UrdfModel.js | 4 +++- src/urdf/UrdfVisual.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index 598db8739..42d789d56 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -44,7 +44,9 @@ class UrdfModel { this.name = robotXml.getAttribute('name'); // Parse all the visual elements we need - for (var nodes = robotXml.children, i = 0; i < nodes.length; i++) { + for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { + /** @type {Element} */ + // @ts-expect-error -- unknown why this doesn't work properly. var node = nodes[i]; if (node.tagName === 'material') { var material = new UrdfMaterial({ diff --git a/src/urdf/UrdfVisual.js b/src/urdf/UrdfVisual.js index d62808a9d..b04ee513d 100644 --- a/src/urdf/UrdfVisual.js +++ b/src/urdf/UrdfVisual.js @@ -93,8 +93,10 @@ class UrdfVisual { var geom = geoms[0]; var shape = null; // Check for the shape - for (var i = 0; i < geom.children.length; i++) { - var node = geom.children[i]; + for (var i = 0; i < geom.childNodes.length; i++) { + /** @type {Element} */ + // @ts-expect-error -- unknown why this doesn't work properly. + var node = geom.childNodes[i]; if (node.nodeType === 1) { shape = node; break; From 787b89a81ab62c2fb27accacf605c64c93397868 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 14:48:43 -0700 Subject: [PATCH 24/66] less overzealous removal of `options || {}` --- src/actionlib/ActionClient.js | 1 - src/actionlib/ActionListener.js | 1 - src/actionlib/SimpleActionServer.js | 1 - src/core/Param.js | 1 - src/core/Service.js | 1 - src/core/Topic.js | 1 - src/math/Transform.js | 1 - src/tf/TFClient.js | 1 - src/urdf/UrdfModel.js | 1 - 9 files changed, 9 deletions(-) diff --git a/src/actionlib/ActionClient.js b/src/actionlib/ActionClient.js index 51cfe432c..6a9f5ad60 100644 --- a/src/actionlib/ActionClient.js +++ b/src/actionlib/ActionClient.js @@ -32,7 +32,6 @@ class ActionClient extends EventEmitter2 { constructor(options) { super(); var that = this; - options = options || {}; this.ros = options.ros; this.serverName = options.serverName; this.actionName = options.actionName; diff --git a/src/actionlib/ActionListener.js b/src/actionlib/ActionListener.js index f3a389184..06f212459 100644 --- a/src/actionlib/ActionListener.js +++ b/src/actionlib/ActionListener.js @@ -29,7 +29,6 @@ class ActionListener extends EventEmitter2 { constructor(options) { super(); var that = this; - options = options || {}; this.ros = options.ros; this.serverName = options.serverName; this.actionName = options.actionName; diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index cd3db856e..311e4ffd3 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -25,7 +25,6 @@ class SimpleActionServer extends EventEmitter2 { constructor(options) { super(); var that = this; - options = options || {}; this.ros = options.ros; this.serverName = options.serverName; this.actionName = options.actionName; diff --git a/src/core/Param.js b/src/core/Param.js index 7f199997d..6ce6c0a7a 100644 --- a/src/core/Param.js +++ b/src/core/Param.js @@ -17,7 +17,6 @@ class Param { * @param {string} options.name - The param name, like max_vel_x. */ constructor(options) { - options = options || {}; this.ros = options.ros; this.name = options.name; } diff --git a/src/core/Service.js b/src/core/Service.js index dadc1f27a..28915f8fc 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -20,7 +20,6 @@ class Service extends EventEmitter2 { */ constructor(options) { super(); - options = options || {}; this.ros = options.ros; this.name = options.name; this.serviceType = options.serviceType; diff --git a/src/core/Topic.js b/src/core/Topic.js index 64c0ccdbb..56be6c08b 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -29,7 +29,6 @@ class Topic extends EventEmitter2 { */ constructor(options) { super(); - options = options || {}; this.ros = options.ros; this.name = options.name; this.messageType = options.messageType; diff --git a/src/math/Transform.js b/src/math/Transform.js index b6390764e..de25c36f6 100644 --- a/src/math/Transform.js +++ b/src/math/Transform.js @@ -16,7 +16,6 @@ class Transform { * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. */ constructor(options) { - options = options || {}; // Copy the values into this object if they exist this.translation = new Vector3(options.translation); this.rotation = new Quaternion(options.rotation); diff --git a/src/tf/TFClient.js b/src/tf/TFClient.js index fa6b3130c..427471feb 100644 --- a/src/tf/TFClient.js +++ b/src/tf/TFClient.js @@ -34,7 +34,6 @@ class TFClient extends EventEmitter2 { */ constructor(options) { super(); - options = options || {}; this.ros = options.ros; this.fixedFrame = options.fixedFrame || 'base_link'; this.angularThres = options.angularThres || 2.0; diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index 42d789d56..d05be328a 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -22,7 +22,6 @@ class UrdfModel { * @param {string} options.string - The XML element to parse as a string. */ constructor(options) { - options = options || {}; var xmlDoc = options.xml; var string = options.string; this.materials = {}; From 57f333220cfaf97c9aa23d8d22e7b02166d36b0c Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 11:08:42 -0700 Subject: [PATCH 25/66] add typescript to grunt --- Gruntfile.js | 9 +- build/roslib.js | 25877 ++++++++++++++++++++++++++++++++++-------- build/roslib.min.js | 2 +- package-lock.json | 112 +- package.json | 1 + 5 files changed, 21415 insertions(+), 4586 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 367fa59f8..7266ec6c0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,9 +10,14 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), + shell: { + ts: { + command: 'tsc -p .' + } + }, browserify: { dist: { - src: ['./src/RosLibBrowser.js'], + src: ['./tsbuild/RosLibBrowser.js'], dest: './build/roslib.js' } }, @@ -117,7 +122,7 @@ module.exports = function(grunt) { grunt.registerTask('test-examples', ['mochaTest:examples', 'karma:examples']); grunt.registerTask('test-tcp', ['mochaTest:tcp']); grunt.registerTask('test-workersocket', ['karma:workersocket']); - grunt.registerTask('build', ['browserify', 'uglify']); + grunt.registerTask('build', ['shell', 'browserify', 'uglify']); grunt.registerTask('build_and_watch', ['watch']); grunt.registerTask('doc', ['clean', 'jsdoc']); }; diff --git a/build/roslib.js b/build/roslib.js index 17ef1fecf..21518b7ba 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -1,4 +1,4194 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i + * @license MIT + */ +function compare(a, b) { + 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; +} +function isBuffer(b) { + if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { + return global.Buffer.isBuffer(b); + } + return !!(b != null && b._isBuffer); +} + +// based on node assert, original notice: +// NB: The URL to the CommonJS spec is kept just for tradition. +// node-assert has evolved a lot since then, both in API and behavior. + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.com> +// +// 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 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. + +var util = require('util/'); +var hasOwn = Object.prototype.hasOwnProperty; +var pSlice = Array.prototype.slice; +var functionsHaveNames = (function () { + return function foo() {}.name === 'foo'; +}()); +function pToString (obj) { + return Object.prototype.toString.call(obj); +} +function isView(arrbuf) { + if (isBuffer(arrbuf)) { + return false; + } + if (typeof global.ArrayBuffer !== 'function') { + return false; + } + if (typeof ArrayBuffer.isView === 'function') { + return ArrayBuffer.isView(arrbuf); + } + if (!arrbuf) { + return false; + } + if (arrbuf instanceof DataView) { + return true; + } + if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { + return true; + } + return false; +} +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({ message: message, +// actual: actual, +// expected: expected }) + +var regex = /\s*function\s+([^\(\s]*)\s*/; +// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js +function getName(func) { + if (!util.isFunction(func)) { + return; + } + if (functionsHaveNames) { + return func.name; + } + var str = func.toString(); + var match = str.match(regex); + return match && match[1]; +} +assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = getName(stackStartFunction); + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } +}; + +// assert.AssertionError instanceof Error +util.inherits(assert.AssertionError, Error); + +function truncate(s, n) { + if (typeof s === 'string') { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } +} +function inspect(something) { + if (functionsHaveNames || !util.isFunction(something)) { + return util.inspect(something); + } + var rawname = getName(something); + var name = rawname ? ': ' + rawname : ''; + return '[Function' + name + ']'; +} +function getMessage(self) { + return truncate(inspect(self.actual), 128) + ' ' + + self.operator + ' ' + + truncate(inspect(self.expected), 128); +} + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, !!guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); +} +assert.ok = ok; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } +}; + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + } +}; + +function _deepEqual(actual, expected, strict, memos) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if (isBuffer(actual) && isBuffer(expected)) { + return compare(actual, expected) === 0; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if ((actual === null || typeof actual !== 'object') && + (expected === null || typeof expected !== 'object')) { + return strict ? actual === expected : actual == expected; + + // If both values are instances of typed arrays, wrap their underlying + // ArrayBuffers in a Buffer each to increase performance + // This optimization requires the arrays to have the same type as checked by + // Object.prototype.toString (aka pToString). Never perform binary + // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their + // bit patterns are not identical. + } else if (isView(actual) && isView(expected) && + pToString(actual) === pToString(expected) && + !(actual instanceof Float32Array || + actual instanceof Float64Array)) { + return compare(new Uint8Array(actual.buffer), + new Uint8Array(expected.buffer)) === 0; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else if (isBuffer(actual) !== isBuffer(expected)) { + return false; + } else { + memos = memos || {actual: [], expected: []}; + + var actualIndex = memos.actual.indexOf(actual); + if (actualIndex !== -1) { + if (actualIndex === memos.expected.indexOf(expected)) { + return true; + } + } + + memos.actual.push(actual); + memos.expected.push(expected); + + return objEquiv(actual, expected, strict, memos); + } +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv(a, b, strict, actualVisitedObjects) { + if (a === null || a === undefined || b === null || b === undefined) + return false; + // if one is a primitive, the other must be same + if (util.isPrimitive(a) || util.isPrimitive(b)) + return a === b; + if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) + return false; + var aIsArgs = isArguments(a); + var bIsArgs = isArguments(b); + if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) + return false; + if (aIsArgs) { + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b, strict); + } + var ka = objectKeys(a); + var kb = objectKeys(b); + var key, i; + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length !== kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] !== kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } +}; + +assert.notDeepStrictEqual = notDeepStrictEqual; +function notDeepStrictEqual(actual, expected, message) { + if (_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + } +} + + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as +// determined by !==. assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } + + try { + if (actual instanceof expected) { + return true; + } + } catch (e) { + // Ignore. The instanceof check doesn't work for arrow functions. + } + + if (Error.isPrototypeOf(expected)) { + return false; + } + + return expected.call({}, actual) === true; +} + +function _tryBlock(block) { + var error; + try { + block(); + } catch (e) { + error = e; + } + return error; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof block !== 'function') { + throw new TypeError('"block" argument must be a function'); + } + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + actual = _tryBlock(block); + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + var userProvidedMessage = typeof message === 'string'; + var isUnwantedException = !shouldThrow && util.isError(actual); + var isUnexpectedException = !shouldThrow && actual && !expected; + + if ((isUnwantedException && + userProvidedMessage && + expectedException(actual, expected)) || + isUnexpectedException) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws(true, block, error, message); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws(false, block, error, message); +}; + +assert.ifError = function(err) { if (err) throw err; }; + +// Expose a strict only variant of assert +function strict(value, message) { + if (!value) fail(value, true, message, '==', strict); +} +assert.strict = objectAssign(strict, assert, { + equal: assert.strictEqual, + deepEqual: assert.deepStrictEqual, + notEqual: assert.notStrictEqual, + notDeepEqual: assert.notDeepStrictEqual +}); +assert.strict.strict = assert.strict; + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"object-assign":31,"util/":4}],2:[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 + } +} + +},{}],3:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],4:[function(require,module,exports){ +(function (process,global){(function (){ +// 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. + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +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 isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (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 = require('./support/isBuffer'); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":3,"_process":44,"inherits":2}],5:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var possibleNames = [ + 'BigInt64Array', + 'BigUint64Array', + 'Float32Array', + 'Float64Array', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray' +]; + +var g = typeof globalThis === 'undefined' ? global : globalThis; + +module.exports = function availableTypedArrays() { + var out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + out[out.length] = possibleNames[i]; + } + } + return out; +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],6:[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 +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = 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) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + 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 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] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + +},{}],7:[function(require,module,exports){ + +},{}],8:[function(require,module,exports){ +(function (process,Buffer){(function (){ +'use strict'; +/* eslint camelcase: "off" */ + +var assert = require('assert'); + +var Zstream = require('pako/lib/zlib/zstream'); +var zlib_deflate = require('pako/lib/zlib/deflate.js'); +var zlib_inflate = require('pako/lib/zlib/inflate.js'); +var constants = require('pako/lib/zlib/constants'); + +for (var key in constants) { + exports[key] = constants[key]; +} + +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; + +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; + +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); + } + + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; +} + +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; + } + + this.pending_close = false; + + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); + + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); + } + + this.mode = exports.NONE; + + this.dictionary = null; +}; + +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); + + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); + + this.write_in_progress = true; + + assert.equal(false, flush === undefined, 'must provide flush value'); + + this.write_in_progress = true; + + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); + } + + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; + } + + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; + + if (!async) { + // sync version + this._process(); + + if (this._checkError()) { + return this._afterSync(); + } + return; + } + + // async version + var self = this; + process.nextTick(function () { + self._process(); + self._after(); + }); + + return this; +}; + +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + return [avail_in, avail_out]; +}; + +Zlib.prototype._process = function () { + var next_expected_header_byte = null; + + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } + + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; + + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } + + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } + + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } + + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush + + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. + + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; + +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } + + return true; +}; + +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } + + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + // call the write() cb + this.callback(avail_in, avail_out); + + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; + } + this.onerror(message, this.err + + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); + + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); + + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); + + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); + + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); +}; + +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; + +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; + +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; + + this.flush = exports.Z_NO_FLUSH; + + this.err = exports.Z_OK; + + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } + + if (this.mode === exports.UNZIP) { + this.windowBits += 32; + } + + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } + + this.strm = new Zstream(); + + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); + } + + if (this.err !== exports.Z_OK) { + this._error('Init error'); + } + + this.dictionary = dictionary; + + this.write_in_progress = false; + this.init_done = true; +}; + +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; + } + + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); + } +}; + +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); + } +}; + +exports.Zlib = Zlib; +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":44,"assert":1,"buffer":11,"pako/lib/zlib/constants":34,"pako/lib/zlib/deflate.js":36,"pako/lib/zlib/inflate.js":38,"pako/lib/zlib/zstream":42}],9:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +var Buffer = require('buffer').Buffer; +var Transform = require('stream').Transform; +var binding = require('./binding'); +var util = require('util'); +var assert = require('assert').ok; +var kMaxLength = require('buffer').kMaxLength; +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; + +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; + +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; + +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; + +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); + } +} + +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; + +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} + +Object.defineProperty(exports, 'codes', { + enumerable: true, value: Object.freeze(codes), writable: false +}); + +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; + +exports.createDeflate = function (o) { + return new Deflate(o); +}; + +exports.createInflate = function (o) { + return new Inflate(o); +}; + +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); +}; + +exports.createInflateRaw = function (o) { + return new InflateRaw(o); +}; + +exports.createGzip = function (o) { + return new Gzip(o); +}; + +exports.createGunzip = function (o) { + return new Gunzip(o); +}; + +exports.createUnzip = function (o) { + return new Unzip(o); +}; + +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; + +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; + +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; + +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; + +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; + +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; + +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; + +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); +}; + +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; + +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; + +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); +}; + +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; + +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; + +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; + +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; + + engine.on('error', onError); + engine.on('end', onEnd); + + engine.end(buffer); + flow(); + + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } + + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } + + function onEnd() { + var buf; + var err = null; + + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } + + buffers = []; + engine.close(); + callback(err, buf); + } +} + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); + + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); + + var flushFlag = engine._finishFlushFlag; + + return engine._processChunk(buffer, flushFlag); +} + +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} + +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} + +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} + +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} + +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} + +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} + +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} + +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. + +function Zlib(opts, mode) { + var _this = this; + + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; + + Transform.call(this, opts); + + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); + } + + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } + } + + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } + } + + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } + } + + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } + + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } + } + + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } + } + + this._handle = new binding.Zlib(mode); + + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; + + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; + + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; + + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; + + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); + } + + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + process.nextTick(callback); + } +}; + +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; + +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; + +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; + + var ws = this._writableState; + + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } + + if (ws.ended) { + if (callback) process.nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); + } + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); + } +}; + +Zlib.prototype.close = function (callback) { + _close(this, callback); + process.nextTick(emitCloseNT, this); +}; + +function _close(engine, callback) { + if (callback) process.nextTick(callback); + + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; + + engine._handle.close(); + engine._handle = null; +} + +function emitCloseNT(self) { + self.emit('close'); +} + +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); + + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); + + if (!this._handle) return cb(new Error('zlib binding closed')); + + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } + + this._processChunk(chunk, flushFlag, cb); +}; + +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; + + var self = this; + + var async = typeof cb === 'function'; + + if (!async) { + var buffers = []; + var nread = 0; + + var error; + this.on('error', function (er) { + error = er; + }); + + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } + + var buf = Buffer.concat(buffers, nread); + _close(this); + + return buf; + } + + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + + req.buffer = chunk; + req.callback = callback; + + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } + + if (self._hadError) return; + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } + + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } + + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; + + if (!async) return true; + + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; + } + + if (!async) return false; + + // finished with the chunk. + cb(); + } +}; + +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); +}).call(this)}).call(this,require('_process')) +},{"./binding":8,"_process":44,"assert":1,"buffer":11,"stream":46,"util":66}],10:[function(require,module,exports){ +arguments[4][7][0].apply(exports,arguments) +},{"dup":7}],11:[function(require,module,exports){ +(function (Buffer){(function (){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @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 + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // 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 TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + 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 != null && + 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 === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) + } + + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + var b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof 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 of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +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('Unknown encoding: ' + 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 outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer 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.length !== undefined) { + 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) + } +} + +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 && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + 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 (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) + } + 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 (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && 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': + 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 mustMatch ? -1 : 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.toLocaleString = Buffer.prototype.toString + +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 + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + 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 + } + } + + var strLen = string.length + + 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 (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + 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('Index out of range') + 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 + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + 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 (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) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } 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 + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + 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 takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // 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 +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":6,"buffer":11,"ieee754":26}],12:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; + +},{"./":13,"get-intrinsic":21}],13:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); + +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); + +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } +} + +module.exports = function callBind(originalFunction) { + var func = $reflectApply(bind, $call, arguments); + if ($gOPD && $defineProperty) { + var desc = $gOPD(func, 'length'); + if (desc.configurable) { + // original length, plus the receiver, minus any additional arguments (after the receiver) + $defineProperty( + func, + 'length', + { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } + ); + } + } + return func; +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + +},{"function-bind":20,"get-intrinsic":21}],14:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -406,1918 +4596,13154 @@ else if (!global.CBOR) })(this); -},{}],2:[function(require,module,exports){ -(function (process,setImmediate){(function (){ -/*! - * EventEmitter2 - * https://github.com/hij1nx/EventEmitter2 - * - * Copyright (c) 2013 hij1nx - * Licensed under the MIT license. - */ -;!function(undefined) { - var hasOwnProperty= Object.hasOwnProperty; - var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { - return Object.prototype.toString.call(obj) === "[object Array]"; - }; - var defaultMaxListeners = 10; - var nextTickSupported= typeof process=='object' && typeof process.nextTick=='function'; - var symbolsSupported= typeof Symbol==='function'; - var reflectSupported= typeof Reflect === 'object'; - var setImmediateSupported= typeof setImmediate === 'function'; - var _setImmediate= setImmediateSupported ? setImmediate : setTimeout; - var ownKeys= symbolsSupported? (reflectSupported && typeof Reflect.ownKeys==='function'? Reflect.ownKeys : function(obj){ - var arr= Object.getOwnPropertyNames(obj); - arr.push.apply(arr, Object.getOwnPropertySymbols(obj)); - return arr; - }) : Object.keys; +},{}],15:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + +},{"get-intrinsic":21}],16:[function(require,module,exports){ +(function (process,setImmediate){(function (){ +/*! + * EventEmitter2 + * https://github.com/hij1nx/EventEmitter2 + * + * Copyright (c) 2013 hij1nx + * Licensed under the MIT license. + */ +;!function(undefined) { + var hasOwnProperty= Object.hasOwnProperty; + var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + var defaultMaxListeners = 10; + var nextTickSupported= typeof process=='object' && typeof process.nextTick=='function'; + var symbolsSupported= typeof Symbol==='function'; + var reflectSupported= typeof Reflect === 'object'; + var setImmediateSupported= typeof setImmediate === 'function'; + var _setImmediate= setImmediateSupported ? setImmediate : setTimeout; + var ownKeys= symbolsSupported? (reflectSupported && typeof Reflect.ownKeys==='function'? Reflect.ownKeys : function(obj){ + var arr= Object.getOwnPropertyNames(obj); + arr.push.apply(arr, Object.getOwnPropertySymbols(obj)); + return arr; + }) : Object.keys; + + function init() { + this._events = {}; + if (this._conf) { + configure.call(this, this._conf); + } + } + + function configure(conf) { + if (conf) { + this._conf = conf; + + conf.delimiter && (this.delimiter = conf.delimiter); + + if(conf.maxListeners!==undefined){ + this._maxListeners= conf.maxListeners; + } + + conf.wildcard && (this.wildcard = conf.wildcard); + conf.newListener && (this._newListener = conf.newListener); + conf.removeListener && (this._removeListener = conf.removeListener); + conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak); + conf.ignoreErrors && (this.ignoreErrors = conf.ignoreErrors); + + if (this.wildcard) { + this.listenerTree = {}; + } + } + } + + function logPossibleMemoryLeak(count, eventName) { + var errorMsg = '(node) warning: possible EventEmitter memory ' + + 'leak detected. ' + count + ' listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.'; + + if(this.verboseMemoryLeak){ + errorMsg += ' Event name: ' + eventName + '.'; + } + + if(typeof process !== 'undefined' && process.emitWarning){ + var e = new Error(errorMsg); + e.name = 'MaxListenersExceededWarning'; + e.emitter = this; + e.count = count; + process.emitWarning(e); + } else { + console.error(errorMsg); + + if (console.trace){ + console.trace(); + } + } + } + + var toArray = function (a, b, c) { + var n = arguments.length; + switch (n) { + case 0: + return []; + case 1: + return [a]; + case 2: + return [a, b]; + case 3: + return [a, b, c]; + default: + var arr = new Array(n); + while (n--) { + arr[n] = arguments[n]; + } + return arr; + } + }; + + function toObject(keys, values) { + var obj = {}; + var key; + var len = keys.length; + var valuesCount = values ? value.length : 0; + for (var i = 0; i < len; i++) { + key = keys[i]; + obj[key] = i < valuesCount ? values[i] : undefined; + } + return obj; + } + + function TargetObserver(emitter, target, options) { + this._emitter = emitter; + this._target = target; + this._listeners = {}; + this._listenersCount = 0; + + var on, off; + + if (options.on || options.off) { + on = options.on; + off = options.off; + } + + if (target.addEventListener) { + on = target.addEventListener; + off = target.removeEventListener; + } else if (target.addListener) { + on = target.addListener; + off = target.removeListener; + } else if (target.on) { + on = target.on; + off = target.off; + } + + if (!on && !off) { + throw Error('target does not implement any known event API'); + } + + if (typeof on !== 'function') { + throw TypeError('on method must be a function'); + } + + if (typeof off !== 'function') { + throw TypeError('off method must be a function'); + } + + this._on = on; + this._off = off; + + var _observers= emitter._observers; + if(_observers){ + _observers.push(this); + }else{ + emitter._observers= [this]; + } + } + + Object.assign(TargetObserver.prototype, { + subscribe: function(event, localEvent, reducer){ + var observer= this; + var target= this._target; + var emitter= this._emitter; + var listeners= this._listeners; + var handler= function(){ + var args= toArray.apply(null, arguments); + var eventObj= { + data: args, + name: localEvent, + original: event + }; + if(reducer){ + var result= reducer.call(target, eventObj); + if(result!==false){ + emitter.emit.apply(emitter, [eventObj.name].concat(args)) + } + return; + } + emitter.emit.apply(emitter, [localEvent].concat(args)); + }; + + + if(listeners[event]){ + throw Error('Event \'' + event + '\' is already listening'); + } + + this._listenersCount++; + + if(emitter._newListener && emitter._removeListener && !observer._onNewListener){ + + this._onNewListener = function (_event) { + if (_event === localEvent && listeners[event] === null) { + listeners[event] = handler; + observer._on.call(target, event, handler); + } + }; + + emitter.on('newListener', this._onNewListener); + + this._onRemoveListener= function(_event){ + if(_event === localEvent && !emitter.hasListeners(_event) && listeners[event]){ + listeners[event]= null; + observer._off.call(target, event, handler); + } + }; + + listeners[event]= null; + + emitter.on('removeListener', this._onRemoveListener); + }else{ + listeners[event]= handler; + observer._on.call(target, event, handler); + } + }, + + unsubscribe: function(event){ + var observer= this; + var listeners= this._listeners; + var emitter= this._emitter; + var handler; + var events; + var off= this._off; + var target= this._target; + var i; + + if(event && typeof event!=='string'){ + throw TypeError('event must be a string'); + } + + function clearRefs(){ + if(observer._onNewListener){ + emitter.off('newListener', observer._onNewListener); + emitter.off('removeListener', observer._onRemoveListener); + observer._onNewListener= null; + observer._onRemoveListener= null; + } + var index= findTargetIndex.call(emitter, observer); + emitter._observers.splice(index, 1); + } + + if(event){ + handler= listeners[event]; + if(!handler) return; + off.call(target, event, handler); + delete listeners[event]; + if(!--this._listenersCount){ + clearRefs(); + } + }else{ + events= ownKeys(listeners); + i= events.length; + while(i-->0){ + event= events[i]; + off.call(target, event, listeners[event]); + } + this._listeners= {}; + this._listenersCount= 0; + clearRefs(); + } + } + }); + + function resolveOptions(options, schema, reducers, allowUnknown) { + var computedOptions = Object.assign({}, schema); + + if (!options) return computedOptions; + + if (typeof options !== 'object') { + throw TypeError('options must be an object') + } + + var keys = Object.keys(options); + var length = keys.length; + var option, value; + var reducer; + + function reject(reason) { + throw Error('Invalid "' + option + '" option value' + (reason ? '. Reason: ' + reason : '')) + } + + for (var i = 0; i < length; i++) { + option = keys[i]; + if (!allowUnknown && !hasOwnProperty.call(schema, option)) { + throw Error('Unknown "' + option + '" option'); + } + value = options[option]; + if (value !== undefined) { + reducer = reducers[option]; + computedOptions[option] = reducer ? reducer(value, reject) : value; + } + } + return computedOptions; + } + + function constructorReducer(value, reject) { + if (typeof value !== 'function' || !value.hasOwnProperty('prototype')) { + reject('value must be a constructor'); + } + return value; + } + + function makeTypeReducer(types) { + var message= 'value must be type of ' + types.join('|'); + var len= types.length; + var firstType= types[0]; + var secondType= types[1]; + + if (len === 1) { + return function (v, reject) { + if (typeof v === firstType) { + return v; + } + reject(message); + } + } + + if (len === 2) { + return function (v, reject) { + var kind= typeof v; + if (kind === firstType || kind === secondType) return v; + reject(message); + } + } + + return function (v, reject) { + var kind = typeof v; + var i = len; + while (i-- > 0) { + if (kind === types[i]) return v; + } + reject(message); + } + } + + var functionReducer= makeTypeReducer(['function']); + + var objectFunctionReducer= makeTypeReducer(['object', 'function']); + + function makeCancelablePromise(Promise, executor, options) { + var isCancelable; + var callbacks; + var timer= 0; + var subscriptionClosed; + + var promise = new Promise(function (resolve, reject, onCancel) { + options= resolveOptions(options, { + timeout: 0, + overload: false + }, { + timeout: function(value, reject){ + value*= 1; + if (typeof value !== 'number' || value < 0 || !Number.isFinite(value)) { + reject('timeout must be a positive number'); + } + return value; + } + }); + + isCancelable = !options.overload && typeof Promise.prototype.cancel === 'function' && typeof onCancel === 'function'; + + function cleanup() { + if (callbacks) { + callbacks = null; + } + if (timer) { + clearTimeout(timer); + timer = 0; + } + } + + var _resolve= function(value){ + cleanup(); + resolve(value); + }; + + var _reject= function(err){ + cleanup(); + reject(err); + }; + + if (isCancelable) { + executor(_resolve, _reject, onCancel); + } else { + callbacks = [function(reason){ + _reject(reason || Error('canceled')); + }]; + executor(_resolve, _reject, function (cb) { + if (subscriptionClosed) { + throw Error('Unable to subscribe on cancel event asynchronously') + } + if (typeof cb !== 'function') { + throw TypeError('onCancel callback must be a function'); + } + callbacks.push(cb); + }); + subscriptionClosed= true; + } + + if (options.timeout > 0) { + timer= setTimeout(function(){ + var reason= Error('timeout'); + reason.code = 'ETIMEDOUT' + timer= 0; + promise.cancel(reason); + reject(reason); + }, options.timeout); + } + }); + + if (!isCancelable) { + promise.cancel = function (reason) { + if (!callbacks) { + return; + } + var length = callbacks.length; + for (var i = 1; i < length; i++) { + callbacks[i](reason); + } + // internal callback to reject the promise + callbacks[0](reason); + callbacks = null; + }; + } + + return promise; + } + + function findTargetIndex(observer) { + var observers = this._observers; + if(!observers){ + return -1; + } + var len = observers.length; + for (var i = 0; i < len; i++) { + if (observers[i]._target === observer) return i; + } + return -1; + } + + // Attention, function return type now is array, always ! + // It has zero elements if no any matches found and one or more + // elements (leafs) if there are matches + // + function searchListenerTree(handlers, type, tree, i, typeLength) { + if (!tree) { + return null; + } + + if (i === 0) { + var kind = typeof type; + if (kind === 'string') { + var ns, n, l = 0, j = 0, delimiter = this.delimiter, dl = delimiter.length; + if ((n = type.indexOf(delimiter)) !== -1) { + ns = new Array(5); + do { + ns[l++] = type.slice(j, n); + j = n + dl; + } while ((n = type.indexOf(delimiter, j)) !== -1); + + ns[l++] = type.slice(j); + type = ns; + typeLength = l; + } else { + type = [type]; + typeLength = 1; + } + } else if (kind === 'object') { + typeLength = type.length; + } else { + type = [type]; + typeLength = 1; + } + } + + var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], + nextType = type[i + 1], branches, _listeners; + + if (i === typeLength) { + // + // If at the end of the event(s) list and the tree has listeners + // invoke those listeners. + // + + if(tree._listeners) { + if (typeof tree._listeners === 'function') { + handlers && handlers.push(tree._listeners); + listeners = [tree]; + } else { + handlers && handlers.push.apply(handlers, tree._listeners); + listeners = [tree]; + } + } + } else { + + if (currentType === '*') { + // + // If the event emitted is '*' at this part + // or there is a concrete match at this patch + // + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + } + return listeners; + } else if (currentType === '**') { + endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); + if (endReached && tree._listeners) { + // The next element has a _listeners, add it to the handlers. + listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); + } + + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + if (branch === '*' || branch === '**') { + if (tree[branch]._listeners && !endReached) { + _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } else if (branch === nextType) { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); + } else { + // No match on this one, shift into the tree but not in the type array. + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + } + return listeners; + } else if (tree[currentType]) { + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); + } + } + + xTree = tree['*']; + if (xTree) { + // + // If the listener tree will allow any match for this part, + // then recursively explore all branches of the tree + // + searchListenerTree(handlers, type, xTree, i + 1, typeLength); + } + + xxTree = tree['**']; + if (xxTree) { + if (i < typeLength) { + if (xxTree._listeners) { + // If we have a listener on a '**', it will catch all, so add its handler. + searchListenerTree(handlers, type, xxTree, typeLength, typeLength); + } + + // Build arrays of matching next branches and others. + branches= ownKeys(xxTree); + n= branches.length; + while(n-->0){ + branch= branches[n]; + if (branch !== '_listeners') { + if (branch === nextType) { + // We know the next element will match, so jump twice. + searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength); + } else if (branch === currentType) { + // Current node matches, move into the tree. + searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength); + } else { + isolatedBranch = {}; + isolatedBranch[branch] = xxTree[branch]; + searchListenerTree(handlers, type, {'**': isolatedBranch}, i + 1, typeLength); + } + } + } + } else if (xxTree._listeners) { + // We have reached the end and still on a '**' + searchListenerTree(handlers, type, xxTree, typeLength, typeLength); + } else if (xxTree['*'] && xxTree['*']._listeners) { + searchListenerTree(handlers, type, xxTree['*'], typeLength, typeLength); + } + } + + return listeners; + } + + function growListenerTree(type, listener, prepend) { + var len = 0, j = 0, i, delimiter = this.delimiter, dl= delimiter.length, ns; + + if(typeof type==='string') { + if ((i = type.indexOf(delimiter)) !== -1) { + ns = new Array(5); + do { + ns[len++] = type.slice(j, i); + j = i + dl; + } while ((i = type.indexOf(delimiter, j)) !== -1); + + ns[len++] = type.slice(j); + }else{ + ns= [type]; + len= 1; + } + }else{ + ns= type; + len= type.length; + } + + // + // Looks for two consecutive '**', if so, don't add the event at all. + // + if (len > 1) { + for (i = 0; i + 1 < len; i++) { + if (ns[i] === '**' && ns[i + 1] === '**') { + return; + } + } + } + + + + var tree = this.listenerTree, name; + + for (i = 0; i < len; i++) { + name = ns[i]; + + tree = tree[name] || (tree[name] = {}); + + if (i === len - 1) { + if (!tree._listeners) { + tree._listeners = listener; + } else { + if (typeof tree._listeners === 'function') { + tree._listeners = [tree._listeners]; + } + + if (prepend) { + tree._listeners.unshift(listener); + } else { + tree._listeners.push(listener); + } + + if ( + !tree._listeners.warned && + this._maxListeners > 0 && + tree._listeners.length > this._maxListeners + ) { + tree._listeners.warned = true; + logPossibleMemoryLeak.call(this, tree._listeners.length, name); + } + } + return true; + } + } + + return true; + } + + function collectTreeEvents(tree, events, root, asArray){ + var branches= ownKeys(tree); + var i= branches.length; + var branch, branchName, path; + var hasListeners= tree['_listeners']; + var isArrayPath; + + while(i-->0){ + branchName= branches[i]; + + branch= tree[branchName]; + + if(branchName==='_listeners'){ + path= root; + }else { + path = root ? root.concat(branchName) : [branchName]; + } + + isArrayPath= asArray || typeof branchName==='symbol'; + + hasListeners && events.push(isArrayPath? path : path.join(this.delimiter)); + + if(typeof branch==='object'){ + collectTreeEvents.call(this, branch, events, path, isArrayPath); + } + } + + return events; + } + + function recursivelyGarbageCollect(root) { + var keys = ownKeys(root); + var i= keys.length; + var obj, key, flag; + while(i-->0){ + key = keys[i]; + obj = root[key]; + + if(obj){ + flag= true; + if(key !== '_listeners' && !recursivelyGarbageCollect(obj)){ + delete root[key]; + } + } + } + + return flag; + } + + function Listener(emitter, event, listener){ + this.emitter= emitter; + this.event= event; + this.listener= listener; + } + + Listener.prototype.off= function(){ + this.emitter.off(this.event, this.listener); + return this; + }; + + function setupListener(event, listener, options){ + if (options === true) { + promisify = true; + } else if (options === false) { + async = true; + } else { + if (!options || typeof options !== 'object') { + throw TypeError('options should be an object or true'); + } + var async = options.async; + var promisify = options.promisify; + var nextTick = options.nextTick; + var objectify = options.objectify; + } + + if (async || nextTick || promisify) { + var _listener = listener; + var _origin = listener._origin || listener; + + if (nextTick && !nextTickSupported) { + throw Error('process.nextTick is not supported'); + } + + if (promisify === undefined) { + promisify = listener.constructor.name === 'AsyncFunction'; + } + + listener = function () { + var args = arguments; + var context = this; + var event = this.event; + + return promisify ? (nextTick ? Promise.resolve() : new Promise(function (resolve) { + _setImmediate(resolve); + }).then(function () { + context.event = event; + return _listener.apply(context, args) + })) : (nextTick ? process.nextTick : _setImmediate)(function () { + context.event = event; + _listener.apply(context, args) + }); + }; + + listener._async = true; + listener._origin = _origin; + } + + return [listener, objectify? new Listener(this, event, listener): this]; + } + + function EventEmitter(conf) { + this._events = {}; + this._newListener = false; + this._removeListener = false; + this.verboseMemoryLeak = false; + configure.call(this, conf); + } + + EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property + + EventEmitter.prototype.listenTo= function(target, events, options){ + if(typeof target!=='object'){ + throw TypeError('target musts be an object'); + } + + var emitter= this; + + options = resolveOptions(options, { + on: undefined, + off: undefined, + reducers: undefined + }, { + on: functionReducer, + off: functionReducer, + reducers: objectFunctionReducer + }); + + function listen(events){ + if(typeof events!=='object'){ + throw TypeError('events must be an object'); + } + + var reducers= options.reducers; + var index= findTargetIndex.call(emitter, target); + var observer; + + if(index===-1){ + observer= new TargetObserver(emitter, target, options); + }else{ + observer= emitter._observers[index]; + } + + var keys= ownKeys(events); + var len= keys.length; + var event; + var isSingleReducer= typeof reducers==='function'; + + for(var i=0; i 0) { + observer = observers[i]; + if (!target || observer._target === target) { + observer.unsubscribe(event); + matched= true; + } + } + + return matched; + }; + + // 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. + // + // Obviously not all Emitters should be limited to 10. This function allows + // that to be increased. Set to zero for unlimited. + + EventEmitter.prototype.delimiter = '.'; + + EventEmitter.prototype.setMaxListeners = function(n) { + if (n !== undefined) { + this._maxListeners = n; + if (!this._conf) this._conf = {}; + this._conf.maxListeners = n; + } + }; + + EventEmitter.prototype.getMaxListeners = function() { + return this._maxListeners; + }; + + EventEmitter.prototype.event = ''; + + EventEmitter.prototype.once = function(event, fn, options) { + return this._once(event, fn, false, options); + }; + + EventEmitter.prototype.prependOnceListener = function(event, fn, options) { + return this._once(event, fn, true, options); + }; + + EventEmitter.prototype._once = function(event, fn, prepend, options) { + return this._many(event, 1, fn, prepend, options); + }; + + EventEmitter.prototype.many = function(event, ttl, fn, options) { + return this._many(event, ttl, fn, false, options); + }; + + EventEmitter.prototype.prependMany = function(event, ttl, fn, options) { + return this._many(event, ttl, fn, true, options); + }; + + EventEmitter.prototype._many = function(event, ttl, fn, prepend, options) { + var self = this; + + if (typeof fn !== 'function') { + throw new Error('many only accepts instances of Function'); + } + + function listener() { + if (--ttl === 0) { + self.off(event, listener); + } + return fn.apply(this, arguments); + } + + listener._origin = fn; + + return this._on(event, listener, prepend, options); + }; + + EventEmitter.prototype.emit = function() { + if (!this._events && !this._all) { + return false; + } + + this._events || init.call(this); + + var type = arguments[0], ns, wildcard= this.wildcard; + var args,l,i,j, containsSymbol; + + if (type === 'newListener' && !this._newListener) { + if (!this._events.newListener) { + return false; + } + } + + if (wildcard) { + ns= type; + if(type!=='newListener' && type!=='removeListener'){ + if (typeof type === 'object') { + l = type.length; + if (symbolsSupported) { + for (i = 0; i < l; i++) { + if (typeof type[i] === 'symbol') { + containsSymbol = true; + break; + } + } + } + if (!containsSymbol) { + type = type.join(this.delimiter); + } + } + } + } + + var al = arguments.length; + var handler; + + if (this._all && this._all.length) { + handler = this._all.slice(); + + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + handler[i].call(this, type); + break; + case 2: + handler[i].call(this, type, arguments[1]); + break; + case 3: + handler[i].call(this, type, arguments[1], arguments[2]); + break; + default: + handler[i].apply(this, arguments); + } + } + } + + if (wildcard) { + handler = []; + searchListenerTree.call(this, handler, ns, this.listenerTree, 0, l); + } else { + handler = this._events[type]; + if (typeof handler === 'function') { + this.event = type; + switch (al) { + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + default: + args = new Array(al - 1); + for (j = 1; j < al; j++) args[j - 1] = arguments[j]; + handler.apply(this, args); + } + return true; + } else if (handler) { + // need to make copy of handlers because list can change in the middle + // of emit call + handler = handler.slice(); + } + } + + if (handler && handler.length) { + if (al > 3) { + args = new Array(al - 1); + for (j = 1; j < al; j++) args[j - 1] = arguments[j]; + } + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + handler[i].call(this); + break; + case 2: + handler[i].call(this, arguments[1]); + break; + case 3: + handler[i].call(this, arguments[1], arguments[2]); + break; + default: + handler[i].apply(this, args); + } + } + return true; + } else if (!this.ignoreErrors && !this._all && type === 'error') { + if (arguments[1] instanceof Error) { + throw arguments[1]; // Unhandled 'error' event + } else { + throw new Error("Uncaught, unspecified 'error' event."); + } + } + + return !!this._all; + }; + + EventEmitter.prototype.emitAsync = function() { + if (!this._events && !this._all) { + return false; + } + + this._events || init.call(this); + + var type = arguments[0], wildcard= this.wildcard, ns, containsSymbol; + var args,l,i,j; + + if (type === 'newListener' && !this._newListener) { + if (!this._events.newListener) { return Promise.resolve([false]); } + } + + if (wildcard) { + ns= type; + if(type!=='newListener' && type!=='removeListener'){ + if (typeof type === 'object') { + l = type.length; + if (symbolsSupported) { + for (i = 0; i < l; i++) { + if (typeof type[i] === 'symbol') { + containsSymbol = true; + break; + } + } + } + if (!containsSymbol) { + type = type.join(this.delimiter); + } + } + } + } + + var promises= []; + + var al = arguments.length; + var handler; + + if (this._all) { + for (i = 0, l = this._all.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + promises.push(this._all[i].call(this, type)); + break; + case 2: + promises.push(this._all[i].call(this, type, arguments[1])); + break; + case 3: + promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); + break; + default: + promises.push(this._all[i].apply(this, arguments)); + } + } + } + + if (wildcard) { + handler = []; + searchListenerTree.call(this, handler, ns, this.listenerTree, 0); + } else { + handler = this._events[type]; + } + + if (typeof handler === 'function') { + this.event = type; + switch (al) { + case 1: + promises.push(handler.call(this)); + break; + case 2: + promises.push(handler.call(this, arguments[1])); + break; + case 3: + promises.push(handler.call(this, arguments[1], arguments[2])); + break; + default: + args = new Array(al - 1); + for (j = 1; j < al; j++) args[j - 1] = arguments[j]; + promises.push(handler.apply(this, args)); + } + } else if (handler && handler.length) { + handler = handler.slice(); + if (al > 3) { + args = new Array(al - 1); + for (j = 1; j < al; j++) args[j - 1] = arguments[j]; + } + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + promises.push(handler[i].call(this)); + break; + case 2: + promises.push(handler[i].call(this, arguments[1])); + break; + case 3: + promises.push(handler[i].call(this, arguments[1], arguments[2])); + break; + default: + promises.push(handler[i].apply(this, args)); + } + } + } else if (!this.ignoreErrors && !this._all && type === 'error') { + if (arguments[1] instanceof Error) { + return Promise.reject(arguments[1]); // Unhandled 'error' event + } else { + return Promise.reject("Uncaught, unspecified 'error' event."); + } + } + + return Promise.all(promises); + }; + + EventEmitter.prototype.on = function(type, listener, options) { + return this._on(type, listener, false, options); + }; + + EventEmitter.prototype.prependListener = function(type, listener, options) { + return this._on(type, listener, true, options); + }; + + EventEmitter.prototype.onAny = function(fn) { + return this._onAny(fn, false); + }; + + EventEmitter.prototype.prependAny = function(fn) { + return this._onAny(fn, true); + }; + + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + EventEmitter.prototype._onAny = function(fn, prepend){ + if (typeof fn !== 'function') { + throw new Error('onAny only accepts instances of Function'); + } + + if (!this._all) { + this._all = []; + } + + // Add the function to the event listener collection. + if(prepend){ + this._all.unshift(fn); + }else{ + this._all.push(fn); + } + + return this; + }; + + EventEmitter.prototype._on = function(type, listener, prepend, options) { + if (typeof type === 'function') { + this._onAny(type, listener); + return this; + } + + if (typeof listener !== 'function') { + throw new Error('on only accepts instances of Function'); + } + this._events || init.call(this); + + var returnValue= this, temp; + + if (options !== undefined) { + temp = setupListener.call(this, type, listener, options); + listener = temp[0]; + returnValue = temp[1]; + } + + // To avoid recursion in the case that type == "newListeners"! Before + // adding it to the listeners, first emit "newListeners". + if (this._newListener) { + this.emit('newListener', type, listener); + } + + if (this.wildcard) { + growListenerTree.call(this, type, listener, prepend); + return returnValue; + } + + if (!this._events[type]) { + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + } else { + if (typeof this._events[type] === 'function') { + // Change to array. + this._events[type] = [this._events[type]]; + } + + // If we've already got an array, just add + if(prepend){ + this._events[type].unshift(listener); + }else{ + this._events[type].push(listener); + } + + // Check for listener leak + if ( + !this._events[type].warned && + this._maxListeners > 0 && + this._events[type].length > this._maxListeners + ) { + this._events[type].warned = true; + logPossibleMemoryLeak.call(this, this._events[type].length, type); + } + } + + return returnValue; + }; + + EventEmitter.prototype.off = function(type, listener) { + if (typeof listener !== 'function') { + throw new Error('removeListener only takes instances of Function'); + } + + var handlers,leafs=[]; + + if(this.wildcard) { + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); + if(!leafs) return this; + } else { + // does not use listeners(), so no side effect of creating _events[type] + if (!this._events[type]) return this; + handlers = this._events[type]; + leafs.push({_listeners:handlers}); + } + + for (var iLeaf=0; iLeaf 0) { + fns = this._all; + for(i = 0, l = fns.length; i < l; i++) { + if(fn === fns[i]) { + fns.splice(i, 1); + if (this._removeListener) + this.emit("removeListenerAny", fn); + return this; + } + } + } else { + fns = this._all; + if (this._removeListener) { + for(i = 0, l = fns.length; i < l; i++) + this.emit("removeListenerAny", fns[i]); + } + this._all = []; + } + return this; + }; + + EventEmitter.prototype.removeListener = EventEmitter.prototype.off; + + EventEmitter.prototype.removeAllListeners = function (type) { + if (type === undefined) { + !this._events || init.call(this); + return this; + } + + if (this.wildcard) { + var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i; + if (!leafs) return this; + for (i = 0; i < leafs.length; i++) { + leaf = leafs[i]; + leaf._listeners = null; + } + this.listenerTree && recursivelyGarbageCollect(this.listenerTree); + } else if (this._events) { + this._events[type] = null; + } + return this; + }; + + EventEmitter.prototype.listeners = function (type) { + var _events = this._events; + var keys, listeners, allListeners; + var i; + var listenerTree; + + if (type === undefined) { + if (this.wildcard) { + throw Error('event name required for wildcard emitter'); + } + + if (!_events) { + return []; + } + + keys = ownKeys(_events); + i = keys.length; + allListeners = []; + while (i-- > 0) { + listeners = _events[keys[i]]; + if (typeof listeners === 'function') { + allListeners.push(listeners); + } else { + allListeners.push.apply(allListeners, listeners); + } + } + return allListeners; + } else { + if (this.wildcard) { + listenerTree= this.listenerTree; + if(!listenerTree) return []; + var handlers = []; + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + searchListenerTree.call(this, handlers, ns, listenerTree, 0); + return handlers; + } + + if (!_events) { + return []; + } + + listeners = _events[type]; + + if (!listeners) { + return []; + } + return typeof listeners === 'function' ? [listeners] : listeners; + } + }; + + EventEmitter.prototype.eventNames = function(nsAsArray){ + var _events= this._events; + return this.wildcard? collectTreeEvents.call(this, this.listenerTree, [], null, nsAsArray) : (_events? ownKeys(_events) : []); + }; + + EventEmitter.prototype.listenerCount = function(type) { + return this.listeners(type).length; + }; + + EventEmitter.prototype.hasListeners = function (type) { + if (this.wildcard) { + var handlers = []; + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); + return handlers.length > 0; + } + + var _events = this._events; + var _all = this._all; + + return !!(_all && _all.length || _events && (type === undefined ? ownKeys(_events).length : _events[type])); + }; + + EventEmitter.prototype.listenersAny = function() { + + if(this._all) { + return this._all; + } + else { + return []; + } + + }; + + EventEmitter.prototype.waitFor = function (event, options) { + var self = this; + var type = typeof options; + if (type === 'number') { + options = {timeout: options}; + } else if (type === 'function') { + options = {filter: options}; + } + + options= resolveOptions(options, { + timeout: 0, + filter: undefined, + handleError: false, + Promise: Promise, + overload: false + }, { + filter: functionReducer, + Promise: constructorReducer + }); + + return makeCancelablePromise(options.Promise, function (resolve, reject, onCancel) { + function listener() { + var filter= options.filter; + if (filter && !filter.apply(self, arguments)) { + return; + } + self.off(event, listener); + if (options.handleError) { + var err = arguments[0]; + err ? reject(err) : resolve(toArray.apply(null, arguments).slice(1)); + } else { + resolve(toArray.apply(null, arguments)); + } + } + + onCancel(function(){ + self.off(event, listener); + }); + + self._on(event, listener, false); + }, { + timeout: options.timeout, + overload: options.overload + }) + }; + + function once(emitter, name, options) { + options= resolveOptions(options, { + Promise: Promise, + timeout: 0, + overload: false + }, { + Promise: constructorReducer + }); + + var _Promise= options.Promise; + + return makeCancelablePromise(_Promise, function(resolve, reject, onCancel){ + var handler; + if (typeof emitter.addEventListener === 'function') { + handler= function () { + resolve(toArray.apply(null, arguments)); + }; + + onCancel(function(){ + emitter.removeEventListener(name, handler); + }); + + emitter.addEventListener( + name, + handler, + {once: true} + ); + return; + } + + var eventListener = function(){ + errorListener && emitter.removeListener('error', errorListener); + resolve(toArray.apply(null, arguments)); + }; + + var errorListener; + + if (name !== 'error') { + errorListener = function (err){ + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + onCancel(function(){ + errorListener && emitter.removeListener('error', errorListener); + emitter.removeListener(name, eventListener); + }); + + emitter.once(name, eventListener); + }, { + timeout: options.timeout, + overload: options.overload + }); + } + + var prototype= EventEmitter.prototype; + + Object.defineProperties(EventEmitter, { + defaultMaxListeners: { + get: function () { + return prototype._maxListeners; + }, + set: function (n) { + if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) { + throw TypeError('n must be a non-negative number') + } + prototype._maxListeners = n; + }, + enumerable: true + }, + once: { + value: once, + writable: true, + configurable: true + } + }); + + Object.defineProperties(prototype, { + _maxListeners: { + value: defaultMaxListeners, + writable: true, + configurable: true + }, + _observers: {value: null, writable: true, configurable: true} + }); + + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(function() { + return EventEmitter; + }); + } else if (typeof exports === 'object') { + // CommonJS + module.exports = EventEmitter; + } + else { + // global for any kind of environment. + var _global= new Function('','return this')(); + _global.EventEmitter2 = EventEmitter; + } +}(); + +}).call(this)}).call(this,require('_process'),require("timers").setImmediate) +},{"_process":44,"timers":62}],17:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +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. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// 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 setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + +},{}],18:[function(require,module,exports){ + +var hasOwn = Object.prototype.hasOwnProperty; +var toString = Object.prototype.toString; + +module.exports = function forEach (obj, fn, ctx) { + if (toString.call(fn) !== '[object Function]') { + throw new TypeError('iterator must be a function'); + } + var l = obj.length; + if (l === +l) { + for (var i = 0; i < l; i++) { + fn.call(ctx, obj[i], i, obj); + } + } else { + for (var k in obj) { + if (hasOwn.call(obj, k)) { + fn.call(ctx, obj[k], k, obj); + } + } + } +}; + + +},{}],19:[function(require,module,exports){ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + +},{}],20:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; + +},{"./implementation":19}],21:[function(require,module,exports){ +'use strict'; + +var undefined; + +var $SyntaxError = SyntaxError; +var $Function = Function; +var $TypeError = TypeError; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': RangeError, + '%ReferenceError%': ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('has'); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); +var $strSlice = bind.call(Function.call, String.prototype.slice); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + +},{"function-bind":20,"has":25,"has-symbols":22}],22:[function(require,module,exports){ +'use strict'; + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + +},{"./shams":23}],23:[function(require,module,exports){ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + +},{}],24:[function(require,module,exports){ +'use strict'; + +var hasSymbols = require('has-symbols/shams'); + +module.exports = function hasToStringTagShams() { + return hasSymbols() && !!Symbol.toStringTag; +}; + +},{"has-symbols/shams":23}],25:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); + +},{"function-bind":20}],26:[function(require,module,exports){ +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +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 +} + +},{}],27:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (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) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + +},{}],28:[function(require,module,exports){ +'use strict'; + +var hasToStringTag = require('has-tostringtag/shams')(); +var callBound = require('call-bind/callBound'); + +var $toString = callBound('Object.prototype.toString'); + +var isStandardArguments = function isArguments(value) { + if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { + return false; + } + return $toString(value) === '[object Arguments]'; +}; + +var isLegacyArguments = function isArguments(value) { + if (isStandardArguments(value)) { + return true; + } + return value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + $toString(value) !== '[object Array]' && + $toString(value.callee) === '[object Function]'; +}; + +var supportsStandardArguments = (function () { + return isStandardArguments(arguments); +}()); + +isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests + +module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; + +},{"call-bind/callBound":12,"has-tostringtag/shams":24}],29:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; +var fnToStr = Function.prototype.toString; +var isFnRegex = /^\s*(?:function)?\*/; +var hasToStringTag = require('has-tostringtag/shams')(); +var getProto = Object.getPrototypeOf; +var getGeneratorFunc = function () { // eslint-disable-line consistent-return + if (!hasToStringTag) { + return false; + } + try { + return Function('return function*() {}')(); + } catch (e) { + } +}; +var GeneratorFunction; + +module.exports = function isGeneratorFunction(fn) { + if (typeof fn !== 'function') { + return false; + } + if (isFnRegex.test(fnToStr.call(fn))) { + return true; + } + if (!hasToStringTag) { + var str = toStr.call(fn); + return str === '[object GeneratorFunction]'; + } + if (!getProto) { + return false; + } + if (typeof GeneratorFunction === 'undefined') { + var generatorFunc = getGeneratorFunc(); + GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + } + return getProto(fn) === GeneratorFunction; +}; + +},{"has-tostringtag/shams":24}],30:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var forEach = require('foreach'); +var availableTypedArrays = require('available-typed-arrays'); +var callBound = require('call-bind/callBound'); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var g = typeof globalThis === 'undefined' ? global : globalThis; +var typedArrays = availableTypedArrays(); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + } + }); +} + +var tryTypedArrays = function tryAllTypedArrays(value) { + var anyTrue = false; + forEach(toStrTags, function (getter, typedArray) { + if (!anyTrue) { + try { + anyTrue = getter.call(value) === typedArray; + } catch (e) { /**/ } + } + }); + return anyTrue; +}; + +module.exports = function isTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag || !(Symbol.toStringTag in value)) { + var tag = $slice($toString(value), 8, -1); + return $indexOf(typedArrays, tag) > -1; + } + if (!gOPD) { return false; } + return tryTypedArrays(value); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24}],31:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],32:[function(require,module,exports){ +'use strict'; + + +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + +function _has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof source !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (_has(source, p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + // Fallback to ordinary array + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + var i, l, len, pos, chunk, result; + + // calculate data length + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + + // join chunks + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + + return result; + } +}; + +var fnUntyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + return [].concat.apply([], chunks); + } +}; + + +// Enable/Disable typed arrays use, for testing +// +exports.setTyped = function (on) { + if (on) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } +}; + +exports.setTyped(TYPED_OK); + +},{}],33:[function(require,module,exports){ +'use strict'; + +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It isn't worth it to make additional optimizations as in original. +// Small size is preferable. + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 0; + + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; +} + + +module.exports = adler32; + +},{}],34:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; + +},{}],35:[function(require,module,exports){ +'use strict'; + +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; + + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; +} + +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); + + +function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; + + crc ^= -1; + + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + + +module.exports = crc32; + +},{}],36:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); +var trees = require('./trees'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var msg = require('./messages'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +var Z_NO_FLUSH = 0; +var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +//var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + +/* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; +var Z_DEFAULT_COMPRESSION = -1; + + +var Z_FILTERED = 1; +var Z_HUFFMAN_ONLY = 2; +var Z_RLE = 3; +var Z_FIXED = 4; +var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + + +/* The deflate compression method */ +var Z_DEFLATED = 8; + +/*============================================================================*/ + + +var MAX_MEM_LEVEL = 9; +/* Maximum value for memLevel in deflateInit2 */ +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_MEM_LEVEL = 8; + + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ +var LITERALS = 256; +/* number of literal bytes 0..255 */ +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ +var D_CODES = 30; +/* number of distance codes */ +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + +var PRESET_DICT = 0x20; + +var INIT_STATE = 42; +var EXTRA_STATE = 69; +var NAME_STATE = 73; +var COMMENT_STATE = 91; +var HCRC_STATE = 103; +var BUSY_STATE = 113; +var FINISH_STATE = 666; + +var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ +var BS_BLOCK_DONE = 2; /* block flush performed */ +var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ +var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + +var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + +function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; +} + +function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); +} + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ +function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +} + + +function flush_block_only(s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +} + + +function put_byte(s, b) { + s.pending_buf[s.pending++] = b; +} + + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; +} + + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ +function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + // zmemcpy(buf, strm->next_in, len); + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; +} + + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +} + + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH - 1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; +} + + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +} + +var configuration_table; + +configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ +]; + + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +} + + +function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); + this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS + 1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ +} + + +function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; +} + + +function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; +} + + +function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; +} + + +function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + + //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + //s->pending_buf = (uchf *) overlay; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) + //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s.d_buf = 1 * s.lit_bufsize; + + //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); +} + +function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); +} + + +function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; +} + +function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; +} + + +/* ========================================================================= + * Initializes the compression dictionary from the given byte + * sequence without producing any compressed output. + */ +function deflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var s; + var str, n; + var wrap; + var avail; + var next; + var input; + var tmpDict; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + s = strm.state; + wrap = s.wrap; + + if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { + return Z_STREAM_ERROR; + } + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap === 1) { + /* adler32(strm->adler, dictionary, dictLength); */ + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + } + + s.wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s.w_size) { + if (wrap === 0) { /* already empty otherwise */ + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + /* use the tail */ + // dictionary = dictionary.slice(dictLength - s.w_size); + tmpDict = new utils.Buf8(s.w_size); + utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + /* insert dictionary into window and hash */ + avail = strm.avail_in; + next = strm.next_in; + input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + str = s.strstart; + n = s.lookahead - (MIN_MATCH - 1); + do { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; +} + + +exports.deflateInit = deflateInit; +exports.deflateInit2 = deflateInit2; +exports.deflateReset = deflateReset; +exports.deflateResetKeep = deflateResetKeep; +exports.deflateSetHeader = deflateSetHeader; +exports.deflate = deflate; +exports.deflateEnd = deflateEnd; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateInfo = 'pako deflate (from Nodeca project)'; + +/* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ + +},{"../utils/common":32,"./adler32":33,"./crc32":35,"./messages":40,"./trees":41}],37:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +// See state defs from inflate.js +var BAD = 30; /* got a data error -- remain here until reset */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 + + On return, state.mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ +module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + // Use `s_window` instead `window`, avoid conflict with instrumentation tools + var s_window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; + + + var input, output; // JS specific, because we have no pointers + + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + s_window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = s_window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; +}; + +},{}],38:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var inflate_fast = require('./inffast'); +var inflate_table = require('./inftrees'); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + +/* The deflate compression method */ +var Z_DEFLATED = 8; + + +/* STATES ====================================================================*/ +/* ===========================================================================*/ + + +var HEAD = 1; /* i: waiting for magic header */ +var FLAGS = 2; /* i: waiting for method and flags (gzip) */ +var TIME = 3; /* i: waiting for modification time (gzip) */ +var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ +var EXLEN = 5; /* i: waiting for extra length (gzip) */ +var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ +var NAME = 7; /* i: waiting for end of file name (gzip) */ +var COMMENT = 8; /* i: waiting for end of comment (gzip) */ +var HCRC = 9; /* i: waiting for header crc (gzip) */ +var DICTID = 10; /* i: waiting for dictionary check value */ +var DICT = 11; /* waiting for inflateSetDictionary() call */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ +var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ +var STORED = 14; /* i: waiting for stored size (length and complement) */ +var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ +var COPY = 16; /* i/o: waiting for input or output to copy stored block */ +var TABLE = 17; /* i: waiting for dynamic block table lengths */ +var LENLENS = 18; /* i: waiting for code length code lengths */ +var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ +var LEN_ = 20; /* i: same as LEN below, but only first time in */ +var LEN = 21; /* i: waiting for length/lit/eob code */ +var LENEXT = 22; /* i: waiting for length extra bits */ +var DIST = 23; /* i: waiting for distance code */ +var DISTEXT = 24; /* i: waiting for distance extra bits */ +var MATCH = 25; /* o: waiting for output space to copy string */ +var LIT = 26; /* o: waiting for output space to write literal */ +var CHECK = 27; /* i: waiting for 32-bit check value */ +var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ +var DONE = 29; /* finished check, done -- remain here until reset */ +var BAD = 30; /* got a data error -- remain here until reset */ +var MEM = 31; /* got an inflate() memory error -- remain here until reset */ +var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ + +/* ===========================================================================*/ + + + +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_WBITS = MAX_WBITS; + + +function zswap32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); +} + + +function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ + + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ + + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ + + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ + + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ + + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ +} + +function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + +} + +function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +} + +function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; +} + +function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); +} + + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +var virgin = true; + +var lenfix, distfix; // We have no pointers in JS, so keep tables separate + +function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +} + + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window, src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window, src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; +} + +function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more convenient processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = zswap32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = { bits: state.lenbits }; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = { bits: state.lenbits }; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = { bits: state.distbits }; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' instead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too + if ((state.flags ? hold : zswap32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; +} + +function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; +} + +function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; +} + +function inflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var state; + var dictid; + var ret; + + /* check state */ + if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } + state = strm.state; + + if (state.wrap !== 0 && state.mode !== DICT) { + return Z_STREAM_ERROR; + } + + /* check for correct dictionary identifier */ + if (state.mode === DICT) { + dictid = 1; /* adler32(0, null, 0)*/ + /* dictid = adler32(dictid, dictionary, dictLength); */ + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state.check) { + return Z_DATA_ERROR; + } + } + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state.mode = MEM; + return Z_MEM_ERROR; + } + state.havedict = 1; + // Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +exports.inflateReset = inflateReset; +exports.inflateReset2 = inflateReset2; +exports.inflateResetKeep = inflateResetKeep; +exports.inflateInit = inflateInit; +exports.inflateInit2 = inflateInit2; +exports.inflate = inflate; +exports.inflateEnd = inflateEnd; +exports.inflateGetHeader = inflateGetHeader; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateInfo = 'pako inflate (from Nodeca project)'; + +/* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ + +},{"../utils/common":32,"./adler32":33,"./crc32":35,"./inffast":37,"./inftrees":39}],39:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); + +var MAXBITS = 15; +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +var lbase = [ /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 +]; + +var lext = [ /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 +]; + +var dbase = [ /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0 +]; + +var dext = [ /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64 +]; + +module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) +{ + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; +}; + +},{"../utils/common":32}],40:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + 2: 'need dictionary', /* Z_NEED_DICT 2 */ + 1: 'stream end', /* Z_STREAM_END 1 */ + 0: '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; + +},{}],41:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +/* eslint-disable space-unary-ops */ + +var utils = require('../utils/common'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; +var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +var Z_BINARY = 0; +var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + +/*============================================================================*/ + + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + +var STORED_BLOCK = 0; +var STATIC_TREES = 1; +var DYN_TREES = 2; +/* The three kinds of block type */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +/* The minimum and maximum match lengths */ + +// From deflate.h +/* =========================================================================== + * Internal compression state. + */ + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ + +var LITERALS = 256; +/* number of literal bytes 0..255 */ + +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ + +var D_CODES = 30; +/* number of distance codes */ + +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ + +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ + +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var Buf_size = 16; +/* size of bit buffer in bi_buf */ + + +/* =========================================================================== + * Constants + */ + +var MAX_BL_BITS = 7; +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +var END_BLOCK = 256; +/* end of block literal code */ + +var REP_3_6 = 16; +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +var REPZ_3_10 = 17; +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +var REPZ_11_138 = 18; +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +/* eslint-disable comma-spacing,array-bracket-spacing */ +var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + +var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + +var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + +var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +/* eslint-enable comma-spacing,array-bracket-spacing */ + +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + +var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 +var static_ltree = new Array((L_CODES + 2) * 2); +zero(static_ltree); +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +var static_dtree = new Array(D_CODES * 2); +zero(static_dtree); +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +var _dist_code = new Array(DIST_CODE_LEN); +zero(_dist_code); +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); +zero(_length_code); +/* length code for each normalized match length (0 == MIN_MATCH) */ + +var base_length = new Array(LENGTH_CODES); +zero(base_length); +/* First normalized length for each code (0 = MIN_MATCH) */ + +var base_dist = new Array(D_CODES); +zero(base_dist); +/* First normalized distance for each code (0 = distance of 1) */ + + +function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; +} + + +var static_l_desc; +var static_d_desc; +var static_bl_desc; + + +function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ +} + + + +function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +} + + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +function put_short(s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; +} + + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } +} + + +function send_code(s, c, tree) { + send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); +} + + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +} + + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +} + + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m * 2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; + tree[m * 2 + 1]/*.Len*/ = bits; + } + n--; + } + } +} + + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ +{ + var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits - 1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < (1 << extra_lbits[code]); n++) { + _length_code[length++] = code; + } + } + //Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length - 1] = code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1 << extra_dbits[code]); n++) { + _dist_code[dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES + 1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1]/*.Len*/ = 5; + static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; +} + + +/* =========================================================================== + * Initialize a new block. + */ +function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; +} + + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +function bi_windup(s) +{ + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +function smaller(tree, n, m, depth) { + var _n2 = n * 2; + var _m2 = m * 2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); +} + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ +{ + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; +} + + +// inlined manually +// var SMALLEST = 1; + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ +{ + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); +} + + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n * 2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node * 2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); +} + + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6 * 2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; +} + + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + + +var static_init_done = false; + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +function _tr_init(s) +{ + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); +} + + +/* =========================================================================== + * Send a stored block + */ +function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ +} + + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +function _tr_align(s) { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +} + + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len + 3 + 7) >>> 3; + static_lenb = (s.static_len + 3 + 7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc * 2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize - 1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +exports._tr_init = _tr_init; +exports._tr_stored_block = _tr_stored_block; +exports._tr_flush_block = _tr_flush_block; +exports._tr_tally = _tr_tally; +exports._tr_align = _tr_align; + +},{"../utils/common":32}],42:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} + +module.exports = ZStream; + +},{}],43:[function(require,module,exports){ +(function (Buffer){(function (){ +var fs = require("fs"), + stream = require("stream"), + zlib = require("zlib"), + HEADER = new Buffer("89504e470d0a1a0a", "hex") + +function ImageData(width, height, channels, data, trailer) { + this.width = width; + this.height = height; + this.channels = channels; + this.data = data; + this.trailer = trailer; +} + +ImageData.prototype.getPixel = function(x, y) { + x = x|0; + y = y|0; + + if(x < 0 || y < 0 || x >= this.width || y >= this.height) + return 0; + + var index = (y * this.width + x) * this.channels, + r, g, b, a; + + switch(this.channels) { + case 1: + r = g = b = this.data[index]; + a = 255; + break; + + case 2: + r = g = b = this.data[index ]; + a = this.data[index + 1]; + break; + + case 3: + r = this.data[index ]; + g = this.data[index + 1]; + b = this.data[index + 2]; + a = 255; + break; + + case 4: + r = this.data[index ]; + g = this.data[index + 1]; + b = this.data[index + 2]; + a = this.data[index + 3]; + break; + } + + return ((r << 24) | (g << 16) | (b << 8) | a) >>> 0; +} + +function paeth(a, b, c) { + var p = a + b - c, + pa = Math.abs(p - a), + pb = Math.abs(p - b), + pc = Math.abs(p - c) + + if((pa <= pb) && (pa <= pc)) + return a + + if(pb <= pc) + return b + + return c +} + +exports.parseStream = function(stream, callback) { + var inflate = zlib.createInflate(), + state = 0, + off = 0, + buf = new Buffer(13), + waiting = 2, + b = -1, + p = 0, + pngPaletteEntries = 0, + pngAlphaEntries = 0, + chunkLength, pngWidth, pngHeight, pngBitDepth, pngDepthMult, + pngColorType, pngPixels, pngSamplesPerPixel, pngBytesPerPixel, + pngBytesPerScanline, pngSamples, currentScanline, priorScanline, + scanlineFilter, pngTrailer, pngPalette, pngAlpha, idChannels; + + function error(err) { + /* FIXME: stream.destroy no longer exists in node 0.10. I can't actually + * find what the right way to say "hey stream, I am no longer going to read + * from you ever" or "hey stream, I am never going to write to you ever + * again", so I'm really not sure what the right way to handle this is. + * + * I would appreciate pull requests from somebody who actually understands + * how node streams are supposed to function. */ + if(stream.destroy) + stream.destroy() + + if(inflate.destroy) + inflate.destroy() + + return callback(err) + } + + function end() { + if(!--waiting) + return callback( + undefined, + new ImageData(pngWidth, pngHeight, idChannels, pngPixels, pngTrailer) + ) + } + + stream.on("error", error) + inflate.on("error", error) + + stream.on("end", function() { + stream.destroy() + + if(!pngPixels) + return error(new Error("Corrupt PNG?")) + + if(!pngTrailer) + return error(new Error("Corrupt PNG?")) + + return end() + }) + + inflate.on("end", function() { + if(inflate.destroy) + inflate.destroy() + + if(p !== pngPixels.length) + return error(new Error("Too little pixel data! (Corrupt PNG?)")) + + return end() + }) + + stream.on("data", function(data) { + /* If an error occurred, bail. */ + if(!stream.readable) + return + + var len = data.length, + i = 0, + tmp, j; + + while(i !== len) + switch(state) { + case 0: /* PNG header */ + if(data[i++] !== HEADER[off++]) + return error(new Error("Invalid PNG header.")) + + if(off === HEADER.length) { + state = 1 + off = 0 + } + break + + case 1: /* PNG chunk length and type */ + if(len - i < 8 - off) { + data.copy(buf, off, i) + off += len - i + i = len + } + + else { + data.copy(buf, off, i, i + 8 - off) + + i += 8 - off + off = 0 + chunkLength = buf.readUInt32BE(0) + + switch(buf.toString("ascii", 4, 8)) { + case "IHDR": + state = 2 + break + + case "PLTE": + /* The PNG spec states that PLTE is only required for type 3. + * It may appear in other types, but is only useful if the + * display does not support true color. Since we're just a data + * storage format, we don't have to worry about it. */ + if(pngColorType !== 3) + state = 7 + + else { + if(chunkLength % 3 !== 0) + return error(new Error("Invalid PLTE size.")) + + pngPaletteEntries = chunkLength / 3 + pngPalette = new Buffer(chunkLength) + state = 3 + } + break + + case "tRNS": + if(pngColorType !== 3) + return error(new Error("tRNS for non-paletted images not yet supported.")); + + /* We only support tRNS on paletted images right now. Those + * images may either have 1 or 3 channels, but in either case + * we add one for transparency. */ + idChannels ++; + + pngAlphaEntries = chunkLength; + pngAlpha = new Buffer(chunkLength); + state = 4; + break + + case "IDAT": + /* Allocate the PNG if we havn't yet. (We wait to do it until + * here since tRNS may change idChannels, so we can't be sure of + * the size needed until we hit IDAT. With all that, might as + * well wait until we're actually going to start filling the + * buffer in case of errors...) */ + if(!pngPixels) + pngPixels = new Buffer(pngWidth * pngHeight * idChannels); + + state = 5 + break + + case "IEND": + state = 6 + break + + default: + state = 7 + break + } + } + break + + case 2: /* IHDR */ + if(chunkLength !== 13) + return error(new Error("Invalid IHDR chunk.")) + + else if(len - i < chunkLength - off) { + data.copy(buf, off, i) + off += len - i + i = len + } + + else { + data.copy(buf, off, i, i + chunkLength - off) + + if(buf.readUInt8(10) !== 0) + return error(new Error("Unsupported compression method.")) + + if(buf.readUInt8(11) !== 0) + return error(new Error("Unsupported filter method.")) + + if(buf.readUInt8(12) !== 0) + return error(new Error("Unsupported interlace method.")) + + i += chunkLength - off + state = 8 + off = 0 + pngWidth = buf.readUInt32BE(0) + pngHeight = buf.readUInt32BE(4) + pngBitDepth = buf.readUInt8(8) + pngDepthMult = 255 / ((1 << pngBitDepth) - 1) + pngColorType = buf.readUInt8(9) + + switch(pngColorType) { + case 0: + pngSamplesPerPixel = 1; + pngBytesPerPixel = Math.ceil(pngBitDepth * 0.125); + idChannels = 1; + break + + case 2: + pngSamplesPerPixel = 3; + pngBytesPerPixel = Math.ceil(pngBitDepth * 0.375); + idChannels = 3; + break; + + case 3: + pngSamplesPerPixel = 1; + pngBytesPerPixel = 1; + idChannels = 3; + break + + case 4: + pngSamplesPerPixel = 2; + pngBytesPerPixel = Math.ceil(pngBitDepth * 0.250); + idChannels = 2; + break + + case 6: + pngSamplesPerPixel = 4; + pngBytesPerPixel = Math.ceil(pngBitDepth * 0.5); + idChannels = 4; + break; + + default: + return error( + new Error("Unsupported color type: " + pngColorType) + ); + } + + pngBytesPerScanline = Math.ceil( + pngWidth * pngBitDepth * pngSamplesPerPixel / 8 + ) + pngSamples = new Buffer(pngSamplesPerPixel) + currentScanline = new Buffer(pngBytesPerScanline) + priorScanline = new Buffer(pngBytesPerScanline) + currentScanline.fill(0) + } + break + + case 3: /* PLTE */ + if(len - i < chunkLength - off) { + data.copy(pngPalette, off, i) + off += len - i + i = len + } + + else { + data.copy(pngPalette, off, i, i + chunkLength - off) + i += chunkLength - off + state = 8 + off = 0 + + /* If each entry in the color palette is grayscale, set the channel + * count to 1. */ + idChannels = 1; + for(j = pngPaletteEntries; j--; ) + if(pngPalette[j * 3 + 0] !== pngPalette[j * 3 + 1] || + pngPalette[j * 3 + 0] !== pngPalette[j * 3 + 2]) { + idChannels = 3; + break; + } + } + break + + case 4: /* tRNS */ + if(len - i < chunkLength - off) { + data.copy(pngAlpha, off, i) + off += len - i + i = len + } + + else { + data.copy(pngAlpha, off, i, i + chunkLength - off) + i += chunkLength - off + state = 8 + off = 0 + } + break + + case 5: /* IDAT */ + /* If the amount available is less than the amount remaining, then + * feed as much as we can to the inflator. */ + if(len - i < chunkLength - off) { + /* FIXME: Do I need to be smart and check the return value? */ + inflate.write(data.slice(i)) + off += len - i + i = len + } + + /* Otherwise, write the last bit of the data to the inflator, and + * finish processing the chunk. */ + else { + /* FIXME: Do I need to be smart and check the return value? */ + inflate.write(data.slice(i, i + chunkLength - off)) + i += chunkLength - off + state = 8 + off = 0 + } + break + + case 6: /* IEND */ + if(chunkLength !== 0) + return error(new Error("Invalid IEND chunk.")) + + else if(len - i < 4 - off) { + off += len - i + i = len + } + + else { + pngTrailer = new Buffer(0) + i += 4 - off + state = 9 + off = 0 + + inflate.end() + } + break + + case 7: /* unrecognized chunk */ + if(len - i < chunkLength - off) { + off += len - i + i = len + } + + else { + i += chunkLength - off + state = 8 + off = 0 + } + break + + case 8: /* chunk crc */ + /* FIXME: CRC is blatantly ignored */ + if(len - i < 4 - off) { + off += len - i + i = len + } + + else { + i += 4 - off + state = 1 + off = 0 + } + break + + case 9: /* trailing data */ + /* FIXME: It is inefficient to create a trailer buffer of length zero + * and keep reallocating it every time we want to add more data. */ + tmp = new Buffer(off + len - i) + pngTrailer.copy(tmp) + data.copy(tmp, off, i, len) + pngTrailer = tmp + off += len - i + i = len + break + } + }) + + inflate.on("data", function(data) { + /* If an error occurred, bail. */ + if(!inflate.readable) + return + + var len = data.length, + i, tmp, x, j, k + + for(i = 0; i !== len; ++i) { + if(b === -1) { + scanlineFilter = data[i] + tmp = currentScanline + currentScanline = priorScanline + priorScanline = tmp + } + + else + switch(scanlineFilter) { + case 0: + currentScanline[b] = data[i] + break + + case 1: + currentScanline[b] = + b < pngBytesPerPixel ? + data[i] : + (data[i] + currentScanline[b - pngBytesPerPixel]) & 255 + break + + case 2: + currentScanline[b] = (data[i] + priorScanline[b]) & 255 + break + + case 3: + currentScanline[b] = (data[i] + (( + b < pngBytesPerPixel ? + priorScanline[b] : + currentScanline[b - pngBytesPerPixel] + priorScanline[b] + ) >>> 1)) & 255 + break + + case 4: + currentScanline[b] = (data[i] + ( + b < pngBytesPerPixel ? + priorScanline[b] : + paeth( + currentScanline[b - pngBytesPerPixel], + priorScanline[b], + priorScanline[b - pngBytesPerPixel] + ) + )) & 255 + break + + default: + return error( + new Error("Unsupported scanline filter: " + scanlineFilter) + ) + } + + if(++b === pngBytesPerScanline) { + /* One scanline too many? */ + if(p === pngPixels.length) + return error(new Error("Too much pixel data! (Corrupt PNG?)")) + + /* We have now read a complete scanline, so unfilter it and write it + * into the pixel array. */ + for(j = 0, x = 0; x !== pngWidth; ++x) { + /* Read all of the samples into the sample buffer. */ + for(k = 0; k !== pngSamplesPerPixel; ++j, ++k) + switch(pngBitDepth) { + case 1: + pngSamples[k] = + (currentScanline[(j >>> 3)] >> (7 - (j & 7))) & 1 + break + + case 2: + pngSamples[k] = + (currentScanline[(j >>> 2)] >> ((3 - (j & 3)) << 1)) & 3 + break + + case 4: + pngSamples[k] = + (currentScanline[(j >>> 1)] >> ((1 - (j & 1)) << 2)) & 15 + break + + case 8: + pngSamples[k] = currentScanline[j] + break + + default: + return error(new Error("Unsupported bit depth: " + pngBitDepth)) + } + + /* Write the pixel based off of the samples so collected. */ + switch(pngColorType) { + case 0: + pngPixels[p++] = pngSamples[0] * pngDepthMult; + break; + + case 2: + pngPixels[p++] = pngSamples[0] * pngDepthMult; + pngPixels[p++] = pngSamples[1] * pngDepthMult; + pngPixels[p++] = pngSamples[2] * pngDepthMult; + break; + + case 3: + if(pngSamples[0] >= pngPaletteEntries) + return error(new Error("Invalid palette index.")); + + switch(idChannels) { + case 1: + pngPixels[p++] = pngPalette[pngSamples[0] * 3]; + break; + + case 2: + pngPixels[p++] = pngPalette[pngSamples[0] * 3]; + pngPixels[p++] = + pngSamples[0] < pngAlphaEntries ? + pngAlpha[pngSamples[0]] : + 255; + break; + + case 3: + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 0]; + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 1]; + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 2]; + break; + + case 4: + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 0]; + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 1]; + pngPixels[p++] = pngPalette[pngSamples[0] * 3 + 2]; + pngPixels[p++] = + pngSamples[0] < pngAlphaEntries ? + pngAlpha[pngSamples[0]] : + 255; + break; + } + break; + + case 4: + pngPixels[p++] = pngSamples[0] * pngDepthMult; + pngPixels[p++] = pngSamples[1] * pngDepthMult; + break; + + case 6: + pngPixels[p++] = pngSamples[0] * pngDepthMult; + pngPixels[p++] = pngSamples[1] * pngDepthMult; + pngPixels[p++] = pngSamples[2] * pngDepthMult; + pngPixels[p++] = pngSamples[3] * pngDepthMult; + break; + } + } + + b = -1; + } + } + }) +} + +exports.parseFile = function(pathname, callback) { + return exports.parseStream(fs.createReadStream(pathname), callback) +} + +exports.parseBuffer = function(buf, callback) { + /* Create a mock stream. */ + var s = new stream.Stream() + + /* Set up the destroy functionality. */ + s.readable = true + s.destroy = function() { s.readable = false } + + /* Set up the PNG parsing hooks. */ + exports.parseStream(s, callback) + + /* Send the data down the stream. */ + s.emit("data", buf) + + /* If no errors occurred in the data, close the stream. */ + if(s.readable) + s.emit("end") +} + +/* FIXME: This is deprecated. Remove it in 2.0. */ +exports.parse = exports.parseBuffer + +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":11,"fs":10,"stream":46,"zlib":9}],44:[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; }; + +},{}],45:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + +},{"buffer":11}],46:[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/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.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":17,"inherits":27,"readable-stream/lib/_stream_duplex.js":48,"readable-stream/lib/_stream_passthrough.js":49,"readable-stream/lib/_stream_readable.js":50,"readable-stream/lib/_stream_transform.js":51,"readable-stream/lib/_stream_writable.js":52,"readable-stream/lib/internal/streams/end-of-stream.js":56,"readable-stream/lib/internal/streams/pipeline.js":58}],47:[function(require,module,exports){ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + +},{}],48:[function(require,module,exports){ +(function (process){(function (){ +// 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. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. +'use strict'; +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + + for (var key in obj) { + keys.push(key); + } + + return keys; +}; +/**/ + + +module.exports = Duplex; + +var Readable = require('./_stream_readable'); + +var Writable = require('./_stream_writable'); + +require('inherits')(Duplex, Readable); + +{ + // Allow the keys array to be GC'ed. + 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); + this.allowHalfOpen = true; + + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; - function init() { - this._events = {}; - if (this._conf) { - configure.call(this, this._conf); + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); } } +} - function configure(conf) { - if (conf) { - this._conf = conf; +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); // the no-half-open enforcer - conf.delimiter && (this.delimiter = conf.delimiter); +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. - if(conf.maxListeners!==undefined){ - this._maxListeners= conf.maxListeners; - } + process.nextTick(onEndNT, this); +} - conf.wildcard && (this.wildcard = conf.wildcard); - conf.newListener && (this._newListener = conf.newListener); - conf.removeListener && (this._removeListener = conf.removeListener); - conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak); - conf.ignoreErrors && (this.ignoreErrors = conf.ignoreErrors); +function onEndNT(self) { + self.end(); +} - if (this.wildcard) { - this.listenerTree = {}; - } +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; } + + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + this._writableState.destroyed = value; } +}); +}).call(this)}).call(this,require('_process')) +},{"./_stream_readable":50,"./_stream_writable":52,"_process":44,"inherits":27}],49:[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. +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. +'use strict'; - function logPossibleMemoryLeak(count, eventName) { - var errorMsg = '(node) warning: possible EventEmitter memory ' + - 'leak detected. ' + count + ' listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.'; +module.exports = PassThrough; - if(this.verboseMemoryLeak){ - errorMsg += ' Event name: ' + eventName + '.'; +var Transform = require('./_stream_transform'); + +require('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":51,"inherits":27}],50:[function(require,module,exports){ +(function (process,global){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; + +module.exports = Readable; +/**/ + +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; +/**/ + +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ + + +var Stream = require('./internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +/**/ + + +var debugUtil = require('util'); + +var debug; + +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + + +var BufferList = require('./internal/streams/buffer_list'); + +var destroyImpl = require('./internal/streams/destroy'); + +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + + +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; + +require('inherits')(Readable, Stream); + +var errorOrDestroy = destroyImpl.errorOrDestroy; +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); // 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 (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // 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 (isDuplex) 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" + + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // 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 event 'readable'/'data' is emitted + // 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 read 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; + this.paused = true; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + + this.autoDestroy = !!options.autoDestroy; // has it been destroyed + + this.destroyed = 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'; // 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); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy + + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; } - if(typeof process !== 'undefined' && process.emitWarning){ - var e = new Error(errorMsg); - e.name = 'MaxListenersExceededWarning'; - e.emitter = this; - e.count = count; - process.emitWarning(e); - } else { - console.error(errorMsg); + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - if (console.trace){ - console.trace(); + + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; + +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // 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; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; } + + skipChunkCheck = true; } + } else { + skipChunkCheck = true; } - var toArray = function (a, b, c) { - var n = arguments.length; - switch (n) { - case 0: - return []; - case 1: - return [a]; - case 2: - return [a, b]; - case 3: - return [a, b, c]; - default: - var arr = new Array(n); - while (n--) { - arr[n] = arguments[n]; + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() + + +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); } - return arr; + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } - }; + } // We can push more data if we are below the highWaterMark. + // 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. - function toObject(keys, values) { - var obj = {}; - var key; - var len = keys.length; - var valuesCount = values ? value.length : 0; - for (var i = 0; i < len; i++) { - key = keys[i]; - obj[key] = i < valuesCount ? values[i] : undefined; - } - return obj; + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } 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); } - function TargetObserver(emitter, target, options) { - this._emitter = emitter; - this._target = target; - this._listeners = {}; - this._listenersCount = 0; + maybeReadMore(stream, state); +} - var on, off; +function chunkInvalid(state, chunk) { + var er; - if (options.on || options.off) { - on = options.on; - off = options.off; - } + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } - if (target.addEventListener) { - on = target.addEventListener; - off = target.removeEventListener; - } else if (target.addListener) { - on = target.addListener; - off = target.removeListener; - } else if (target.on) { - on = target.on; - off = target.off; - } + return er; +} - if (!on && !off) { - throw Error('target does not implement any known event API'); +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. + + +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + + var p = this._readableState.buffer.head; + var content = ''; + + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + + this._readableState.buffer.clear(); + + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; // Don't raise the hwm > 1GB + + +var MAX_HWM = 0x40000000; + +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + 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.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || 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 = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + + 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 onEofChunk(stream, state) { + debug('onEofChunk'); + 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; } + } - if (typeof on !== 'function') { - throw TypeError('on method must be a function'); + state.ended = true; + + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + + if (!state.emittedReadable) { + state.emittedReadable = true; + 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; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} + +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + + + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + 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; + process.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; + } + + 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) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; + +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) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); - if (typeof off !== 'function') { - throw TypeError('off method must be a function'); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } } + } - this._on = on; - this._off = off; + 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(); + } - var _observers= emitter._observers; - if(_observers){ - _observers.push(this); - }else{ - emitter._observers= [this]; + src.on('data', ondata); + + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + + if (ret === false) { + // 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', state.awaitDrain); + state.awaitDrain++; + } + + src.pause(); } - } + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. - Object.assign(TargetObserver.prototype, { - subscribe: function(event, localEvent, reducer){ - var observer= this; - var target= this._target; - var emitter= this._emitter; - var listeners= this._listeners; - var handler= function(){ - var args= toArray.apply(null, arguments); - var eventObj= { - data: args, - name: localEvent, - original: event - }; - if(reducer){ - var result= reducer.call(target, eventObj); - if(result!==false){ - emitter.emit.apply(emitter, [eventObj.name].concat(args)) - } - return; - } - emitter.emit.apply(emitter, [localEvent].concat(args)); - }; + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. - if(listeners[event]){ - throw Error('Event \'' + event + '\' is already listening'); - } - this._listenersCount++; + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - if(emitter._newListener && emitter._removeListener && !observer._onNewListener){ + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } - this._onNewListener = function (_event) { - if (_event === localEvent && listeners[event] === null) { - listeners[event] = handler; - observer._on.call(target, event, handler); - } - }; + dest.once('close', onclose); - emitter.on('newListener', this._onNewListener); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } - this._onRemoveListener= function(_event){ - if(_event === localEvent && !emitter.hasListeners(_event) && listeners[event]){ - listeners[event]= null; - observer._off.call(target, event, handler); - } - }; + dest.once('finish', onfinish); - listeners[event]= null; + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } // tell the dest that it's being piped to - emitter.on('removeListener', this._onRemoveListener); - }else{ - listeners[event]= handler; - observer._on.call(target, event, handler); - } - }, - unsubscribe: function(event){ - var observer= this; - var listeners= this._listeners; - var emitter= this._emitter; - var handler; - var events; - var off= this._off; - var target= this._target; - var i; + dest.emit('pipe', src); // start the flow if it hasn't been started already. - if(event && typeof event!=='string'){ - throw TypeError('event must be a string'); - } + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } - function clearRefs(){ - if(observer._onNewListener){ - emitter.off('newListener', observer._onNewListener); - emitter.off('removeListener', observer._onRemoveListener); - observer._onNewListener= null; - observer._onRemoveListener= null; - } - var index= findTargetIndex.call(emitter, observer); - emitter._observers.splice(index, 1); - } + return dest; +}; - if(event){ - handler= listeners[event]; - if(!handler) return; - off.call(target, event, handler); - delete listeners[event]; - if(!--this._listenersCount){ - clearRefs(); - } - }else{ - events= ownKeys(listeners); - i= events.length; - while(i-->0){ - event= events[i]; - off.call(target, event, listeners[event]); - } - this._listeners= {}; - this._listenersCount= 0; - clearRefs(); - } +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + 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); } - }); + }; +} - function resolveOptions(options, schema, reducers, allowUnknown) { - var computedOptions = Object.assign({}, schema); +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. - if (!options) return computedOptions; + if (state.pipesCount === 0) return this; // just one destination. most common case. - if (typeof options !== 'object') { - throw TypeError('options must be an object') - } + 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. - var keys = Object.keys(options); - var length = keys.length; - var option, value; - var reducer; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. - function reject(reason) { - throw Error('Invalid "' + option + '" option value' + (reason ? '. Reason: ' + reason : '')) + + 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, { + hasUnpiped: false + }); } - for (var i = 0; i < length; i++) { - option = keys[i]; - if (!allowUnknown && !hasOwnProperty.call(schema, option)) { - throw Error('Unknown "' + option + '" option'); - } - value = options[option]; - if (value !== undefined) { - reducer = reducers[option]; - computedOptions[option] = reducer ? reducer(value, reject) : value; + 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, unpipeInfo); + 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); + var state = this._readableState; + + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } } - return computedOptions; } - function constructorReducer(value, reject) { - if (typeof value !== 'function' || !value.hasOwnProperty('prototype')) { - reject('value must be a constructor'); - } - return value; + return res; +}; + +Readable.prototype.addListener = Readable.prototype.on; + +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); } - function makeTypeReducer(types) { - var message= 'value must be type of ' + types.join('|'); - var len= types.length; - var firstType= types[0]; - var secondType= types[1]; + return res; +}; - if (len === 1) { - return function (v, reject) { - if (typeof v === firstType) { - return v; - } - reject(message); - } - } +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - if (len === 2) { - return function (v, reject) { - var kind= typeof v; - if (kind === firstType || kind === secondType) return v; - reject(message); - } - } + return res; +}; - return function (v, reject) { - var kind = typeof v; - var i = len; - while (i-- > 0) { - if (kind === types[i]) return v; - } - reject(message); - } +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); } +} - var functionReducer= makeTypeReducer(['function']); +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. - var objectFunctionReducer= makeTypeReducer(['object', 'function']); - function makeCancelablePromise(Promise, executor, options) { - var isCancelable; - var callbacks; - var timer= 0; - var subscriptionClosed; +Readable.prototype.resume = function () { + var state = this._readableState; - var promise = new Promise(function (resolve, reject, onCancel) { - options= resolveOptions(options, { - timeout: 0, - overload: false - }, { - timeout: function(value, reject){ - value*= 1; - if (typeof value !== 'number' || value < 0 || !Number.isFinite(value)) { - reject('timeout must be a positive number'); - } - return value; - } - }); + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() - isCancelable = !options.overload && typeof Promise.prototype.cancel === 'function' && typeof onCancel === 'function'; + state.flowing = !state.readableListening; + resume(this, state); + } - function cleanup() { - if (callbacks) { - callbacks = null; - } - if (timer) { - clearTimeout(timer); - timer = 0; - } - } + state.paused = false; + return this; +}; - var _resolve= function(value){ - cleanup(); - resolve(value); - }; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} - var _reject= function(err){ - cleanup(); - reject(err); - }; +function resume_(stream, state) { + debug('resume', state.reading); - if (isCancelable) { - executor(_resolve, _reject, onCancel); - } else { - callbacks = [function(reason){ - _reject(reason || Error('canceled')); - }]; - executor(_resolve, _reject, function (cb) { - if (subscriptionClosed) { - throw Error('Unable to subscribe on cancel event asynchronously') - } - if (typeof cb !== 'function') { - throw TypeError('onCancel callback must be a function'); - } - callbacks.push(cb); - }); - subscriptionClosed= true; - } + if (!state.reading) { + stream.read(0); + } + + state.resumeScheduled = false; + 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 (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + + this._readableState.paused = true; + 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 _this = this; - if (options.timeout > 0) { - timer= setTimeout(function(){ - var reason= Error('timeout'); - reason.code = 'ETIMEDOUT' - timer= 0; - promise.cancel(reason); - reject(reason); - }, options.timeout); - } - }); + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); - if (!isCancelable) { - promise.cancel = function (reason) { - if (!callbacks) { - return; - } - var length = callbacks.length; - for (var i = 1; i < length; i++) { - callbacks[i](reason); - } - // internal callback to reject the promise - callbacks[0](reason); - callbacks = null; - }; + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); } - return promise; - } + _this.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 - function findTargetIndex(observer) { - var observers = this._observers; - if(!observers){ - return -1; + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + + if (!ret) { + paused = true; + stream.pause(); } - var len = observers.length; - for (var i = 0; i < len; i++) { - if (observers[i]._target === observer) return i; + }); // 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 methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); } - return -1; - } + } // proxy certain important events. - // Attention, function return type now is array, always ! - // It has zero elements if no any matches found and one or more - // elements (leafs) if there are matches - // - function searchListenerTree(handlers, type, tree, i, typeLength) { - if (!tree) { - return null; + + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. + + + this._read = function (n) { + debug('wrapped _read', n); + + if (paused) { + paused = false; + stream.resume(); } + }; - if (i === 0) { - var kind = typeof type; - if (kind === 'string') { - var ns, n, l = 0, j = 0, delimiter = this.delimiter, dl = delimiter.length; - if ((n = type.indexOf(delimiter)) !== -1) { - ns = new Array(5); - do { - ns[l++] = type.slice(j, n); - j = n + dl; - } while ((n = type.indexOf(delimiter, j)) !== -1); + return this; +}; - ns[l++] = type.slice(j); - type = ns; - typeLength = l; - } else { - type = [type]; - typeLength = 1; - } - } else if (kind === 'object') { - typeLength = type.length; - } else { - type = [type]; - typeLength = 1; - } +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); } - var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], - nextType = type[i + 1], branches, _listeners; + return createReadableStreamAsyncIterator(this); + }; +} - if (i === typeLength) { - // - // If at the end of the event(s) list and the tree has listeners - // invoke those listeners. - // +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. + +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // 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.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} - if(tree._listeners) { - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - listeners = [tree]; - } else { - handlers && handlers.push.apply(handlers, tree._listeners); - listeners = [tree]; - } - } - } else { +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); - if (currentType === '*') { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - branches = ownKeys(tree); - n = branches.length; - while (n-- > 0) { - branch = branches[n]; - if (branch !== '_listeners') { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); - if (_listeners) { - if (listeners) { - listeners.push.apply(listeners, _listeners); - } else { - listeners = _listeners; - } - } - } - } - return listeners; - } else if (currentType === '**') { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if (endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); - } + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} - branches = ownKeys(tree); - n = branches.length; - while (n-- > 0) { - branch = branches[n]; - if (branch !== '_listeners') { - if (branch === '*' || branch === '**') { - if (tree[branch]._listeners && !endReached) { - _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); - if (_listeners) { - if (listeners) { - listeners.push.apply(listeners, _listeners); - } else { - listeners = _listeners; - } - } - } - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); - } else { - // No match on this one, shift into the tree but not in the type array. - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } - if (_listeners) { - if (listeners) { - listeners.push.apply(listeners, _listeners); - } else { - listeners = _listeners; - } - } - } - } - return listeners; - } else if (tree[currentType]) { - listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); } } + } +} - xTree = tree['*']; - if (xTree) { - // - // If the listener tree will allow any match for this part, - // then recursively explore all branches of the tree - // - searchListenerTree(handlers, type, xTree, i + 1, typeLength); +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); } - xxTree = tree['**']; - if (xxTree) { - if (i < typeLength) { - if (xxTree._listeners) { - // If we have a listener on a '**', it will catch all, so add its handler. - searchListenerTree(handlers, type, xxTree, typeLength, typeLength); - } + return from(Readable, iterable, opts); + }; +} - // Build arrays of matching next branches and others. - branches= ownKeys(xxTree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === nextType) { - // We know the next element will match, so jump twice. - searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength); - } else if (branch === currentType) { - // Current node matches, move into the tree. - searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength); - } else { - isolatedBranch = {}; - isolatedBranch[branch] = xxTree[branch]; - searchListenerTree(handlers, type, {'**': isolatedBranch}, i + 1, typeLength); - } - } - } - } else if (xxTree._listeners) { - // We have reached the end and still on a '**' - searchListenerTree(handlers, type, xxTree, typeLength, typeLength); - } else if (xxTree['*'] && xxTree['*']._listeners) { - searchListenerTree(handlers, type, xxTree['*'], typeLength, typeLength); - } - } +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } - return listeners; + return -1; +} +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":47,"./_stream_duplex":48,"./internal/streams/async_iterator":53,"./internal/streams/buffer_list":54,"./internal/streams/destroy":55,"./internal/streams/from":57,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"events":17,"inherits":27,"string_decoder/":61,"util":7}],51:[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. +// 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 _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + +var Duplex = require('./_stream_duplex'); + +require('inherits')(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); } - function growListenerTree(type, listener, prepend) { - var len = 0, j = 0, i, delimiter = this.delimiter, dl= delimiter.length, ns; + ts.writechunk = null; + ts.writecb = null; + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; - if(typeof type==='string') { - if ((i = type.indexOf(delimiter)) !== -1) { - ns = new Array(5); - do { - ns[len++] = type.slice(j, i); - j = i + dl; - } while ((i = type.indexOf(delimiter, j)) !== -1); + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // 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.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +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) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; + +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.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; + } +}; + +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; - ns[len++] = type.slice(j); - }else{ - ns= [type]; - len= 1; - } - }else{ - ns= type; - len= type.length; - } +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided - // - // Looks for two consecutive '**', if so, don't add the event at all. - // - if (len > 1) { - for (i = 0; i + 1 < len; i++) { - if (ns[i] === '**' && ns[i + 1] === '**') { - return; - } - } - } + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} +},{"../errors":47,"./_stream_duplex":48,"inherits":27}],52:[function(require,module,exports){ +(function (process,global){(function (){ +// 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. +// 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; +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // It seems a linked list but it is not +// there will be only 2 of these for each stream - var tree = this.listenerTree, name; - for (i = 0; i < len; i++) { - name = ns[i]; +function CorkedRequest(state) { + var _this = this; - tree = tree[name] || (tree[name] = {}); + this.next = null; + this.entry = null; - if (i === len - 1) { - if (!tree._listeners) { - tree._listeners = listener; - } else { - if (typeof tree._listeners === 'function') { - tree._listeners = [tree._listeners]; - } + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ - if (prepend) { - tree._listeners.unshift(listener); - } else { - tree._listeners.push(listener); - } +/**/ - if ( - !tree._listeners.warned && - this._maxListeners > 0 && - tree._listeners.length > this._maxListeners - ) { - tree._listeners.warned = true; - logPossibleMemoryLeak.call(this, tree._listeners.length, name); - } - } - return true; - } - } - return true; - } +var Duplex; +/**/ - function collectTreeEvents(tree, events, root, asArray){ - var branches= ownKeys(tree); - var i= branches.length; - var branch, branchName, path; - var hasListeners= tree['_listeners']; - var isArrayPath; +Writable.WritableState = WritableState; +/**/ - while(i-->0){ - branchName= branches[i]; +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ - branch= tree[branchName]; +/**/ - if(branchName==='_listeners'){ - path= root; - }else { - path = root ? root.concat(branchName) : [branchName]; - } +var Stream = require('./internal/streams/stream'); +/**/ - isArrayPath= asArray || typeof branchName==='symbol'; - hasListeners && events.push(isArrayPath? path : path.join(this.delimiter)); +var Buffer = require('buffer').Buffer; - if(typeof branch==='object'){ - collectTreeEvents.call(this, branch, events, path, isArrayPath); - } - } +var OurUint8Array = global.Uint8Array || function () {}; - return events; - } +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} - function recursivelyGarbageCollect(root) { - var keys = ownKeys(root); - var i= keys.length; - var obj, key, flag; - while(i-->0){ - key = keys[i]; - obj = root[key]; +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} - if(obj){ - flag= true; - if(key !== '_listeners' && !recursivelyGarbageCollect(obj)){ - delete root[key]; - } - } - } +var destroyImpl = require('./internal/streams/destroy'); - return flag; - } +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; - function Listener(emitter, event, listener){ - this.emitter= emitter; - this.event= event; - this.listener= listener; - } +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - Listener.prototype.off= function(){ - this.emitter.off(this.event, this.listener); - return this; - }; +var errorOrDestroy = destroyImpl.errorOrDestroy; - function setupListener(event, listener, options){ - if (options === true) { - promisify = true; - } else if (options === false) { - async = true; - } else { - if (!options || typeof options !== 'object') { - throw TypeError('options should be an object or true'); - } - var async = options.async; - var promisify = options.promisify; - var nextTick = options.nextTick; - var objectify = options.objectify; - } +require('inherits')(Writable, Stream); - if (async || nextTick || promisify) { - var _listener = listener; - var _origin = listener._origin || listener; +function nop() {} - if (nextTick && !nextTickSupported) { - throw Error('process.nextTick is not supported'); - } +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (promisify === undefined) { - promisify = listener.constructor.name === 'AsyncFunction'; - } + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. - listener = function () { - var args = arguments; - var context = this; - var event = this.event; + this.objectMode = !!options.objectMode; + if (isDuplex) 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() - return promisify ? (nextTick ? Promise.resolve() : new Promise(function (resolve) { - _setImmediate(resolve); - }).then(function () { - context.event = event; - return _listener.apply(context, args) - })) : (nextTick ? process.nextTick : _setImmediate)(function () { - context.event = event; - _listener.apply(context, args) - }); - }; + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - listener._async = true; - listener._origin = _origin; - } + this.finalCalled = false; // drain event flag. - return [listener, objectify? new Listener(this, event, listener): this]; - } + this.needDrain = false; // at the start of calling end() - function EventEmitter(conf) { - this._events = {}; - this._newListener = false; - this._removeListener = false; - this.verboseMemoryLeak = false; - configure.call(this, conf); - } + this.ending = false; // when end() has been called, and returned - EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property + this.ended = false; // when 'finish' is emitted - EventEmitter.prototype.listenTo= function(target, events, options){ - if(typeof target!=='object'){ - throw TypeError('target musts be an object'); - } + this.finished = false; // has it been destroyed - var emitter= this; + this.destroyed = 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. - options = resolveOptions(options, { - on: undefined, - off: undefined, - reducers: undefined - }, { - on: functionReducer, - off: functionReducer, - reducers: objectFunctionReducer - }); + 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. - function listen(events){ - if(typeof events!=='object'){ - throw TypeError('events must be an object'); - } + 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. - var reducers= options.reducers; - var index= findTargetIndex.call(emitter, target); - var observer; + this.length = 0; // a flag to see when we're in the middle of a write. - if(index===-1){ - observer= new TargetObserver(emitter, target, options); - }else{ - observer= emitter._observers[index]; - } + this.writing = false; // when true all writes will be buffered until .uncork() call - var keys= ownKeys(events); - var len= keys.length; - var event; - var isSingleReducer= typeof reducers==='function'; + 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. - for(var i=0; i 0) { - observer = observers[i]; - if (!target || observer._target === target) { - observer.unsubscribe(event); - matched= true; - } - } + this.prefinished = false; // True if the error was already emitted and should not be thrown again - return matched; - }; + this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - // 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. - // - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') - EventEmitter.prototype.delimiter = '.'; + this.autoDestroy = !!options.autoDestroy; // count buffered requests - EventEmitter.prototype.setMaxListeners = function(n) { - if (n !== undefined) { - this._maxListeners = n; - if (!this._conf) this._conf = {}; - this._conf.maxListeners = n; - } - }; + this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two - EventEmitter.prototype.getMaxListeners = function() { - return this._maxListeners; - }; + this.corkedRequestsFree = new CorkedRequest(this); +} - EventEmitter.prototype.event = ''; +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; - EventEmitter.prototype.once = function(event, fn, options) { - return this._once(event, fn, false, options); - }; + while (current) { + out.push(current); + current = current.next; + } - EventEmitter.prototype.prependOnceListener = function(event, fn, options) { - return this._once(event, fn, true, options); - }; + return out; +}; - EventEmitter.prototype._once = function(event, fn, prepend, options) { - return this._many(event, 1, fn, prepend, options); - }; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); // Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. - EventEmitter.prototype.many = function(event, ttl, fn, options) { - return this._many(event, ttl, fn, false, options); + +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 value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; }; +} - EventEmitter.prototype.prependMany = function(event, ttl, fn, options) { - return this._many(event, ttl, fn, true, options); - }; +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. + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. + + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } - EventEmitter.prototype._many = function(event, ttl, fn, prepend, options) { - var self = this; + Stream.call(this); +} // Otherwise people can pipe Writable streams, which is just wrong. - if (typeof fn !== 'function') { - throw new Error('many only accepts instances of Function'); - } - function listener() { - if (--ttl === 0) { - self.off(event, listener); - } - return fn.apply(this, arguments); - } +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; - listener._origin = fn; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - return this._on(event, listener, prepend, options); - }; + errorOrDestroy(stream, er); + process.nextTick(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. - EventEmitter.prototype.emit = function() { - if (!this._events && !this._all) { - return false; - } - this._events || init.call(this); +function validChunk(stream, state, chunk, cb) { + var er; - var type = arguments[0], ns, wildcard= this.wildcard; - var args,l,i,j, containsSymbol; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { - return false; - } - } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } - if (wildcard) { - ns= type; - if(type!=='newListener' && type!=='removeListener'){ - if (typeof type === 'object') { - l = type.length; - if (symbolsSupported) { - for (i = 0; i < l; i++) { - if (typeof type[i] === 'symbol') { - containsSymbol = true; - break; - } - } - } - if (!containsSymbol) { - type = type.join(this.delimiter); - } - } - } - } + return true; +} - var al = arguments.length; - var handler; +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; - if (this._all && this._all.length) { - handler = this._all.slice(); + var isBuf = !state.objectMode && _isUint8Array(chunk); - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this, type); - break; - case 2: - handler[i].call(this, type, arguments[1]); - break; - case 3: - handler[i].call(this, type, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, arguments); - } - } - } + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } - if (wildcard) { - handler = []; - searchListenerTree.call(this, handler, ns, this.listenerTree, 0, l); - } else { - handler = this._events[type]; - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - handler.apply(this, args); - } - return true; - } else if (handler) { - // need to make copy of handlers because list can change in the middle - // of emit call - handler = handler.slice(); - } - } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } - if (handler && handler.length) { - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this); - break; - case 2: - handler[i].call(this, arguments[1]); - break; - case 3: - handler[i].call(this, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, args); - } - } - return true; - } else if (!this.ignoreErrors && !this._all && type === 'error') { - if (arguments[1] instanceof Error) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error("Uncaught, unspecified 'error' event."); - } - } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; - return !!this._all; - }; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; - EventEmitter.prototype.emitAsync = function() { - if (!this._events && !this._all) { - return false; - } +Writable.prototype.uncork = function () { + var state = this._writableState; - this._events || init.call(this); + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; - var type = arguments[0], wildcard= this.wildcard, ns, containsSymbol; - var args,l,i,j; +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 ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { return Promise.resolve([false]); } - } +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); - if (wildcard) { - ns= type; - if(type!=='newListener' && type!=='removeListener'){ - if (typeof type === 'object') { - l = type.length; - if (symbolsSupported) { - for (i = 0; i < l; i++) { - if (typeof type[i] === 'symbol') { - containsSymbol = true; - break; - } - } - } - if (!containsSymbol) { - type = type.join(this.delimiter); - } - } - } +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); // 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) { + var newChunk = decodeChunk(state, chunk, encoding); + + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; } + } - var promises= []; + 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. - var al = arguments.length; - var handler; + if (!ret) state.needDrain = true; - if (this._all) { - for (i = 0, l = this._all.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(this._all[i].call(this, type)); - break; - case 2: - promises.push(this._all[i].call(this, type, arguments[1])); - break; - case 3: - promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); - break; - default: - promises.push(this._all[i].apply(this, arguments)); - } - } - } + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; - if (wildcard) { - handler = []; - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); + if (last) { + last.next = state.lastBufferedRequest; } else { - handler = this._events[type]; - } - - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - promises.push(handler.call(this)); - break; - case 2: - promises.push(handler.call(this, arguments[1])); - break; - case 3: - promises.push(handler.call(this, arguments[1], arguments[2])); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - promises.push(handler.apply(this, args)); - } - } else if (handler && handler.length) { - handler = handler.slice(); - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(handler[i].call(this)); - break; - case 2: - promises.push(handler[i].call(this, arguments[1])); - break; - case 3: - promises.push(handler[i].call(this, arguments[1], arguments[2])); - break; - default: - promises.push(handler[i].apply(this, args)); - } - } - } else if (!this.ignoreErrors && !this._all && type === 'error') { - if (arguments[1] instanceof Error) { - return Promise.reject(arguments[1]); // Unhandled 'error' event - } else { - return Promise.reject("Uncaught, unspecified 'error' event."); - } + state.bufferedRequest = state.lastBufferedRequest; } - return Promise.all(promises); - }; + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } - EventEmitter.prototype.on = function(type, listener, options) { - return this._on(type, listener, false, options); - }; + return ret; +} - EventEmitter.prototype.prependListener = function(type, listener, options) { - return this._on(type, listener, true, options); - }; +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} - EventEmitter.prototype.onAny = function(fn) { - return this._onAny(fn, false); - }; +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; - EventEmitter.prototype.prependAny = function(fn) { - return this._onAny(fn, true); - }; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error - EventEmitter.prototype.addListener = EventEmitter.prototype.on; + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error + + finishMaybe(stream, state); + } +} - EventEmitter.prototype._onAny = function(fn, prepend){ - if (typeof fn !== 'function') { - throw new Error('onAny only accepts instances of Function'); - } +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} - if (!this._all) { - this._all = []; +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + 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) || stream.destroyed; + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - // Add the function to the event listener collection. - if(prepend){ - this._all.unshift(fn); - }else{ - this._all.push(fn); + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); } + } +} - return this; - }; +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. - EventEmitter.prototype._on = function(type, listener, prepend, options) { - if (typeof type === 'function') { - this._onAny(type, listener); - return this; - } - if (typeof listener !== 'function') { - throw new Error('on only accepts instances of Function'); +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; + var allBuffers = true; + + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; } - this._events || init.call(this); - var returnValue= this, temp; + buffer.allBuffers = allBuffers; + 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 - if (options !== undefined) { - temp = setupListener.call(this, type, listener, options); - listener = temp[0]; - returnValue = temp[1]; + state.pendingcb++; + state.lastBufferedRequest = null; + + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); } - // To avoid recursion in the case that type == "newListeners"! Before - // adding it to the listeners, first emit "newListeners". - if (this._newListener) { - this.emit('newListener', type, listener); + state.bufferedRequestCount = 0; + } 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; + state.bufferedRequestCount--; // 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 (this.wildcard) { - growListenerTree.call(this, type, listener, prepend); - return returnValue; + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; + +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) endWritable(this, state, cb); + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + + if (err) { + errorOrDestroy(stream, err); } - if (!this._events[type]) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} + +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); } else { - if (typeof this._events[type] === 'function') { - // Change to array. - this._events[type] = [this._events[type]]; - } + state.prefinished = true; + stream.emit('prefinish'); + } + } +} - // If we've already got an array, just add - if(prepend){ - this._events[type].unshift(listener); - }else{ - this._events[type].push(listener); - } +function finishMaybe(stream, state) { + var need = needFinish(state); - // Check for listener leak - if ( - !this._events[type].warned && - this._maxListeners > 0 && - this._events[type].length > this._maxListeners - ) { - this._events[type].warned = true; - logPossibleMemoryLeak.call(this, this._events[type].length, type); + if (need) { + prefinish(stream, state); + + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } } } + } - return returnValue; - }; + return need; +} - EventEmitter.prototype.off = function(type, listener) { - if (typeof listener !== 'function') { - throw new Error('removeListener only takes instances of Function'); +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. + + + state.corkedRequestsFree.next = corkReq; +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; } - var handlers,leafs=[]; + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - if(!leafs) return this; - } else { - // does not use listeners(), so no side effect of creating _events[type] - if (!this._events[type]) return this; - handlers = this._events[type]; - leafs.push({_listeners:handlers}); + + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; + +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":47,"./_stream_duplex":48,"./internal/streams/destroy":55,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"inherits":27,"util-deprecate":63}],53:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +var _Object$setPrototypeO; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var finished = require('./end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); + +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} + +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' + + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); } + } +} - for (var iLeaf=0; iLeaf 0) { - fns = this._all; - for(i = 0, l = fns.length; i < l; i++) { - if(fn === fns[i]) { - fns.splice(i, 1); - if (this._removeListener) - this.emit("removeListenerAny", fn); - return this; - } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); + +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; } - } else { - fns = this._all; - if (this._removeListener) { - for(i = 0, l = fns.length; i < l; i++) - this.emit("removeListenerAny", fns[i]); + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error + + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } - this._all = []; + + iterator[kError] = err; + return; + } + + var resolve = iterator[kLastResolve]; + + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); } - return this; - }; - EventEmitter.prototype.removeListener = EventEmitter.prototype.off; + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; - EventEmitter.prototype.removeAllListeners = function (type) { - if (type === undefined) { - !this._events || init.call(this); - return this; +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":56,"_process":44}],54:[function(require,module,exports){ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var _require = require('buffer'), + Buffer = _require.Buffer; + +var _require2 = require('util'), + inspect = _require2.inspect; + +var custom = inspect && inspect.custom || 'inspect'; + +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} + +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + 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; } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + + while (p = p.next) { + ret += s + p.data; + } - if (this.wildcard) { - var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i; - if (!leafs) return this; - for (i = 0; i < leafs.length; i++) { - leaf = leafs[i]; - leaf._listeners = null; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; } - this.listenerTree && recursivelyGarbageCollect(this.listenerTree); - } else if (this._events) { - this._events[type] = null; + + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. + + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + + return ret; } - return this; - }; + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. + + }, { + key: "_getString", + value: function _getString(n) { + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } - EventEmitter.prototype.listeners = function (type) { - var _events = this._events; - var keys, listeners, allListeners; - var i; - var listenerTree; + break; + } - if (type === undefined) { - if (this.wildcard) { - throw Error('event name required for wildcard emitter'); + ++c; } - if (!_events) { - return []; - } + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. + + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } - keys = ownKeys(_events); - i = keys.length; - allListeners = []; - while (i-- > 0) { - listeners = _events[keys[i]]; - if (typeof listeners === 'function') { - allListeners.push(listeners); - } else { - allListeners.push.apply(allListeners, listeners); + break; } - } - return allListeners; - } else { - if (this.wildcard) { - listenerTree= this.listenerTree; - if(!listenerTree) return []; - var handlers = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handlers, ns, listenerTree, 0); - return handlers; - } - if (!_events) { - return []; + ++c; } - listeners = _events[type]; + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. + + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); - if (!listeners) { - return []; + return BufferList; +}(); +},{"buffer":11,"util":7}],55:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; // undocumented cb() API, needed for core, not for public API + +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); } - return typeof listeners === 'function' ? [listeners] : listeners; } - }; - EventEmitter.prototype.eventNames = function(nsAsArray){ - var _events= this._events; - return this.wildcard? collectTreeEvents.call(this, this.listenerTree, [], null, nsAsArray) : (_events? ownKeys(_events) : []); - }; + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks - EventEmitter.prototype.listenerCount = function(type) { - return this.listeners(type).length; - }; - EventEmitter.prototype.hasListeners = function (type) { - if (this.wildcard) { - var handlers = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); - return handlers.length > 0; + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well + + + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); } + }); - var _events = this._events; - var _all = this._all; + return this; +} - return !!(_all && _all.length || _events && (type === undefined ? ownKeys(_events).length : _events[type])); - }; +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} - EventEmitter.prototype.listenersAny = function() { +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} - if(this._all) { - return this._all; - } - else { - return []; - } +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } - }; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} - EventEmitter.prototype.waitFor = function (event, options) { - var self = this; - var type = typeof options; - if (type === 'number') { - options = {timeout: options}; - } else if (type === 'function') { - options = {filter: options}; - } +function emitErrorNT(self, err) { + self.emit('error', err); +} - options= resolveOptions(options, { - timeout: 0, - filter: undefined, - handleError: false, - Promise: Promise, - overload: false - }, { - filter: functionReducer, - Promise: constructorReducer - }); +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} - return makeCancelablePromise(options.Promise, function (resolve, reject, onCancel) { - function listener() { - var filter= options.filter; - if (filter && !filter.apply(self, arguments)) { - return; - } - self.off(event, listener); - if (options.handleError) { - var err = arguments[0]; - err ? reject(err) : resolve(toArray.apply(null, arguments).slice(1)); - } else { - resolve(toArray.apply(null, arguments)); - } - } +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this)}).call(this,require('_process')) +},{"_process":44}],56:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; - onCancel(function(){ - self.off(event, listener); - }); +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; - self._on(event, listener, false); - }, { - timeout: options.timeout, - overload: options.overload - }) - }; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; - function once(emitter, name, options) { - options= resolveOptions(options, { - Promise: Promise, - timeout: 0, - overload: false - }, { - Promise: constructorReducer - }); + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } - var _Promise= options.Promise; + callback.apply(this, args); + }; +} - return makeCancelablePromise(_Promise, function(resolve, reject, onCancel){ - var handler; - if (typeof emitter.addEventListener === 'function') { - handler= function () { - resolve(toArray.apply(null, arguments)); - }; +function noop() {} - onCancel(function(){ - emitter.removeEventListener(name, handler); - }); +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} - emitter.addEventListener( - name, - handler, - {once: true} - ); - return; - } +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; - var eventListener = function(){ - errorListener && emitter.removeListener('error', errorListener); - resolve(toArray.apply(null, arguments)); - }; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; - var errorListener; + var writableEnded = stream._writableState && stream._writableState.finished; - if (name !== 'error') { - errorListener = function (err){ - emitter.removeListener(name, eventListener); - reject(err); - }; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; - emitter.once('error', errorListener); - } + var readableEnded = stream._readableState && stream._readableState.endEmitted; - onCancel(function(){ - errorListener && emitter.removeListener('error', errorListener); - emitter.removeListener(name, eventListener); - }); + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; - emitter.once(name, eventListener); - }, { - timeout: options.timeout, - overload: options.overload - }); - } + var onerror = function onerror(err) { + callback.call(stream, err); + }; - var prototype= EventEmitter.prototype; + var onclose = function onclose() { + var err; - Object.defineProperties(EventEmitter, { - defaultMaxListeners: { - get: function () { - return prototype._maxListeners; - }, - set: function (n) { - if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) { - throw TypeError('n must be a non-negative number') - } - prototype._maxListeners = n; - }, - enumerable: true - }, - once: { - value: once, - writable: true, - configurable: true + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - }); - Object.defineProperties(prototype, { - _maxListeners: { - value: defaultMaxListeners, - writable: true, - configurable: true - }, - _observers: {value: null, writable: true, configurable: true} - }); + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(function() { - return EventEmitter; - }); - } else if (typeof exports === 'object') { - // CommonJS - module.exports = EventEmitter; - } - else { - // global for any kind of environment. - var _global= new Function('','return this')(); - _global.EventEmitter2 = EventEmitter; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); } -}(); -}).call(this)}).call(this,require('_process'),require("timers").setImmediate) -},{"_process":4,"timers":5}],3:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; +},{"../../../errors":47}],57:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + +},{}],58:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). 'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } +var eos; - return Object(val); +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; } -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want + + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } +function call(fn) { + fn(); } -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; +function pipe(from, to) { + return from.pipe(to); +} - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; - return to; -}; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } -},{}],4:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} -// 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. +module.exports = pipeline; +},{"../../../errors":47,"./end-of-stream":56}],59:[function(require,module,exports){ +'use strict'; -var cachedSetTimeout; -var cachedClearTimeout; +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } -(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 getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); -} -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); - } + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } + return Math.floor(hwm); + } // Default value + return state.objectMode ? 16 : 16 * 1024; } -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(); +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":47}],60:[function(require,module,exports){ +module.exports = require('events').EventEmitter; + +},{"events":17}],61:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/**/ + +var 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; } -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +// 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); +} - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; +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. If an invalid byte is detected, -2 is returned. +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 byte >> 6 === 0x02 ? -1 : -2; +} + +// 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 || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } - currentQueue = null; - draining = false; - runClearTimeout(timeout); + return nb; + } + return 0; } -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]; - } +// 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 +// a single UTF-8 replacement character ('\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'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } } -}; + } +} -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; +// 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; } -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() {} +// 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); +} -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; +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} -process.listeners = function (name) { return [] } +// 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); +} -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; +// 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; +} -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; +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); +} -},{}],5:[function(require,module,exports){ +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} +},{"safe-buffer":45}],62:[function(require,module,exports){ (function (setImmediate,clearImmediate){(function (){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -2396,1882 +17822,3189 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : delete immediateIds[id]; }; }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":4,"timers":5}],6:[function(require,module,exports){ -function webpackBootstrapFunc (modules) { -/******/ // The module cache -/******/ var installedModules = {}; +},{"process/browser.js":44,"timers":62}],63:[function(require,module,exports){ +(function (global){(function (){ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { +/** + * Module exports. + */ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; +module.exports = deprecate; -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; +/** + * 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 + */ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } -/******/ // Flag the module as loaded -/******/ module.l = true; + 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 the exports of the module -/******/ return module.exports; -/******/ } + return deprecated; +} -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; +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'; +} -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],64:[function(require,module,exports){ +arguments[4][3][0].apply(exports,arguments) +},{"dup":3}],65:[function(require,module,exports){ +// Currently in sync with Node.js lib/internal/util/types.js +// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; +'use strict'; -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; +var isArgumentsObject = require('is-arguments'); +var isGeneratorFunction = require('is-generator-function'); +var whichTypedArray = require('which-typed-array'); +var isTypedArray = require('is-typed-array'); -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; +function uncurryThis(f) { + return f.call.bind(f); +} -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +var BigIntSupported = typeof BigInt !== 'undefined'; +var SymbolSupported = typeof Symbol !== 'undefined'; -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/"; +var ObjectToString = uncurryThis(Object.prototype.toString); -/******/ // on error function for async loading -/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; +var numberValue = uncurryThis(Number.prototype.valueOf); +var stringValue = uncurryThis(String.prototype.valueOf); +var booleanValue = uncurryThis(Boolean.prototype.valueOf); - var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE) - return f.default || f // try to call default if defined to also support babel esmodule exports +if (BigIntSupported) { + var bigIntValue = uncurryThis(BigInt.prototype.valueOf); } -var moduleNameReqExp = '[\\.|\\-|\\+|\\w|\/|@]+' -var dependencyRegExp = '\\(\\s*(\/\\*.*?\\*\/)?\\s*.*?(' + moduleNameReqExp + ').*?\\)' // additional chars when output.pathinfo is true +if (SymbolSupported) { + var symbolValue = uncurryThis(Symbol.prototype.valueOf); +} -// http://stackoverflow.com/a/2593661/130442 -function quoteRegExp (str) { - return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&') +function checkBoxedPrimitive(value, prototypeValueOf) { + if (typeof value !== 'object') { + return false; + } + try { + prototypeValueOf(value); + return true; + } catch(e) { + return false; + } } -function isNumeric(n) { - return !isNaN(1 * n); // 1 * n converts integers, integers as string ("123"), 1e3 and "1e3" to integers and strings to NaN +exports.isArgumentsObject = isArgumentsObject; +exports.isGeneratorFunction = isGeneratorFunction; +exports.isTypedArray = isTypedArray; + +// Taken from here and modified for better browser support +// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js +function isPromise(input) { + return ( + ( + typeof Promise !== 'undefined' && + input instanceof Promise + ) || + ( + input !== null && + typeof input === 'object' && + typeof input.then === 'function' && + typeof input.catch === 'function' + ) + ); } +exports.isPromise = isPromise; -function getModuleDependencies (sources, module, queueName) { - var retval = {} - retval[queueName] = [] +function isArrayBufferView(value) { + if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { + return ArrayBuffer.isView(value); + } - var fnString = module.toString() - var wrapperSignature = fnString.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/) - if (!wrapperSignature) return retval - var webpackRequireName = wrapperSignature[1] + return ( + isTypedArray(value) || + isDataView(value) + ); +} +exports.isArrayBufferView = isArrayBufferView; - // main bundle deps - var re = new RegExp('(\\\\n|\\W)' + quoteRegExp(webpackRequireName) + dependencyRegExp, 'g') - var match - while ((match = re.exec(fnString))) { - if (match[3] === 'dll-reference') continue - retval[queueName].push(match[3]) + +function isUint8Array(value) { + return whichTypedArray(value) === 'Uint8Array'; +} +exports.isUint8Array = isUint8Array; + +function isUint8ClampedArray(value) { + return whichTypedArray(value) === 'Uint8ClampedArray'; +} +exports.isUint8ClampedArray = isUint8ClampedArray; + +function isUint16Array(value) { + return whichTypedArray(value) === 'Uint16Array'; +} +exports.isUint16Array = isUint16Array; + +function isUint32Array(value) { + return whichTypedArray(value) === 'Uint32Array'; +} +exports.isUint32Array = isUint32Array; + +function isInt8Array(value) { + return whichTypedArray(value) === 'Int8Array'; +} +exports.isInt8Array = isInt8Array; + +function isInt16Array(value) { + return whichTypedArray(value) === 'Int16Array'; +} +exports.isInt16Array = isInt16Array; + +function isInt32Array(value) { + return whichTypedArray(value) === 'Int32Array'; +} +exports.isInt32Array = isInt32Array; + +function isFloat32Array(value) { + return whichTypedArray(value) === 'Float32Array'; +} +exports.isFloat32Array = isFloat32Array; + +function isFloat64Array(value) { + return whichTypedArray(value) === 'Float64Array'; +} +exports.isFloat64Array = isFloat64Array; + +function isBigInt64Array(value) { + return whichTypedArray(value) === 'BigInt64Array'; +} +exports.isBigInt64Array = isBigInt64Array; + +function isBigUint64Array(value) { + return whichTypedArray(value) === 'BigUint64Array'; +} +exports.isBigUint64Array = isBigUint64Array; + +function isMapToString(value) { + return ObjectToString(value) === '[object Map]'; +} +isMapToString.working = ( + typeof Map !== 'undefined' && + isMapToString(new Map()) +); + +function isMap(value) { + if (typeof Map === 'undefined') { + return false; + } + + return isMapToString.working + ? isMapToString(value) + : value instanceof Map; +} +exports.isMap = isMap; + +function isSetToString(value) { + return ObjectToString(value) === '[object Set]'; +} +isSetToString.working = ( + typeof Set !== 'undefined' && + isSetToString(new Set()) +); +function isSet(value) { + if (typeof Set === 'undefined') { + return false; + } + + return isSetToString.working + ? isSetToString(value) + : value instanceof Set; +} +exports.isSet = isSet; + +function isWeakMapToString(value) { + return ObjectToString(value) === '[object WeakMap]'; +} +isWeakMapToString.working = ( + typeof WeakMap !== 'undefined' && + isWeakMapToString(new WeakMap()) +); +function isWeakMap(value) { + if (typeof WeakMap === 'undefined') { + return false; + } + + return isWeakMapToString.working + ? isWeakMapToString(value) + : value instanceof WeakMap; +} +exports.isWeakMap = isWeakMap; + +function isWeakSetToString(value) { + return ObjectToString(value) === '[object WeakSet]'; +} +isWeakSetToString.working = ( + typeof WeakSet !== 'undefined' && + isWeakSetToString(new WeakSet()) +); +function isWeakSet(value) { + return isWeakSetToString(value); +} +exports.isWeakSet = isWeakSet; + +function isArrayBufferToString(value) { + return ObjectToString(value) === '[object ArrayBuffer]'; +} +isArrayBufferToString.working = ( + typeof ArrayBuffer !== 'undefined' && + isArrayBufferToString(new ArrayBuffer()) +); +function isArrayBuffer(value) { + if (typeof ArrayBuffer === 'undefined') { + return false; + } + + return isArrayBufferToString.working + ? isArrayBufferToString(value) + : value instanceof ArrayBuffer; +} +exports.isArrayBuffer = isArrayBuffer; + +function isDataViewToString(value) { + return ObjectToString(value) === '[object DataView]'; +} +isDataViewToString.working = ( + typeof ArrayBuffer !== 'undefined' && + typeof DataView !== 'undefined' && + isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) +); +function isDataView(value) { + if (typeof DataView === 'undefined') { + return false; + } + + return isDataViewToString.working + ? isDataViewToString(value) + : value instanceof DataView; +} +exports.isDataView = isDataView; + +// Store a copy of SharedArrayBuffer in case it's deleted elsewhere +var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined; +function isSharedArrayBufferToString(value) { + return ObjectToString(value) === '[object SharedArrayBuffer]'; +} +function isSharedArrayBuffer(value) { + if (typeof SharedArrayBufferCopy === 'undefined') { + return false; + } + + if (typeof isSharedArrayBufferToString.working === 'undefined') { + isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); } - // dll deps - re = new RegExp('\\(' + quoteRegExp(webpackRequireName) + '\\("(dll-reference\\s(' + moduleNameReqExp + '))"\\)\\)' + dependencyRegExp, 'g') - while ((match = re.exec(fnString))) { - if (!sources[match[2]]) { - retval[queueName].push(match[1]) - sources[match[2]] = __webpack_require__(match[1]).m + return isSharedArrayBufferToString.working + ? isSharedArrayBufferToString(value) + : value instanceof SharedArrayBufferCopy; +} +exports.isSharedArrayBuffer = isSharedArrayBuffer; + +function isAsyncFunction(value) { + return ObjectToString(value) === '[object AsyncFunction]'; +} +exports.isAsyncFunction = isAsyncFunction; + +function isMapIterator(value) { + return ObjectToString(value) === '[object Map Iterator]'; +} +exports.isMapIterator = isMapIterator; + +function isSetIterator(value) { + return ObjectToString(value) === '[object Set Iterator]'; +} +exports.isSetIterator = isSetIterator; + +function isGeneratorObject(value) { + return ObjectToString(value) === '[object Generator]'; +} +exports.isGeneratorObject = isGeneratorObject; + +function isWebAssemblyCompiledModule(value) { + return ObjectToString(value) === '[object WebAssembly.Module]'; +} +exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; + +function isNumberObject(value) { + return checkBoxedPrimitive(value, numberValue); +} +exports.isNumberObject = isNumberObject; + +function isStringObject(value) { + return checkBoxedPrimitive(value, stringValue); +} +exports.isStringObject = isStringObject; + +function isBooleanObject(value) { + return checkBoxedPrimitive(value, booleanValue); +} +exports.isBooleanObject = isBooleanObject; + +function isBigIntObject(value) { + return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); +} +exports.isBigIntObject = isBigIntObject; + +function isSymbolObject(value) { + return SymbolSupported && checkBoxedPrimitive(value, symbolValue); +} +exports.isSymbolObject = isSymbolObject; + +function isBoxedPrimitive(value) { + return ( + isNumberObject(value) || + isStringObject(value) || + isBooleanObject(value) || + isBigIntObject(value) || + isSymbolObject(value) + ); +} +exports.isBoxedPrimitive = isBoxedPrimitive; + +function isAnyArrayBuffer(value) { + return typeof Uint8Array !== 'undefined' && ( + isArrayBuffer(value) || + isSharedArrayBuffer(value) + ); +} +exports.isAnyArrayBuffer = isAnyArrayBuffer; + +['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { + Object.defineProperty(exports, method, { + enumerable: false, + value: function() { + throw new Error(method + ' is not supported in userland'); } - retval[match[2]] = retval[match[2]] || [] - retval[match[2]].push(match[4]) - } + }); +}); + +},{"is-arguments":28,"is-generator-function":29,"is-typed-array":30,"which-typed-array":69}],66:[function(require,module,exports){ +(function (process){(function (){ +// 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. + +var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || + function getOwnPropertyDescriptors(obj) { + var keys = Object.keys(obj); + var descriptors = {}; + for (var i = 0; i < keys.length; i++) { + descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); + } + return descriptors; + }; - // convert 1e3 back to 1000 - this can be important after uglify-js converted 1000 to 1e3 - var keys = Object.keys(retval); - for (var i = 0; i < keys.length; i++) { - for (var j = 0; j < retval[keys[i]].length; j++) { - if (isNumeric(retval[keys[i]][j])) { - retval[keys[i]][j] = 1 * retval[keys[i]][j]; - } +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); } + return objects.join(' '); } - return retval -} + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; -function hasValuesInQueues (queues) { - var keys = Object.keys(queues) - return keys.reduce(function (hasValues, key) { - return hasValues || queues[key].length > 0 - }, false) -} -function getRequiredModules (sources, moduleId) { - var modulesQueue = { - main: [moduleId] +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + if (typeof process !== 'undefined' && process.noDeprecation === true) { + return fn; } - var requiredModules = { - main: [] - } - var seenModules = { - main: {} + + // Allow for deprecating things in the process of starting up. + if (typeof process === 'undefined') { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; } - while (hasValuesInQueues(modulesQueue)) { - var queues = Object.keys(modulesQueue) - for (var i = 0; i < queues.length; i++) { - var queueName = queues[i] - var queue = modulesQueue[queueName] - var moduleToCheck = queue.pop() - seenModules[queueName] = seenModules[queueName] || {} - if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck]) continue - seenModules[queueName][moduleToCheck] = true - requiredModules[queueName] = requiredModules[queueName] || [] - requiredModules[queueName].push(moduleToCheck) - var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName) - var newModulesKeys = Object.keys(newModules) - for (var j = 0; j < newModulesKeys.length; j++) { - modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || [] - modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]]) + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); } + warned = true; } + return fn.apply(this, arguments); } - return requiredModules -} + return deprecated; +}; -module.exports = function (moduleId, options) { - options = options || {} - var sources = { - main: __webpack_modules__ + +var debugs = {}; +var debugEnvRegex = /^$/; + +if (process.env.NODE_DEBUG) { + var debugEnv = process.env.NODE_DEBUG; + debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') + .replace(/\*/g, '.*') + .replace(/,/g, '$|^') + .toUpperCase(); + debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); +} +exports.debuglog = function(set) { + set = set.toUpperCase(); + if (!debugs[set]) { + if (debugEnvRegex.test(set)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } } + return debugs[set]; +}; - var requiredModules = options.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId) - var src = '' +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; - Object.keys(requiredModules).filter(function (m) { return m !== 'main' }).forEach(function (module) { - var entryModule = 0 - while (requiredModules[module][entryModule]) { - entryModule++ - } - requiredModules[module].push(entryModule) - sources[module][entryModule] = '(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })' - src = src + 'var ' + module + ' = (' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(entryModule)) + ')({' + requiredModules[module].map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[module][id].toString() }).join(',') + '});\n' - }) +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; - src = src + 'new ((' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.main.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources.main[id].toString() }).join(',') + '}))(self);' - var blob = new window.Blob([src], { type: 'text/javascript' }) - if (options.bare) { return blob } +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; - var URL = window.URL || window.webkitURL || window.mozURL || window.msURL + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} - var workerUrl = URL.createObjectURL(blob) - var worker = new window.Worker(workerUrl) - worker.objectURL = workerUrl - return worker +function stylizeNoColor(str, styleType) { + return str; } -},{}],7:[function(require,module,exports){ -var bundleFn = arguments[3]; -var sources = arguments[4]; -var cache = arguments[5]; -var stringify = JSON.stringify; +function arrayToHash(array) { + var hash = {}; -module.exports = function (fn, options) { - var wkey; - var cacheKeys = Object.keys(cache); + array.forEach(function(val, idx) { + hash[val] = true; + }); - for (var i = 0, l = cacheKeys.length; i < l; i++) { - var key = cacheKeys[i]; - var exp = cache[key].exports; - // Using babel as a transpiler to use esmodule, the export will always - // be an object with the default export as a property of it. To ensure - // the existing api and babel esmodule exports are both supported we - // check for both - if (exp === fn || exp && exp.default === fn) { - wkey = key; - break; - } - } + return hash; +} - if (!wkey) { - wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); - var wcache = {}; - for (var i = 0, l = cacheKeys.length; i < l; i++) { - var key = cacheKeys[i]; - wcache[key] = key; - } - sources[wkey] = [ - 'function(require,module,exports){' + fn + '(self); }', - wcache - ]; + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); } - var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); + return ret; + } - var scache = {}; scache[wkey] = wkey; - sources[skey] = [ - 'function(require,module,exports){' + - // try to call default if defined to also support babel esmodule exports - 'var f = require(' + stringify(wkey) + ');' + - '(f.default ? f.default : f)(self);' + - '}', - scache - ]; + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } - var workerSources = {}; - resolveSources(skey); + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); - function resolveSources(key) { - workerSources[key] = true; + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } - for (var depPath in sources[key][1]) { - var depKey = sources[key][1][depPath]; - if (!workerSources[depKey]) { - resolveSources(depKey); - } - } - } + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } - var src = '(' + bundleFn + ')({' - + Object.keys(workerSources).map(function (key) { - return stringify(key) + ':[' - + sources[key][0] - + ',' + stringify(sources[key][1]) + ']' - ; - }).join(',') - + '},{},[' + stringify(skey) + '])' - ; + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } - var URL = window.URL || window.webkitURL || window.mozURL || window.msURL; + var base = '', array = false, braces = ['{', '}']; - var blob = new Blob([src], { type: 'text/javascript' }); - if (options && options.bare) { return blob; } - var workerUrl = URL.createObjectURL(blob); - var worker = new Worker(workerUrl); - worker.objectURL = workerUrl; - return worker; -}; + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } -},{}],8:[function(require,module,exports){ -/** - * @fileOverview - * @author Russell Toris - rctoris@wpi.edu - */ + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } -/** - * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. - * - * If you use nodejs, this is the variable you get when you require('roslib'). - */ -var ROSLIB = this.ROSLIB || { - /** - * @default - * @description Library version - */ - REVISION : '1.3.0' -}; + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } -var assign = require('object-assign'); + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } -// Add core components -assign(ROSLIB, require('./core')); + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } -assign(ROSLIB, require('./actionlib')); + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } -assign(ROSLIB, require('./math')); + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } -assign(ROSLIB, require('./tf')); + ctx.seen.push(value); -assign(ROSLIB, require('./urdf')); + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } -module.exports = ROSLIB; + ctx.seen.pop(); -},{"./actionlib":14,"./core":23,"./math":28,"./tf":31,"./urdf":43,"object-assign":3}],9:[function(require,module,exports){ -(function (global){(function (){ -global.ROSLIB = require('./RosLib'); -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./RosLib":8}],10:[function(require,module,exports){ -/** - * @fileOverview - * @author Russell Toris - rctoris@wpi.edu - */ + return reduceToSingleString(output, base, braces); +} -var Topic = require('../core/Topic'); -var Message = require('../core/Message'); -var EventEmitter2 = require('eventemitter2').EventEmitter2; -/** - * An actionlib action client. - * - * Emits the following events: - * * 'timeout' - If a timeout occurred while sending a goal. - * * 'status' - The status messages received from the action server. - * * 'feedback' - The feedback messages received from the action server. - * * 'result' - The result returned from the action server. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. - * @param {number} [options.timeout] - The timeout length when connecting to the action server. - * @param {boolean} [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not. - * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. - * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. - */ -function ActionClient(options) { - var that = this; - options = options || {}; - this.ros = options.ros; - this.serverName = options.serverName; - this.actionName = options.actionName; - this.timeout = options.timeout; - this.omitFeedback = options.omitFeedback; - this.omitStatus = options.omitStatus; - this.omitResult = options.omitResult; - this.goals = {}; - - // flag to check if a status has been received - var receivedStatus = false; - - // create the topics associated with actionlib - this.feedbackListener = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' - }); +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} - this.statusListener = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' - }); - this.resultListener = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' - }); +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} - this.goalTopic = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' - }); - this.cancelTopic = new Topic({ - ros : this.ros, - name : this.serverName + '/cancel', - messageType : 'actionlib_msgs/GoalID' +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } }); + return output; +} - // advertise the goal and cancel topics - this.goalTopic.advertise(); - this.cancelTopic.advertise(); - // subscribe to the status topic - if (!this.omitStatus) { - this.statusListener.subscribe(function(statusMessage) { - receivedStatus = true; - statusMessage.status_list.forEach(function(status) { - var goal = that.goals[status.goal_id.id]; - if (goal) { - goal.emit('status', status); - } - }); - }); +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } } - - // subscribe the the feedback topic - if (!this.omitFeedback) { - this.feedbackListener.subscribe(function(feedbackMessage) { - var goal = that.goals[feedbackMessage.status.goal_id.id]; - if (goal) { - goal.emit('status', feedbackMessage.status); - goal.emit('feedback', feedbackMessage.feedback); + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); } - }); + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } } - // subscribe to the result topic - if (!this.omitResult) { - this.resultListener.subscribe(function(resultMessage) { - var goal = that.goals[resultMessage.status.goal_id.id]; + return name + ': ' + str; +} - if (goal) { - goal.emit('status', resultMessage.status); - goal.emit('result', resultMessage.result); - } - }); - } - // If timeout specified, emit a 'timeout' event if the action server does not respond - if (this.timeout) { - setTimeout(function() { - if (!receivedStatus) { - that.emit('timeout'); - } - }, this.timeout); +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } -ActionClient.prototype.__proto__ = EventEmitter2.prototype; -/** - * Cancel all goals associated with this ActionClient. - */ -ActionClient.prototype.cancel = function() { - var cancelMessage = new Message(); - this.cancelTopic.publish(cancelMessage); -}; +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +exports.types = require('./support/types'); -/** - * Unsubscribe and unadvertise all topics associated with this ActionClient. - */ -ActionClient.prototype.dispose = function() { - this.goalTopic.unadvertise(); - this.cancelTopic.unadvertise(); - if (!this.omitStatus) {this.statusListener.unsubscribe();} - if (!this.omitFeedback) {this.feedbackListener.unsubscribe();} - if (!this.omitResult) {this.resultListener.unsubscribe();} -}; +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; -module.exports = ActionClient; +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; -},{"../core/Message":15,"../core/Topic":22,"eventemitter2":2}],11:[function(require,module,exports){ -/** - * @fileOverview - * @author Justin Young - justin@oodar.com.au - * @author Russell Toris - rctoris@wpi.edu - */ +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; -var Topic = require('../core/Topic'); -var Message = require('../core/Message'); -var EventEmitter2 = require('eventemitter2').EventEmitter2; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; -/** - * An actionlib action listener. - * - * Emits the following events: - * * 'status' - The status messages received from the action server. - * * 'feedback' - The feedback messages received from the action server. - * * 'result' - The result returned from the action server. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. - */ -function ActionListener(options) { - var that = this; - options = options || {}; - this.ros = options.ros; - this.serverName = options.serverName; - this.actionName = options.actionName; - - - // create the topics associated with actionlib - var goalListener = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' - }); +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - var feedbackListener = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' - }); +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - var statusListener = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' - }); +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - var resultListener = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' - }); +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - goalListener.subscribe(function(goalMessage) { - that.emit('goal', goalMessage); - }); +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; +exports.types.isRegExp = isRegExp; - statusListener.subscribe(function(statusMessage) { - statusMessage.status_list.forEach(function(status) { - that.emit('status', status); - }); - }); +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - feedbackListener.subscribe(function(feedbackMessage) { - that.emit('status', feedbackMessage.status); - that.emit('feedback', feedbackMessage.feedback); - }); +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; +exports.types.isDate = isDate; - // subscribe to the result topic - resultListener.subscribe(function(resultMessage) { - that.emit('status', resultMessage.status); - that.emit('result', resultMessage.result); - }); +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; +exports.types.isNativeError = 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; -ActionListener.prototype.__proto__ = EventEmitter2.prototype; +exports.isBuffer = require('./support/isBuffer'); -module.exports = ActionListener; +function objectToString(o) { + return Object.prototype.toString.call(o); +} -},{"../core/Message":15,"../core/Topic":22,"eventemitter2":2}],12:[function(require,module,exports){ -/** - * @fileOverview - * @author Russell Toris - rctoris@wpi.edu - */ -var Message = require('../core/Message'); -var EventEmitter2 = require('eventemitter2').EventEmitter2; +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} -/** - * An actionlib goal that is associated with an action server. - * - * Emits the following events: - * * 'timeout' - If a timeout occurred while sending a goal. - * - * @constructor - * @param {Object} options - * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. - * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. - */ -function Goal(options) { - var that = this; - this.actionClient = options.actionClient; - this.goalMessage = options.goalMessage; - this.isFinished = false; - - // Used to create random IDs - var date = new Date(); - - // Create a random ID - this.goalID = 'goal_' + Math.random() + '_' + date.getTime(); - // Fill in the goal message - this.goalMessage = new Message({ - goal_id : { - stamp : { - secs : 0, - nsecs : 0 - }, - id : this.goalID - }, - goal : this.goalMessage - }); - this.on('status', function(status) { - that.status = status; - }); +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; - this.on('result', function(result) { - that.isFinished = true; - that.result = result; - }); +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} - this.on('feedback', function(feedback) { - that.feedback = feedback; - }); - // Add the goal - this.actionClient.goals[this.goalID] = this; -} +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; -Goal.prototype.__proto__ = EventEmitter2.prototype; /** - * Send the goal to the action server. + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). * - * @param {number} [timeout] - A timeout length for the goal's result. + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. */ -Goal.prototype.send = function(timeout) { - var that = this; - that.actionClient.goalTopic.publish(that.goalMessage); - if (timeout) { - setTimeout(function() { - if (!that.isFinished) { - that.emit('timeout'); - } - }, timeout); - } -}; +exports.inherits = require('inherits'); -/** - * Cancel the current goal. - */ -Goal.prototype.cancel = function() { - var cancelMessage = new Message({ - id : this.goalID - }); - this.actionClient.cancelTopic.publish(cancelMessage); +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; }; -module.exports = Goal; +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} -},{"../core/Message":15,"eventemitter2":2}],13:[function(require,module,exports){ -/** - * @fileOverview - * @author Laura Lindzey - lindzey@gmail.com - */ +var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; -var Topic = require('../core/Topic'); -var Message = require('../core/Message'); -var EventEmitter2 = require('eventemitter2').EventEmitter2; +exports.promisify = function promisify(original) { + if (typeof original !== 'function') + throw new TypeError('The "original" argument must be of type Function'); -/** - * An actionlib action server client. - * - * Emits the following events: - * * 'goal' - Goal sent by action client. - * * 'cancel' - Action client has canceled the request. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.serverName - The action server name, like '/fibonacci'. - * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. - */ -function SimpleActionServer(options) { - var that = this; - options = options || {}; - this.ros = options.ros; - this.serverName = options.serverName; - this.actionName = options.actionName; - - // create and advertise publishers - this.feedbackPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/feedback', - messageType : this.actionName + 'Feedback' + if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { + var fn = original[kCustomPromisifiedSymbol]; + if (typeof fn !== 'function') { + throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + } + Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true }); - this.feedbackPublisher.advertise(); + return fn; + } - var statusPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/status', - messageType : 'actionlib_msgs/GoalStatusArray' + function fn() { + var promiseResolve, promiseReject; + var promise = new Promise(function (resolve, reject) { + promiseResolve = resolve; + promiseReject = reject; }); - statusPublisher.advertise(); - this.resultPublisher = new Topic({ - ros : this.ros, - name : this.serverName + '/result', - messageType : this.actionName + 'Result' + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + args.push(function (err, value) { + if (err) { + promiseReject(err); + } else { + promiseResolve(value); + } }); - this.resultPublisher.advertise(); - // create and subscribe to listeners - var goalListener = new Topic({ - ros : this.ros, - name : this.serverName + '/goal', - messageType : this.actionName + 'Goal' - }); + try { + original.apply(this, args); + } catch (err) { + promiseReject(err); + } - var cancelListener = new Topic({ - ros : this.ros, - name : this.serverName + '/cancel', - messageType : 'actionlib_msgs/GoalID' - }); + return promise; + } - // Track the goals and their status in order to publish status... - this.statusMessage = new Message({ - header : { - stamp : {secs : 0, nsecs : 100}, - frame_id : '' - }, - status_list : [] - }); + Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - // needed for handling preemption prompted by a new goal being received - this.currentGoal = null; // currently tracked goal - this.nextGoal = null; // the one that'll be preempting + if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return Object.defineProperties( + fn, + getOwnPropertyDescriptors(original) + ); +} + +exports.promisify.custom = kCustomPromisifiedSymbol + +function callbackifyOnRejected(reason, cb) { + // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). + // Because `null` is a special error value in callbacks which means "no error + // occurred", we error-wrap so the callback consumer can distinguish between + // "the promise rejected with null" or "the promise fulfilled with undefined". + if (!reason) { + var newReason = new Error('Promise was rejected with a falsy value'); + newReason.reason = reason; + reason = newReason; + } + return cb(reason); +} - goalListener.subscribe(function(goalMessage) { +function callbackify(original) { + if (typeof original !== 'function') { + throw new TypeError('The "original" argument must be of type Function'); + } - if(that.currentGoal) { - that.nextGoal = goalMessage; - // needs to happen AFTER rest is set up - that.emit('cancel'); - } else { - that.statusMessage.status_list = [{goal_id : goalMessage.goal_id, status : 1}]; - that.currentGoal = goalMessage; - that.emit('goal', goalMessage.goal); + // We DO NOT return the promise as it gives the user a false sense that + // the promise is actually somehow related to the callback's execution + // and that the callback throwing will reject the promise. + function callbackified() { + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); } - }); - // helper function to determine ordering of timestamps - // returns t1 < t2 - var isEarlier = function(t1, t2) { - if(t1.secs > t2.secs) { - return false; - } else if(t1.secs < t2.secs) { - return true; - } else if(t1.nsecs < t2.nsecs) { - return true; - } else { - return false; - } + var maybeCb = args.pop(); + if (typeof maybeCb !== 'function') { + throw new TypeError('The last argument must be of type Function'); + } + var self = this; + var cb = function() { + return maybeCb.apply(self, arguments); }; + // In true node style we process the callback on `nextTick` with all the + // implications (stack, `uncaughtException`, `async_hooks`) + original.apply(this, args) + .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, + function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); + } - // TODO: this may be more complicated than necessary, since I'm - // not sure if the callbacks can ever wind up with a scenario - // where we've been preempted by a next goal, it hasn't finished - // processing, and then we get a cancel message - cancelListener.subscribe(function(cancelMessage) { + Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); + Object.defineProperties(callbackified, + getOwnPropertyDescriptors(original)); + return callbackified; +} +exports.callbackify = callbackify; - // cancel ALL goals if both empty - if(cancelMessage.stamp.secs === 0 && cancelMessage.stamp.secs === 0 && cancelMessage.id === '') { - that.nextGoal = null; - if(that.currentGoal) { - that.emit('cancel'); - } - } else { // treat id and stamp independently - if(that.currentGoal && cancelMessage.id === that.currentGoal.goal_id.id) { - that.emit('cancel'); - } else if(that.nextGoal && cancelMessage.id === that.nextGoal.goal_id.id) { - that.nextGoal = null; - } +}).call(this)}).call(this,require('_process')) +},{"./support/isBuffer":64,"./support/types":65,"_process":44,"inherits":27}],67:[function(require,module,exports){ +function webpackBootstrapFunc (modules) { +/******/ // The module cache +/******/ var installedModules = {}; - if(that.nextGoal && isEarlier(that.nextGoal.goal_id.stamp, - cancelMessage.stamp)) { - that.nextGoal = null; - } - if(that.currentGoal && isEarlier(that.currentGoal.goal_id.stamp, - cancelMessage.stamp)) { - that.emit('cancel'); - } - } - }); +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.l = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; + +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; + +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; + +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; + +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; - // publish status at pseudo-fixed rate; required for clients to know they've connected - var statusInterval = setInterval( function() { - var currentTime = new Date(); - var secs = Math.floor(currentTime.getTime()/1000); - var nsecs = Math.round(1000000000*(currentTime.getTime()/1000-secs)); - that.statusMessage.header.stamp.secs = secs; - that.statusMessage.header.stamp.nsecs = nsecs; - statusPublisher.publish(that.statusMessage); - }, 500); // publish every 500ms +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/"; + +/******/ // on error function for async loading +/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; + var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE) + return f.default || f // try to call default if defined to also support babel esmodule exports } -SimpleActionServer.prototype.__proto__ = EventEmitter2.prototype; +var moduleNameReqExp = '[\\.|\\-|\\+|\\w|\/|@]+' +var dependencyRegExp = '\\(\\s*(\/\\*.*?\\*\/)?\\s*.*?(' + moduleNameReqExp + ').*?\\)' // additional chars when output.pathinfo is true -/** - * Set action state to succeeded and return to client. - * - * @param {Object} result - The result to return to the client. - */ -SimpleActionServer.prototype.setSucceeded = function(result) { - var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 3}, - result : result - }); - this.resultPublisher.publish(resultMessage); +// http://stackoverflow.com/a/2593661/130442 +function quoteRegExp (str) { + return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&') +} + +function isNumeric(n) { + return !isNaN(1 * n); // 1 * n converts integers, integers as string ("123"), 1e3 and "1e3" to integers and strings to NaN +} + +function getModuleDependencies (sources, module, queueName) { + var retval = {} + retval[queueName] = [] + + var fnString = module.toString() + var wrapperSignature = fnString.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/) + if (!wrapperSignature) return retval + var webpackRequireName = wrapperSignature[1] - this.statusMessage.status_list = []; - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); - } else { - this.currentGoal = null; - } -}; + // main bundle deps + var re = new RegExp('(\\\\n|\\W)' + quoteRegExp(webpackRequireName) + dependencyRegExp, 'g') + var match + while ((match = re.exec(fnString))) { + if (match[3] === 'dll-reference') continue + retval[queueName].push(match[3]) + } -/** - * Set action state to aborted and return to client. - * - * @param {Object} result - The result to return to the client. - */ -SimpleActionServer.prototype.setAborted = function(result) { - var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 4}, - result : result - }); - this.resultPublisher.publish(resultMessage); + // dll deps + re = new RegExp('\\(' + quoteRegExp(webpackRequireName) + '\\("(dll-reference\\s(' + moduleNameReqExp + '))"\\)\\)' + dependencyRegExp, 'g') + while ((match = re.exec(fnString))) { + if (!sources[match[2]]) { + retval[queueName].push(match[1]) + sources[match[2]] = __webpack_require__(match[1]).m + } + retval[match[2]] = retval[match[2]] || [] + retval[match[2]].push(match[4]) + } - this.statusMessage.status_list = []; - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); - } else { - this.currentGoal = null; + // convert 1e3 back to 1000 - this can be important after uglify-js converted 1000 to 1e3 + var keys = Object.keys(retval); + for (var i = 0; i < keys.length; i++) { + for (var j = 0; j < retval[keys[i]].length; j++) { + if (isNumeric(retval[keys[i]][j])) { + retval[keys[i]][j] = 1 * retval[keys[i]][j]; + } } -}; + } -/** - * Send a feedback message. - * - * @param {Object} feedback - The feedback to send to the client. - */ -SimpleActionServer.prototype.sendFeedback = function(feedback) { - var feedbackMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 1}, - feedback : feedback - }); - this.feedbackPublisher.publish(feedbackMessage); -}; + return retval +} -/** - * Handle case where client requests preemption. - */ -SimpleActionServer.prototype.setPreempted = function() { - this.statusMessage.status_list = []; - var resultMessage = new Message({ - status : {goal_id : this.currentGoal.goal_id, status : 2}, - }); - this.resultPublisher.publish(resultMessage); +function hasValuesInQueues (queues) { + var keys = Object.keys(queues) + return keys.reduce(function (hasValues, key) { + return hasValues || queues[key].length > 0 + }, false) +} - if(this.nextGoal) { - this.currentGoal = this.nextGoal; - this.nextGoal = null; - this.emit('goal', this.currentGoal.goal); - } else { - this.currentGoal = null; +function getRequiredModules (sources, moduleId) { + var modulesQueue = { + main: [moduleId] + } + var requiredModules = { + main: [] + } + var seenModules = { + main: {} + } + + while (hasValuesInQueues(modulesQueue)) { + var queues = Object.keys(modulesQueue) + for (var i = 0; i < queues.length; i++) { + var queueName = queues[i] + var queue = modulesQueue[queueName] + var moduleToCheck = queue.pop() + seenModules[queueName] = seenModules[queueName] || {} + if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck]) continue + seenModules[queueName][moduleToCheck] = true + requiredModules[queueName] = requiredModules[queueName] || [] + requiredModules[queueName].push(moduleToCheck) + var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName) + var newModulesKeys = Object.keys(newModules) + for (var j = 0; j < newModulesKeys.length; j++) { + modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || [] + modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]]) + } } -}; + } -module.exports = SimpleActionServer; + return requiredModules +} -},{"../core/Message":15,"../core/Topic":22,"eventemitter2":2}],14:[function(require,module,exports){ -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); +module.exports = function (moduleId, options) { + options = options || {} + var sources = { + main: __webpack_modules__ + } -var action = module.exports = { - ActionClient: require('./ActionClient'), - ActionListener: require('./ActionListener'), - Goal: require('./Goal'), - SimpleActionServer: require('./SimpleActionServer') -}; + var requiredModules = options.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId) -mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); + var src = '' -},{"../core/Ros":17,"../mixin":29,"./ActionClient":10,"./ActionListener":11,"./Goal":12,"./SimpleActionServer":13}],15:[function(require,module,exports){ -/** - * @fileOverview - * @author Brandon Alexander - baalexander@gmail.com - */ + Object.keys(requiredModules).filter(function (m) { return m !== 'main' }).forEach(function (module) { + var entryModule = 0 + while (requiredModules[module][entryModule]) { + entryModule++ + } + requiredModules[module].push(entryModule) + sources[module][entryModule] = '(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })' + src = src + 'var ' + module + ' = (' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(entryModule)) + ')({' + requiredModules[module].map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[module][id].toString() }).join(',') + '});\n' + }) -var assign = require('object-assign'); + src = src + 'new ((' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.main.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources.main[id].toString() }).join(',') + '}))(self);' -/** - * Message objects are used for publishing and subscribing to and from topics. - * - * @constructor - * @param {Object} values - An object matching the fields defined in the .msg definition file. - */ -function Message(values) { - assign(this, values); -} + var blob = new window.Blob([src], { type: 'text/javascript' }) + if (options.bare) { return blob } -module.exports = Message; -},{"object-assign":3}],16:[function(require,module,exports){ -/** - * @fileOverview - * @author Brandon Alexander - baalexander@gmail.com - */ + var URL = window.URL || window.webkitURL || window.mozURL || window.msURL -var Service = require('./Service'); -var ServiceRequest = require('./ServiceRequest'); + var workerUrl = URL.createObjectURL(blob) + var worker = new window.Worker(workerUrl) + worker.objectURL = workerUrl -/** - * A ROS parameter. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The param name, like max_vel_x. - */ -function Param(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; + return worker } -/** - * Fetch the value of the param. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.value - The value of the param from ROS. - */ -Param.prototype.get = function(callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/get_param', - serviceType : 'rosapi/GetParam' - }); - - var request = new ServiceRequest({ - name : this.name - }); - - paramClient.callService(request, function(result) { - var value = JSON.parse(result.value); - callback(value); - }); -}; - -/** - * Set the value of the param in ROS. - * - * @param {Object} value - The value to set param to. - * @param {function} callback - The callback function. - */ -Param.prototype.set = function(value, callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/set_param', - serviceType : 'rosapi/SetParam' - }); +},{}],68:[function(require,module,exports){ +var bundleFn = arguments[3]; +var sources = arguments[4]; +var cache = arguments[5]; - var request = new ServiceRequest({ - name : this.name, - value : JSON.stringify(value) - }); +var stringify = JSON.stringify; - paramClient.callService(request, callback); -}; +module.exports = function (fn, options) { + var wkey; + var cacheKeys = Object.keys(cache); -/** - * Delete this parameter on the ROS server. - * - * @param {function} callback - The callback function. - */ -Param.prototype.delete = function(callback) { - var paramClient = new Service({ - ros : this.ros, - name : '/rosapi/delete_param', - serviceType : 'rosapi/DeleteParam' - }); + for (var i = 0, l = cacheKeys.length; i < l; i++) { + var key = cacheKeys[i]; + var exp = cache[key].exports; + // Using babel as a transpiler to use esmodule, the export will always + // be an object with the default export as a property of it. To ensure + // the existing api and babel esmodule exports are both supported we + // check for both + if (exp === fn || exp && exp.default === fn) { + wkey = key; + break; + } + } - var request = new ServiceRequest({ - name : this.name - }); + if (!wkey) { + wkey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); + var wcache = {}; + for (var i = 0, l = cacheKeys.length; i < l; i++) { + var key = cacheKeys[i]; + wcache[key] = key; + } + sources[wkey] = [ + 'function(require,module,exports){' + fn + '(self); }', + wcache + ]; + } + var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); - paramClient.callService(request, callback); -}; + var scache = {}; scache[wkey] = wkey; + sources[skey] = [ + 'function(require,module,exports){' + + // try to call default if defined to also support babel esmodule exports + 'var f = require(' + stringify(wkey) + ');' + + '(f.default ? f.default : f)(self);' + + '}', + scache + ]; -module.exports = Param; + var workerSources = {}; + resolveSources(skey); -},{"./Service":18,"./ServiceRequest":19}],17:[function(require,module,exports){ -/** - * @fileOverview - * @author Brandon Alexander - baalexander@gmail.com - */ + function resolveSources(key) { + workerSources[key] = true; -var WebSocket = require('ws'); -var WorkerSocket = require('../util/workerSocket'); -var socketAdapter = require('./SocketAdapter.js'); + for (var depPath in sources[key][1]) { + var depKey = sources[key][1][depPath]; + if (!workerSources[depKey]) { + resolveSources(depKey); + } + } + } -var Service = require('./Service'); -var ServiceRequest = require('./ServiceRequest'); + var src = '(' + bundleFn + ')({' + + Object.keys(workerSources).map(function (key) { + return stringify(key) + ':[' + + sources[key][0] + + ',' + stringify(sources[key][1]) + ']' + ; + }).join(',') + + '},{},[' + stringify(skey) + '])' + ; -var assign = require('object-assign'); -var EventEmitter2 = require('eventemitter2').EventEmitter2; + var URL = window.URL || window.webkitURL || window.mozURL || window.msURL; -/** - * Manages connection to the server and all interactions with ROS. - * - * Emits the following events: - * * 'error' - There was an error with ROS. - * * 'connection' - Connected to the WebSocket server. - * * 'close' - Disconnected to the WebSocket server. - * * <topicName> - A message came from rosbridge with the given topic name. - * * <serviceID> - A service response came from rosbridge with the given ID. - * - * @constructor - * @param {Object} options - * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. - * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. - * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. - * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. - */ -function Ros(options) { - options = options || {}; - var that = this; - this.socket = null; - this.idCounter = 0; - this.isConnected = false; - this.transportLibrary = options.transportLibrary || 'websocket'; - this.transportOptions = options.transportOptions || {}; - this._sendFunc = function(msg) { that.sendEncodedMessage(msg); }; - - if (typeof options.groovyCompatibility === 'undefined') { - this.groovyCompatibility = true; - } - else { - this.groovyCompatibility = options.groovyCompatibility; - } + var blob = new Blob([src], { type: 'text/javascript' }); + if (options && options.bare) { return blob; } + var workerUrl = URL.createObjectURL(blob); + var worker = new Worker(workerUrl); + worker.objectURL = workerUrl; + return worker; +}; - // Sets unlimited event listeners. - this.setMaxListeners(0); +},{}],69:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; - // begin by checking if a URL was given - if (options.url) { - this.connect(options.url); - } +var forEach = require('foreach'); +var availableTypedArrays = require('available-typed-arrays'); +var callBound = require('call-bind/callBound'); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var g = typeof globalThis === 'undefined' ? global : globalThis; +var typedArrays = availableTypedArrays(); + +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + if (typeof g[typedArray] === 'function') { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + } + } + }); } -Ros.prototype.__proto__ = EventEmitter2.prototype; - -/** - * Connect to the specified WebSocket. - * - * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. - */ -Ros.prototype.connect = function(url) { - if (this.transportLibrary === 'socket.io') { - this.socket = assign(io(url, {'force new connection': true}), socketAdapter(this)); - this.socket.on('connect', this.socket.onopen); - this.socket.on('data', this.socket.onmessage); - this.socket.on('close', this.socket.onclose); - this.socket.on('error', this.socket.onerror); - } else if (this.transportLibrary.constructor.name === 'RTCPeerConnection') { - this.socket = assign(this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this)); - } else if (this.transportLibrary === 'websocket') { - if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { - var sock = new WebSocket(url); - sock.binaryType = 'arraybuffer'; - this.socket = assign(sock, socketAdapter(this)); - } - } else if (this.transportLibrary === 'workersocket') { - this.socket = assign(new WorkerSocket(url), socketAdapter(this)); - } else { - throw 'Unknown transportLibrary: ' + this.transportLibrary.toString(); - } - +var tryTypedArrays = function tryAllTypedArrays(value) { + var foundName = false; + forEach(toStrTags, function (getter, typedArray) { + if (!foundName) { + try { + var name = getter.call(value); + if (name === typedArray) { + foundName = name; + } + } catch (e) {} + } + }); + return foundName; }; -/** - * Disconnect from the WebSocket server. - */ -Ros.prototype.close = function() { - if (this.socket) { - this.socket.close(); - } -}; +var isTypedArray = require('is-typed-array'); -/** - * Send an authorization request to the server. - * - * @param {string} mac - MAC (hash) string given by the trusted source. - * @param {string} client - IP of the client. - * @param {string} dest - IP of the destination. - * @param {string} rand - Random string given by the trusted source. - * @param {Object} t - Time of the authorization request. - * @param {string} level - User level as a string given by the client. - * @param {Object} end - End time of the client's session. - */ -Ros.prototype.authenticate = function(mac, client, dest, rand, t, level, end) { - // create the request - var auth = { - op : 'auth', - mac : mac, - client : client, - dest : dest, - rand : rand, - t : t, - level : level, - end : end - }; - // send the request - this.callOnConnection(auth); +module.exports = function whichTypedArray(value) { + if (!isTypedArray(value)) { return false; } + if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } + return tryTypedArrays(value); }; -/** - * Send an encoded message over the WebSocket. - * - * @param {Object} messageEncoded - The encoded message to be sent. - */ -Ros.prototype.sendEncodedMessage = function(messageEncoded) { - var emitter = null; - var that = this; - if (this.transportLibrary === 'socket.io') { - emitter = function(msg){that.socket.emit('operation', msg);}; - } else { - emitter = function(msg){that.socket.send(msg);}; - } +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24,"is-typed-array":30}],70:[function(require,module,exports){ +exports.DOMImplementation = window.DOMImplementation; +exports.XMLSerializer = window.XMLSerializer; +exports.DOMParser = window.DOMParser; - if (!this.isConnected) { - that.once('connection', function() { - emitter(messageEncoded); - }); - } else { - emitter(messageEncoded); - } -}; +},{}],71:[function(require,module,exports){ +module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; +},{}],72:[function(require,module,exports){ +"use strict"; /** - * Send the message over the WebSocket, but queue the message up if not yet - * connected. - * - * @param {Object} message - The message to be sent. + * @fileOverview + * @author Russell Toris - rctoris@wpi.edu */ -Ros.prototype.callOnConnection = function(message) { - if (this.transportOptions.encoder) { - this.transportOptions.encoder(message, this._sendFunc); - } else { - this._sendFunc(JSON.stringify(message)); - } -}; - /** - * Send a set_level request to the server. + * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. * - * @param {string} level - Status level (none, error, warning, info). - * @param {number} [id] - Operation ID to change status level on. + * If you use nodejs, this is the variable you get when you require('roslib'). */ -Ros.prototype.setStatusLevel = function(level, id){ - var levelMsg = { - op: 'set_level', - level: level, - id: id - }; - - this.callOnConnection(levelMsg); +var ROSLIB = this.ROSLIB || { + /** + * @default + * @description Library version + */ + REVISION: '1.3.0' }; +var assign = require('object-assign'); +// Add core components +assign(ROSLIB, require('./core')); +assign(ROSLIB, require('./actionlib')); +assign(ROSLIB, require('./math')); +assign(ROSLIB, require('./tf')); +assign(ROSLIB, require('./urdf')); +module.exports = ROSLIB; +},{"./actionlib":78,"./core":87,"./math":92,"./tf":95,"./urdf":107,"object-assign":31}],73:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; +global.ROSLIB = require('./RosLib'); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./RosLib":72}],74:[function(require,module,exports){ +"use strict"; /** - * Retrieve a list of action servers in ROS as an array of string. - * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.actionservers - Array of action server names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Russell Toris - rctoris@wpi.edu */ -Ros.prototype.getActionServers = function(callback, failedCallback) { - var getActionServers = new Service({ - ros : this, - name : '/rosapi/action_servers', - serviceType : 'rosapi/GetActionServers' - }); - - var request = new ServiceRequest({}); - if (typeof failedCallback === 'function'){ - getActionServers.callService(request, - function(result) { - callback(result.action_servers); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - getActionServers.callService(request, function(result) { - callback(result.action_servers); - }); - } -}; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Topic = require('../core/Topic'); +var Message = require('../core/Message'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require('../core/Ros'); /** - * Retrieve a list of topics in ROS as an array. + * An actionlib action client. + * + * Emits the following events: + * * 'timeout' - If a timeout occurred while sending a goal. + * * 'status' - The status messages received from the action server. + * * 'feedback' - The feedback messages received from the action server. + * * 'result' - The result returned from the action server. * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. */ -Ros.prototype.getTopics = function(callback, failedCallback) { - var topicsClient = new Service({ - ros : this, - name : '/rosapi/topics', - serviceType : 'rosapi/Topics' - }); - - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - topicsClient.callService(request, - function(result) { - callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsClient.callService(request, function(result) { - callback(result); - }); - } -}; +var ActionClient = /** @class */ (function (_super) { + __extends(ActionClient, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + * @param {number} [options.timeout] - The timeout length when connecting to the action server. + * @param {boolean} [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not. + * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. + * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. + */ + function ActionClient(options) { + var _this = _super.call(this) || this; + var that = _this; + _this.ros = options.ros; + _this.serverName = options.serverName; + _this.actionName = options.actionName; + _this.timeout = options.timeout; + _this.omitFeedback = options.omitFeedback; + _this.omitStatus = options.omitStatus; + _this.omitResult = options.omitResult; + _this.goals = {}; + // flag to check if a status has been received + var receivedStatus = false; + // create the topics associated with actionlib + _this.feedbackListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/feedback', + messageType: _this.actionName + 'Feedback', + }); + _this.statusListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray', + }); + _this.resultListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/result', + messageType: _this.actionName + 'Result', + }); + _this.goalTopic = new Topic({ + ros: _this.ros, + name: _this.serverName + '/goal', + messageType: _this.actionName + 'Goal', + }); + _this.cancelTopic = new Topic({ + ros: _this.ros, + name: _this.serverName + '/cancel', + messageType: 'actionlib_msgs/GoalID', + }); + // advertise the goal and cancel topics + _this.goalTopic.advertise(); + _this.cancelTopic.advertise(); + // subscribe to the status topic + if (!_this.omitStatus) { + _this.statusListener.subscribe(function (statusMessage) { + receivedStatus = true; + statusMessage.status_list.forEach(function (status) { + var goal = that.goals[status.goal_id.id]; + if (goal) { + goal.emit('status', status); + } + }); + }); + } + // subscribe the the feedback topic + if (!_this.omitFeedback) { + _this.feedbackListener.subscribe(function (feedbackMessage) { + var goal = that.goals[feedbackMessage.status.goal_id.id]; + if (goal) { + goal.emit('status', feedbackMessage.status); + goal.emit('feedback', feedbackMessage.feedback); + } + }); + } + // subscribe to the result topic + if (!_this.omitResult) { + _this.resultListener.subscribe(function (resultMessage) { + var goal = that.goals[resultMessage.status.goal_id.id]; + if (goal) { + goal.emit('status', resultMessage.status); + goal.emit('result', resultMessage.result); + } + }); + } + // If timeout specified, emit a 'timeout' event if the action server does not respond + if (_this.timeout) { + setTimeout(function () { + if (!receivedStatus) { + that.emit('timeout'); + } + }, _this.timeout); + } + return _this; + } + /** + * Cancel all goals associated with this ActionClient. + */ + ActionClient.prototype.cancel = function () { + var cancelMessage = new Message(); + this.cancelTopic.publish(cancelMessage); + }; + /** + * Unsubscribe and unadvertise all topics associated with this ActionClient. + */ + ActionClient.prototype.dispose = function () { + this.goalTopic.unadvertise(); + this.cancelTopic.unadvertise(); + if (!this.omitStatus) { + this.statusListener.unsubscribe(); + } + if (!this.omitFeedback) { + this.feedbackListener.unsubscribe(); + } + if (!this.omitResult) { + this.resultListener.unsubscribe(); + } + }; + return ActionClient; +}(EventEmitter2)); +module.exports = ActionClient; +},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],75:[function(require,module,exports){ +"use strict"; /** - * Retrieve a list of topics in ROS as an array of a specific type. - * - * @param {string} topicType - The topic type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of topic names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Justin Young - justin@oodar.com.au + * @author Russell Toris - rctoris@wpi.edu */ -Ros.prototype.getTopicsForType = function(topicType, callback, failedCallback) { - var topicsForTypeClient = new Service({ - ros : this, - name : '/rosapi/topics_for_type', - serviceType : 'rosapi/TopicsForType' - }); - - var request = new ServiceRequest({ - type: topicType - }); - if (typeof failedCallback === 'function'){ - topicsForTypeClient.callService(request, - function(result) { - callback(result.topics); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsForTypeClient.callService(request, function(result) { - callback(result.topics); - }); - } -}; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Topic = require('../core/Topic'); +var Message = require('../core/Message'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require('../core/Ros'); /** - * Retrieve a list of active service names in ROS. + * An actionlib action listener. + * + * Emits the following events: + * * 'status' - The status messages received from the action server. + * * 'feedback' - The feedback messages received from the action server. + * * 'result' - The result returned from the action server. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.services - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getServices = function(callback, failedCallback) { - var servicesClient = new Service({ - ros : this, - name : '/rosapi/services', - serviceType : 'rosapi/Services' - }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - servicesClient.callService(request, - function(result) { - callback(result.services); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - servicesClient.callService(request, function(result) { - callback(result.services); - }); - } -}; + */ +var ActionListener = /** @class */ (function (_super) { + __extends(ActionListener, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ + function ActionListener(options) { + var _this = _super.call(this) || this; + var that = _this; + _this.ros = options.ros; + _this.serverName = options.serverName; + _this.actionName = options.actionName; + // create the topics associated with actionlib + var goalListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/goal', + messageType: _this.actionName + 'Goal', + }); + var feedbackListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/feedback', + messageType: _this.actionName + 'Feedback', + }); + var statusListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray', + }); + var resultListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/result', + messageType: _this.actionName + 'Result', + }); + goalListener.subscribe(function (goalMessage) { + that.emit('goal', goalMessage); + }); + statusListener.subscribe(function (statusMessage) { + statusMessage.status_list.forEach(function (status) { + that.emit('status', status); + }); + }); + feedbackListener.subscribe(function (feedbackMessage) { + that.emit('status', feedbackMessage.status); + that.emit('feedback', feedbackMessage.feedback); + }); + // subscribe to the result topic + resultListener.subscribe(function (resultMessage) { + that.emit('status', resultMessage.status); + that.emit('result', resultMessage.result); + }); + return _this; + } + return ActionListener; +}(EventEmitter2)); +module.exports = ActionListener; +},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],76:[function(require,module,exports){ +"use strict"; /** - * Retrieve a list of services in ROS as an array as specific type. - * - * @param {string} serviceType - The service type to find. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.topics - Array of service names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Russell Toris - rctoris@wpi.edu */ -Ros.prototype.getServicesForType = function(serviceType, callback, failedCallback) { - var servicesForTypeClient = new Service({ - ros : this, - name : '/rosapi/services_for_type', - serviceType : 'rosapi/ServicesForType' - }); - - var request = new ServiceRequest({ - type: serviceType - }); - if (typeof failedCallback === 'function'){ - servicesForTypeClient.callService(request, - function(result) { - callback(result.services); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - servicesForTypeClient.callService(request, function(result) { - callback(result.services); - }); - } -}; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Message = require('../core/Message'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; +var ActionClient = require('./ActionClient'); /** - * Retrieve the details of a ROS service request. + * An actionlib goal that is associated with an action server. * - * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * Emits the following events: + * * 'timeout' - If a timeout occurred while sending a goal. */ -Ros.prototype.getServiceRequestDetails = function(type, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_request_details', - serviceType : 'rosapi/ServiceRequestDetails' - }); - var request = new ServiceRequest({ - type: type - }); - - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { - callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result); - }); - } -}; +var Goal = /** @class */ (function (_super) { + __extends(Goal, _super); + /** + * @param {Object} options + * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. + * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. + */ + function Goal(options) { + var _this = _super.call(this) || this; + _this.feedback = undefined; + _this.status = undefined; + _this.result = undefined; + var that = _this; + _this.actionClient = options.actionClient; + _this.goalMessage = options.goalMessage; + _this.isFinished = false; + // Used to create random IDs + var date = new Date(); + // Create a random ID + _this.goalID = 'goal_' + Math.random() + '_' + date.getTime(); + // Fill in the goal message + _this.goalMessage = new Message({ + goal_id: { + stamp: { + secs: 0, + nsecs: 0, + }, + id: _this.goalID, + }, + goal: _this.goalMessage, + }); + _this.on('status', function (status) { + that.status = status; + }); + _this.on('result', function (result) { + that.isFinished = true; + that.result = result; + }); + _this.on('feedback', function (feedback) { + that.feedback = feedback; + }); + // Add the goal + _this.actionClient.goals[_this.goalID] = _this; + return _this; + } + /** + * Send the goal to the action server. + * + * @param {number} [timeout] - A timeout length for the goal's result. + */ + Goal.prototype.send = function (timeout) { + var that = this; + that.actionClient.goalTopic.publish(that.goalMessage); + if (timeout) { + setTimeout(function () { + if (!that.isFinished) { + that.emit('timeout'); + } + }, timeout); + } + }; + /** + * Cancel the current goal. + */ + Goal.prototype.cancel = function () { + var cancelMessage = new Message({ + id: this.goalID, + }); + this.actionClient.cancelTopic.publish(cancelMessage); + }; + return Goal; +}(EventEmitter2)); +module.exports = Goal; +},{"../core/Message":79,"./ActionClient":74,"eventemitter2":16}],77:[function(require,module,exports){ +"use strict"; /** - * Retrieve the details of a ROS service response. - * - * @param {string} type - The type of the service. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.typedefs - An array containing the details of the service response. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Laura Lindzey - lindzey@gmail.com */ -Ros.prototype.getServiceResponseDetails = function(type, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_response_details', - serviceType : 'rosapi/ServiceResponseDetails' - }); - var request = new ServiceRequest({ - type: type - }); - - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { - callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result); - }); - } -}; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Topic = require('../core/Topic'); +var Message = require('../core/Message'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require('../core/Ros'); /** - * Retrieve a list of active node names in ROS. + * An actionlib action server client. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.nodes - Array of node names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * Emits the following events: + * * 'goal' - Goal sent by action client. + * * 'cancel' - Action client has canceled the request. */ -Ros.prototype.getNodes = function(callback, failedCallback) { - var nodesClient = new Service({ - ros : this, - name : '/rosapi/nodes', - serviceType : 'rosapi/Nodes' - }); +var SimpleActionServer = /** @class */ (function (_super) { + __extends(SimpleActionServer, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ + function SimpleActionServer(options) { + var _this = _super.call(this) || this; + var that = _this; + _this.ros = options.ros; + _this.serverName = options.serverName; + _this.actionName = options.actionName; + // create and advertise publishers + _this.feedbackPublisher = new Topic({ + ros: _this.ros, + name: _this.serverName + '/feedback', + messageType: _this.actionName + 'Feedback', + }); + _this.feedbackPublisher.advertise(); + var statusPublisher = new Topic({ + ros: _this.ros, + name: _this.serverName + '/status', + messageType: 'actionlib_msgs/GoalStatusArray', + }); + statusPublisher.advertise(); + _this.resultPublisher = new Topic({ + ros: _this.ros, + name: _this.serverName + '/result', + messageType: _this.actionName + 'Result', + }); + _this.resultPublisher.advertise(); + // create and subscribe to listeners + var goalListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/goal', + messageType: _this.actionName + 'Goal', + }); + var cancelListener = new Topic({ + ros: _this.ros, + name: _this.serverName + '/cancel', + messageType: 'actionlib_msgs/GoalID', + }); + // Track the goals and their status in order to publish status... + _this.statusMessage = new Message({ + header: { + stamp: { secs: 0, nsecs: 100 }, + frame_id: '', + }, + status_list: [], + }); + // needed for handling preemption prompted by a new goal being received + _this.currentGoal = null; // currently tracked goal + _this.nextGoal = null; // the one that'll be preempting + goalListener.subscribe(function (goalMessage) { + if (that.currentGoal) { + that.nextGoal = goalMessage; + // needs to happen AFTER rest is set up + that.emit('cancel'); + } + else { + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + that.statusMessage.status_list = [ + { goal_id: goalMessage.goal_id, status: 1 }, + ]; + that.currentGoal = goalMessage; + that.emit('goal', goalMessage.goal); + } + }); + // helper function to determine ordering of timestamps + // returns t1 < t2 + var isEarlier = function (t1, t2) { + if (t1.secs > t2.secs) { + return false; + } + else if (t1.secs < t2.secs) { + return true; + } + else if (t1.nsecs < t2.nsecs) { + return true; + } + else { + return false; + } + }; + // TODO: this may be more complicated than necessary, since I'm + // not sure if the callbacks can ever wind up with a scenario + // where we've been preempted by a next goal, it hasn't finished + // processing, and then we get a cancel message + cancelListener.subscribe(function (cancelMessage) { + // cancel ALL goals if both empty + if (cancelMessage.stamp.secs === 0 && + cancelMessage.stamp.secs === 0 && + cancelMessage.id === '') { + that.nextGoal = null; + if (that.currentGoal) { + that.emit('cancel'); + } + } + else { + // treat id and stamp independently + if (that.currentGoal && + cancelMessage.id === that.currentGoal.goal_id.id) { + that.emit('cancel'); + } + else if (that.nextGoal && + cancelMessage.id === that.nextGoal.goal_id.id) { + that.nextGoal = null; + } + if (that.nextGoal && + isEarlier(that.nextGoal.goal_id.stamp, cancelMessage.stamp)) { + that.nextGoal = null; + } + if (that.currentGoal && + isEarlier(that.currentGoal.goal_id.stamp, cancelMessage.stamp)) { + that.emit('cancel'); + } + } + }); + // publish status at pseudo-fixed rate; required for clients to know they've connected + var statusInterval = setInterval(function () { + var currentTime = new Date(); + var secs = Math.floor(currentTime.getTime() / 1000); + var nsecs = Math.round(1000000000 * (currentTime.getTime() / 1000 - secs)); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + that.statusMessage.header.stamp.secs = secs; + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + that.statusMessage.header.stamp.nsecs = nsecs; + statusPublisher.publish(that.statusMessage); + }, 500); // publish every 500ms + return _this; + } + /** + * Set action state to succeeded and return to client. + * + * @param {Object} result - The result to return to the client. + */ + SimpleActionServer.prototype.setSucceeded = function (result) { + var resultMessage = new Message({ + status: { goal_id: this.currentGoal.goal_id, status: 3 }, + result: result, + }); + this.resultPublisher.publish(resultMessage); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + this.statusMessage.status_list = []; + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit('goal', this.currentGoal.goal); + } + else { + this.currentGoal = null; + } + }; + /** + * Set action state to aborted and return to client. + * + * @param {Object} result - The result to return to the client. + */ + SimpleActionServer.prototype.setAborted = function (result) { + var resultMessage = new Message({ + status: { goal_id: this.currentGoal.goal_id, status: 4 }, + result: result, + }); + this.resultPublisher.publish(resultMessage); + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + this.statusMessage.status_list = []; + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit('goal', this.currentGoal.goal); + } + else { + this.currentGoal = null; + } + }; + /** + * Send a feedback message. + * + * @param {Object} feedback - The feedback to send to the client. + */ + SimpleActionServer.prototype.sendFeedback = function (feedback) { + var feedbackMessage = new Message({ + status: { goal_id: this.currentGoal.goal_id, status: 1 }, + feedback: feedback, + }); + this.feedbackPublisher.publish(feedbackMessage); + }; + /** + * Handle case where client requests preemption. + */ + SimpleActionServer.prototype.setPreempted = function () { + // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. + this.statusMessage.status_list = []; + var resultMessage = new Message({ + status: { goal_id: this.currentGoal.goal_id, status: 2 }, + }); + this.resultPublisher.publish(resultMessage); + if (this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit('goal', this.currentGoal.goal); + } + else { + this.currentGoal = null; + } + }; + return SimpleActionServer; +}(EventEmitter2)); +module.exports = SimpleActionServer; - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - nodesClient.callService(request, - function(result) { - callback(result.nodes); - }, - function(message) { - failedCallback(message); - } - ); - }else{ - nodesClient.callService(request, function(result) { - callback(result.nodes); - }); - } +},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],78:[function(require,module,exports){ +"use strict"; +var Ros = require('../core/Ros'); +var mixin = require('../mixin'); +var action = module.exports = { + ActionClient: require('./ActionClient'), + ActionListener: require('./ActionListener'), + Goal: require('./Goal'), + SimpleActionServer: require('./SimpleActionServer') }; +mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); +},{"../core/Ros":81,"../mixin":93,"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ +"use strict"; /** - * Retrieve a list of subscribed topics, publishing topics and services of a specific node. - *
- * These are the parameters if failedCallback is defined. - * - * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {string[]} callback.subscriptions - Array of subscribed topic names. - * @param {string[]} callback.publications - Array of published topic names. - * @param {string[]} callback.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - * - * @also - * - * Retrieve a list of subscribed topics, publishing topics and services of a specific node. - *
- * These are the parameters if failedCallback is undefined. - * - * @param {string} node - Name of the node. - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.subscribing - Array of subscribed topic names. - * @param {string[]} callback.result.publishing - Array of published topic names. - * @param {string[]} callback.result.services - Array of service names hosted. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Brandon Alexander - baalexander@gmail.com */ -Ros.prototype.getNodeDetails = function(node, callback, failedCallback) { - var nodesClient = new Service({ - ros : this, - name : '/rosapi/node_details', - serviceType : 'rosapi/NodeDetails' - }); - - var request = new ServiceRequest({ - node: node - }); - if (typeof failedCallback === 'function'){ - nodesClient.callService(request, - function(result) { - callback(result.subscribing, result.publishing, result.services); - }, - function(message) { - failedCallback(message); - } - ); - } else { - nodesClient.callService(request, function(result) { - callback(result); - }); - } -}; - +var assign = require('object-assign'); /** - * Retrieve a list of parameter names from the ROS Parameter Server. + * Message objects are used for publishing and subscribing to and from topics. * - * @param {function} callback - Function with the following params: - * @param {string[]} callback.params - Array of param names. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @constructor + * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. */ -Ros.prototype.getParams = function(callback, failedCallback) { - var paramsClient = new Service({ - ros : this, - name : '/rosapi/get_param_names', - serviceType : 'rosapi/GetParamNames' - }); - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - paramsClient.callService(request, - function(result) { - callback(result.names); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - paramsClient.callService(request, function(result) { - callback(result.names); - }); - } -}; +function Message(values) { + assign(this, values || {}); +} +module.exports = Message; +},{"object-assign":31}],80:[function(require,module,exports){ +"use strict"; /** - * Retrieve the type of a ROS topic. - * - * @param {string} topic - Name of the topic. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the topic. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Brandon Alexander - baalexander@gmail.com */ -Ros.prototype.getTopicType = function(topic, callback, failedCallback) { - var topicTypeClient = new Service({ - ros : this, - name : '/rosapi/topic_type', - serviceType : 'rosapi/TopicType' - }); - var request = new ServiceRequest({ - topic: topic - }); - - if (typeof failedCallback === 'function'){ - topicTypeClient.callService(request, - function(result) { - callback(result.type); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicTypeClient.callService(request, function(result) { - callback(result.type); - }); - } -}; - +var Service = require('./Service'); +var ServiceRequest = require('./ServiceRequest'); +var Ros = require('../core/Ros'); /** - * Retrieve the type of a ROS service. - * - * @param {string} service - Name of the service. - * @param {function} callback - Function with the following params: - * @param {string} callback.type - The type of the service. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * A ROS parameter. */ -Ros.prototype.getServiceType = function(service, callback, failedCallback) { - var serviceTypeClient = new Service({ - ros : this, - name : '/rosapi/service_type', - serviceType : 'rosapi/ServiceType' - }); - var request = new ServiceRequest({ - service: service - }); - - if (typeof failedCallback === 'function'){ - serviceTypeClient.callService(request, - function(result) { - callback(result.type); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - serviceTypeClient.callService(request, function(result) { - callback(result.type); - }); - } -}; +var Param = /** @class */ (function () { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The param name, like max_vel_x. + */ + function Param(options) { + this.ros = options.ros; + this.name = options.name; + } + /** + * @callback getCallback + * @param {Object} value - The value of the param from ROS. + */ + /** + * Fetch the value of the param. + * + * @param {getCallback} callback - Function with the following params: + */ + Param.prototype.get = function (callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/get_param", + serviceType: "rosapi/GetParam", + }); + var request = new ServiceRequest({ + name: this.name, + }); + paramClient.callService(request, function (result) { + var value = JSON.parse(result.value); + callback(value); + }); + }; + /** + * @callback setParamCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback setParamFailedCallback + * @param {Object} response - The response from the service request. + */ + /** + * Set the value of the param in ROS. + * + * @param {Object} value - The value to set param to. + * @param {setParamCallback} callback - The callback function. + */ + Param.prototype.set = function (value, callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/set_param", + serviceType: "rosapi/SetParam", + }); + var request = new ServiceRequest({ + name: this.name, + value: JSON.stringify(value), + }); + paramClient.callService(request, callback); + }; + /** + * Delete this parameter on the ROS server. + * + * @param {setParamCallback} callback - The callback function. + */ + Param.prototype.delete = function (callback) { + var paramClient = new Service({ + ros: this.ros, + name: "/rosapi/delete_param", + serviceType: "rosapi/DeleteParam", + }); + var request = new ServiceRequest({ + name: this.name, + }); + paramClient.callService(request, callback); + }; + return Param; +}()); +module.exports = Param; +},{"../core/Ros":81,"./Service":82,"./ServiceRequest":83}],81:[function(require,module,exports){ +"use strict"; /** - * Retrieve the details of a ROS message. - * - * @param {string} message - The name of the message type. - * @param {function} callback - Function with the following params: - * @param {string} callback.details - An array of the message details. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. + * @fileOverview + * @author Brandon Alexander - baalexander@gmail.com */ -Ros.prototype.getMessageDetails = function(message, callback, failedCallback) { - var messageDetailClient = new Service({ - ros : this, - name : '/rosapi/message_details', - serviceType : 'rosapi/MessageDetails' - }); - var request = new ServiceRequest({ - type: message - }); - - if (typeof failedCallback === 'function'){ - messageDetailClient.callService(request, - function(result) { - callback(result.typedefs); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - messageDetailClient.callService(request, function(result) { - callback(result.typedefs); - }); - } -}; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var WebSocket = require('ws'); +var WorkerSocket = require('../util/workerSocket'); +var socketAdapter = require('./SocketAdapter.js'); +var Service = require('./Service'); +var ServiceRequest = require('./ServiceRequest'); +var assign = require('object-assign'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; /** - * Decode a typedef array into a dictionary like `rosmsg show foo/bar`. + * Manages connection to the server and all interactions with ROS. * - * @param {Object[]} defs - Array of type_def dictionary. + * Emits the following events: + * * 'error' - There was an error with ROS. + * * 'connection' - Connected to the WebSocket server. + * * 'close' - Disconnected to the WebSocket server. + * * <topicName> - A message came from rosbridge with the given topic name. + * * <serviceID> - A service response came from rosbridge with the given ID. */ -Ros.prototype.decodeTypeDefs = function(defs) { - var that = this; - - // calls itself recursively to resolve type definition using hints. - var decodeTypeDefsRec = function(theType, hints) { - var typeDefDict = {}; - for (var i = 0; i < theType.fieldnames.length; i++) { - var arrayLen = theType.fieldarraylen[i]; - var fieldName = theType.fieldnames[i]; - var fieldType = theType.fieldtypes[i]; - if (fieldType.indexOf('/') === -1) { // check the fieldType includes '/' or not - if (arrayLen === -1) { - typeDefDict[fieldName] = fieldType; +var Ros = /** @class */ (function (_super) { + __extends(Ros, _super); + /** + * @param {Object} options + * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. + * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. + * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. + * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. + */ + function Ros(options) { + var _this = _super.call(this) || this; + options = options || {}; + var that = _this; + _this.socket = null; + _this.idCounter = 0; + _this.isConnected = false; + _this.transportLibrary = options.transportLibrary || 'websocket'; + _this.transportOptions = options.transportOptions || {}; + _this._sendFunc = function (msg) { + that.sendEncodedMessage(msg); + }; + if (typeof options.groovyCompatibility === 'undefined') { + _this.groovyCompatibility = true; + } + else { + _this.groovyCompatibility = options.groovyCompatibility; + } + // Sets unlimited event listeners. + _this.setMaxListeners(0); + // begin by checking if a URL was given + if (options.url) { + _this.connect(options.url); + } + return _this; + } + /** + * Connect to the specified WebSocket. + * + * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. + */ + Ros.prototype.connect = function (url) { + if (this.transportLibrary === 'socket.io') { + this.socket = assign( + // @ts-expect-error -- this doesn't seem to work + io(url, { 'force new connection': true }), socketAdapter(this)); + this.socket.on('connect', this.socket.onopen); + this.socket.on('data', this.socket.onmessage); + this.socket.on('close', this.socket.onclose); + this.socket.on('error', this.socket.onerror); + } + else if (this.transportLibrary.constructor.name === 'RTCPeerConnection') { + this.socket = assign( + // @ts-expect-error -- this is kinda wild. `this.transportLibrary` can either be a string or an RTCDataChannel. This needs fixing. + this.transportLibrary.createDataChannel(url, this.transportOptions), socketAdapter(this)); + } + else if (this.transportLibrary === 'websocket') { + if (!this.socket || this.socket.readyState === WebSocket.CLOSED) { + var sock = new WebSocket(url); + sock.binaryType = 'arraybuffer'; + this.socket = assign(sock, socketAdapter(this)); + } + } + else if (this.transportLibrary === 'workersocket') { + this.socket = assign(new WorkerSocket(url), socketAdapter(this)); + } + else { + throw 'Unknown transportLibrary: ' + this.transportLibrary.toString(); + } + }; + /** + * Disconnect from the WebSocket server. + */ + Ros.prototype.close = function () { + if (this.socket) { + this.socket.close(); + } + }; + /** + * Send an authorization request to the server. + * + * @param {string} mac - MAC (hash) string given by the trusted source. + * @param {string} client - IP of the client. + * @param {string} dest - IP of the destination. + * @param {string} rand - Random string given by the trusted source. + * @param {Object} t - Time of the authorization request. + * @param {string} level - User level as a string given by the client. + * @param {Object} end - End time of the client's session. + */ + Ros.prototype.authenticate = function (mac, client, dest, rand, t, level, end) { + // create the request + var auth = { + op: 'auth', + mac: mac, + client: client, + dest: dest, + rand: rand, + t: t, + level: level, + end: end, + }; + // send the request + this.callOnConnection(auth); + }; + /** + * Send an encoded message over the WebSocket. + * + * @param {Object} messageEncoded - The encoded message to be sent. + */ + Ros.prototype.sendEncodedMessage = function (messageEncoded) { + var emitter = null; + var that = this; + if (this.transportLibrary === 'socket.io') { + emitter = function (msg) { + that.socket.emit('operation', msg); + }; + } + else { + emitter = function (msg) { + that.socket.send(msg); + }; + } + if (!this.isConnected) { + that.once('connection', function () { + emitter(messageEncoded); + }); + } + else { + emitter(messageEncoded); + } + }; + /** + * Send the message over the WebSocket, but queue the message up if not yet + * connected. + * + * @param {Object} message - The message to be sent. + */ + Ros.prototype.callOnConnection = function (message) { + if (this.transportOptions.encoder) { + this.transportOptions.encoder(message, this._sendFunc); + } + else { + this._sendFunc(JSON.stringify(message)); + } + }; + /** + * Send a set_level request to the server. + * + * @param {string} level - Status level (none, error, warning, info). + * @param {number} [id] - Operation ID to change status level on. + */ + Ros.prototype.setStatusLevel = function (level, id) { + var levelMsg = { + op: 'set_level', + level: level, + id: id, + }; + this.callOnConnection(levelMsg); + }; + /** + * @callback getActionServersCallback + * @param {string[]} actionservers - Array of action server names. + */ + /** + * @callback getActionServersFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of action servers in ROS as an array of string. + * + * @param {getActionServersCallback} callback - Function with the following params: + * @param {getActionServersFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getActionServers = function (callback, failedCallback) { + var getActionServers = new Service({ + ros: this, + name: '/rosapi/action_servers', + serviceType: 'rosapi/GetActionServers', + }); + var request = new ServiceRequest({}); + if (typeof failedCallback === 'function') { + getActionServers.callService(request, function (result) { + callback(result.action_servers); + }, function (message) { + failedCallback(message); + }); + } + else { + getActionServers.callService(request, function (result) { + callback(result.action_servers); + }); + } + }; + /** + * @callback getTopicsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + */ + /** + * @callback getTopicsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics in ROS as an array. + * + * @param {getTopicsCallback} callback - Function with the following params: + * @param {getTopicsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getTopics = function (callback, failedCallback) { + var topicsClient = new Service({ + ros: this, + name: '/rosapi/topics', + serviceType: 'rosapi/Topics', + }); + var request = new ServiceRequest(); + if (typeof failedCallback === 'function') { + topicsClient.callService(request, function (result) { + callback(result); + }, function (message) { + failedCallback(message); + }); + } + else { + topicsClient.callService(request, function (result) { + callback(result); + }); + } + }; + /** + * @callback getTopicsForTypeCallback + * @param {string[]} topics - Array of topic names. + */ + /** + * @callback getTopicsForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics in ROS as an array of a specific type. + * + * @param {string} topicType - The topic type to find. + * @param {getTopicsForTypeCallback} callback - Function with the following params: + * @param {getTopicsForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getTopicsForType = function (topicType, callback, failedCallback) { + var topicsForTypeClient = new Service({ + ros: this, + name: '/rosapi/topics_for_type', + serviceType: 'rosapi/TopicsForType', + }); + var request = new ServiceRequest({ + type: topicType, + }); + if (typeof failedCallback === 'function') { + topicsForTypeClient.callService(request, function (result) { + callback(result.topics); + }, function (message) { + failedCallback(message); + }); + } + else { + topicsForTypeClient.callService(request, function (result) { + callback(result.topics); + }); + } + }; + /** + * @callback getServicesCallback + * @param {string[]} services - Array of service names. + */ + /** + * @callback getServicesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of active service names in ROS. + * + * @param {getServicesCallback} callback - Function with the following params: + * @param {getServicesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getServices = function (callback, failedCallback) { + var servicesClient = new Service({ + ros: this, + name: '/rosapi/services', + serviceType: 'rosapi/Services', + }); + var request = new ServiceRequest(); + if (typeof failedCallback === 'function') { + servicesClient.callService(request, function (result) { + callback(result.services); + }, function (message) { + failedCallback(message); + }); } else { - typeDefDict[fieldName] = [fieldType]; + servicesClient.callService(request, function (result) { + callback(result.services); + }); } - } - else { - // lookup the name - var sub = false; - for (var j = 0; j < hints.length; j++) { - if (hints[j].type.toString() === fieldType.toString()) { - sub = hints[j]; - break; - } + }; + /** + * @callback getServicesForTypeCallback + * @param {string[]} topics - Array of service names. + */ + /** + * @callback getServicesForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of services in ROS as an array as specific type. + * + * @param {string} serviceType - The service type to find. + * @param {getServicesForTypeCallback} callback - Function with the following params: + * @param {getServicesForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getServicesForType = function (serviceType, callback, failedCallback) { + var servicesForTypeClient = new Service({ + ros: this, + name: '/rosapi/services_for_type', + serviceType: 'rosapi/ServicesForType', + }); + var request = new ServiceRequest({ + type: serviceType, + }); + if (typeof failedCallback === 'function') { + servicesForTypeClient.callService(request, function (result) { + callback(result.services); + }, function (message) { + failedCallback(message); + }); } - if (sub) { - var subResult = decodeTypeDefsRec(sub, hints); - if (arrayLen === -1) { - } - else { - typeDefDict[fieldName] = [subResult]; - } + else { + servicesForTypeClient.callService(request, function (result) { + callback(result.services); + }); + } + }; + /** + * @callback getServiceRequestDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service request. + */ + /** + * @callback getServiceRequestDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS service request. + * + * @param {string} type - The type of the service. + * @param {getServiceRequestDetailsCallback} callback - Function with the following params: + * @param {getServiceRequestDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getServiceRequestDetails = function (type, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: '/rosapi/service_request_details', + serviceType: 'rosapi/ServiceRequestDetails', + }); + var request = new ServiceRequest({ + type: type, + }); + if (typeof failedCallback === 'function') { + serviceTypeClient.callService(request, function (result) { + callback(result); + }, function (message) { + failedCallback(message); + }); } else { - that.emit('error', 'Cannot find ' + fieldType + ' in decodeTypeDefs'); + serviceTypeClient.callService(request, function (result) { + callback(result); + }); } - } - } - return typeDefDict; - }; - - return decodeTypeDefsRec(defs[0], defs); -}; - -/** - * Retrieve a list of topics and their associated type definitions. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.result - The result object with the following params: - * @param {string[]} callback.result.topics - Array of topic names. - * @param {string[]} callback.result.types - Array of message type names. - * @param {string[]} callback.result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. - */ -Ros.prototype.getTopicsAndRawTypes = function(callback, failedCallback) { - var topicsAndRawTypesClient = new Service({ - ros : this, - name : '/rosapi/topics_and_raw_types', - serviceType : 'rosapi/TopicsAndRawTypes' - }); - - var request = new ServiceRequest(); - if (typeof failedCallback === 'function'){ - topicsAndRawTypesClient.callService(request, - function(result) { - callback(result); - }, - function(message){ - failedCallback(message); - } - ); - }else{ - topicsAndRawTypesClient.callService(request, function(result) { - callback(result); - }); - } -}; - - + }; + /** + * @callback getServiceResponseDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service response. + */ + /** + * @callback getServiceResponseDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS service response. + * + * @param {string} type - The type of the service. + * @param {getServiceResponseDetailsCallback} callback - Function with the following params: + * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getServiceResponseDetails = function (type, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: '/rosapi/service_response_details', + serviceType: 'rosapi/ServiceResponseDetails', + }); + var request = new ServiceRequest({ + type: type, + }); + if (typeof failedCallback === 'function') { + serviceTypeClient.callService(request, function (result) { + callback(result); + }, function (message) { + failedCallback(message); + }); + } + else { + serviceTypeClient.callService(request, function (result) { + callback(result); + }); + } + }; + /** + * @callback getNodesCallback + * @param {string[]} nodes - Array of node names. + */ + /** + * @callback getNodesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of active node names in ROS. + * + * @param {getNodesCallback} callback - Function with the following params: + * @param {getNodesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getNodes = function (callback, failedCallback) { + var nodesClient = new Service({ + ros: this, + name: '/rosapi/nodes', + serviceType: 'rosapi/Nodes', + }); + var request = new ServiceRequest(); + if (typeof failedCallback === 'function') { + nodesClient.callService(request, function (result) { + callback(result.nodes); + }, function (message) { + failedCallback(message); + }); + } + else { + nodesClient.callService(request, function (result) { + callback(result.nodes); + }); + } + }; + /** + * @callback getNodeDetailsCallback + * @param {string[]} subscriptions - Array of subscribed topic names. + * @param {string[]} publications - Array of published topic names. + * @param {string[]} services - Array of service names hosted. + */ + /** + * @callback getNodeDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * @callback getNodeDetailsLegacyCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.subscribing - Array of subscribed topic names. + * @param {string[]} result.publishing - Array of published topic names. + * @param {string[]} result.services - Array of service names hosted. + */ + /** + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is defined. + * + * @param {string} node - Name of the node. + * @param {getNodeDetailsCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + * + * @also + * + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is undefined. + * + * @param {string} node - Name of the node. + * @param {getNodeDetailsLegacyCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getNodeDetails = function (node, callback, failedCallback) { + var nodesClient = new Service({ + ros: this, + name: '/rosapi/node_details', + serviceType: 'rosapi/NodeDetails', + }); + var request = new ServiceRequest({ + node: node, + }); + if (typeof failedCallback === 'function') { + nodesClient.callService(request, function (result) { + callback(result.subscribing, result.publishing, result.services); + }, function (message) { + failedCallback(message); + }); + } + else { + nodesClient.callService(request, function (result) { + // @ts-expect-error -- callback parameter polymorphism, see JSDoc comment above + callback(result); + }); + } + }; + /** + * @callback getParamsCallback + * @param {string[]} params - Array of param names. + */ + /** + * @callback getParamsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of parameter names from the ROS Parameter Server. + * + * @param {getParamsCallback} callback - Function with the following params: + * @param {getParamsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getParams = function (callback, failedCallback) { + var paramsClient = new Service({ + ros: this, + name: '/rosapi/get_param_names', + serviceType: 'rosapi/GetParamNames', + }); + var request = new ServiceRequest(); + if (typeof failedCallback === 'function') { + paramsClient.callService(request, function (result) { + callback(result.names); + }, function (message) { + failedCallback(message); + }); + } + else { + paramsClient.callService(request, function (result) { + callback(result.names); + }); + } + }; + /** + * @callback getTopicTypeCallback + * @param {string} type - The type of the topic. + */ + /** + * @callback getTopicTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the type of a ROS topic. + * + * @param {string} topic - Name of the topic. + * @param {getTopicTypeCallback} callback - Function with the following params: + * @param {getTopicTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getTopicType = function (topic, callback, failedCallback) { + var topicTypeClient = new Service({ + ros: this, + name: '/rosapi/topic_type', + serviceType: 'rosapi/TopicType', + }); + var request = new ServiceRequest({ + topic: topic, + }); + if (typeof failedCallback === 'function') { + topicTypeClient.callService(request, function (result) { + callback(result.type); + }, function (message) { + failedCallback(message); + }); + } + else { + topicTypeClient.callService(request, function (result) { + callback(result.type); + }); + } + }; + /** + * @callback getServiceTypeCallback + * @param {string} type - The type of the service. + */ + /** + * @callback getServiceTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the type of a ROS service. + * + * @param {string} service - Name of the service. + * @param {getServiceTypeCallback} callback - Function with the following params: + * @param {getServiceTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getServiceType = function (service, callback, failedCallback) { + var serviceTypeClient = new Service({ + ros: this, + name: '/rosapi/service_type', + serviceType: 'rosapi/ServiceType', + }); + var request = new ServiceRequest({ + service: service, + }); + if (typeof failedCallback === 'function') { + serviceTypeClient.callService(request, function (result) { + callback(result.type); + }, function (message) { + failedCallback(message); + }); + } + else { + serviceTypeClient.callService(request, function (result) { + callback(result.type); + }); + } + }; + /** + * @callback getMessageDetailsCallback + * @param {string} details - An array of the message details. + */ + /** + * @callback getMessageDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS message. + * + * @param {string} message - The name of the message type. + * @param {getMessageDetailsCallback} callback - Function with the following params: + * @param {getMessageDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getMessageDetails = function (message, callback, failedCallback) { + var messageDetailClient = new Service({ + ros: this, + name: '/rosapi/message_details', + serviceType: 'rosapi/MessageDetails', + }); + var request = new ServiceRequest({ + type: message, + }); + if (typeof failedCallback === 'function') { + messageDetailClient.callService(request, function (result) { + callback(result.typedefs); + }, function (message) { + failedCallback(message); + }); + } + else { + messageDetailClient.callService(request, function (result) { + callback(result.typedefs); + }); + } + }; + /** + * Decode a typedef array into a dictionary like `rosmsg show foo/bar`. + * + * @param {Object[]} defs - Array of type_def dictionary. + */ + Ros.prototype.decodeTypeDefs = function (defs) { + var that = this; + var decodeTypeDefsRec = function (theType, hints) { + // calls itself recursively to resolve type definition using hints. + var typeDefDict = {}; + for (var i = 0; i < theType.fieldnames.length; i++) { + var arrayLen = theType.fieldarraylen[i]; + var fieldName = theType.fieldnames[i]; + var fieldType = theType.fieldtypes[i]; + if (fieldType.indexOf('/') === -1) { + // check the fieldType includes '/' or not + if (arrayLen === -1) { + typeDefDict[fieldName] = fieldType; + } + else { + typeDefDict[fieldName] = [fieldType]; + } + } + else { + // lookup the name + var sub = false; + for (var j = 0; j < hints.length; j++) { + if (hints[j].type.toString() === fieldType.toString()) { + sub = hints[j]; + break; + } + } + if (sub) { + var subResult = decodeTypeDefsRec(sub, hints); + if (arrayLen === -1) { + typeDefDict[fieldName] = subResult; // add this decoding result to dictionary + } + else { + typeDefDict[fieldName] = [subResult]; + } + } + else { + that.emit('error', 'Cannot find ' + fieldType + ' in decodeTypeDefs'); + } + } + } + return typeDefDict; + }; + return decodeTypeDefsRec(defs[0], defs); + }; + /** + * @callback getTopicsAndRawTypesCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + * @param {string[]} result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. + */ + /** + * @callback getTopicsAndRawTypesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics and their associated type definitions. + * + * @param {getTopicsAndRawTypesCallback} callback - Function with the following params: + * @param {getTopicsAndRawTypesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Ros.prototype.getTopicsAndRawTypes = function (callback, failedCallback) { + var topicsAndRawTypesClient = new Service({ + ros: this, + name: '/rosapi/topics_and_raw_types', + serviceType: 'rosapi/TopicsAndRawTypes', + }); + var request = new ServiceRequest(); + if (typeof failedCallback === 'function') { + topicsAndRawTypesClient.callService(request, function (result) { + callback(result); + }, function (message) { + failedCallback(message); + }); + } + else { + topicsAndRawTypesClient.callService(request, function (result) { + callback(result); + }); + } + }; + return Ros; +}(EventEmitter2)); module.exports = Ros; -},{"../util/workerSocket":49,"./Service":18,"./ServiceRequest":19,"./SocketAdapter.js":21,"eventemitter2":2,"object-assign":3,"ws":46}],18:[function(require,module,exports){ +},{"../util/workerSocket":110,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com */ - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ServiceResponse = require('./ServiceResponse'); var ServiceRequest = require('./ServiceRequest'); var EventEmitter2 = require('eventemitter2').EventEmitter2; - +var Ros = require('../core/Ros'); /** * A ROS service client. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The service name, like '/add_two_ints'. - * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. - */ -function Service(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.serviceType = options.serviceType; - this.isAdvertised = false; - - this._serviceCallback = null; -} -Service.prototype.__proto__ = EventEmitter2.prototype; -/** - * Call the service. Returns the service response in the - * callback. Does nothing if this service is currently advertised. - * - * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. - * @param {function} callback - Function with the following params: - * @param {Object} callback.response - The response from the service request. - * @param {function} [failedCallback] - The callback function when the service call failed with params: - * @param {string} failedCallback.error - The error message reported by ROS. */ -Service.prototype.callService = function(request, callback, failedCallback) { - if (this.isAdvertised) { - return; - } - - var serviceCallId = 'call_service:' + this.name + ':' + (++this.ros.idCounter); - - if (callback || failedCallback) { - this.ros.once(serviceCallId, function(message) { - if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === 'function') { - failedCallback(message.values); +var Service = /** @class */ (function (_super) { + __extends(Service, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The service name, like '/add_two_ints'. + * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. + */ + function Service(options) { + var _this = _super.call(this) || this; + _this.ros = options.ros; + _this.name = options.name; + _this.serviceType = options.serviceType; + _this.isAdvertised = false; + _this._serviceCallback = null; + return _this; + } + /** + * @callback callServiceCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback callServiceFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Call the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {callServiceCallback} callback - Function with the following params: + * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + Service.prototype.callService = function (request, callback, failedCallback) { + if (this.isAdvertised) { + return; } - } else if (typeof callback === 'function') { - callback(new ServiceResponse(message.values)); - } - }); - } - - var call = { - op : 'call_service', - id : serviceCallId, - service : this.name, - type: this.serviceType, - args : request - }; - this.ros.callOnConnection(call); -}; - -/** - * Advertise the service. This turns the Service object from a client - * into a server. The callback will be called with every request - * that's made on this service. - * - * @param {function} callback - This works similarly to the callback for a C++ service and should take the following params: - * @param {ServiceRequest} callback.request - The service request. - * @param {Object} callback.response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the service has finished successfully, - * i.e., without any fatal errors. - */ -Service.prototype.advertise = function(callback) { - if (this.isAdvertised || typeof callback !== 'function') { - return; - } - - this._serviceCallback = callback; - this.ros.on(this.name, this._serviceResponse.bind(this)); - this.ros.callOnConnection({ - op: 'advertise_service', - type: this.serviceType, - service: this.name - }); - this.isAdvertised = true; -}; - -Service.prototype.unadvertise = function() { - if (!this.isAdvertised) { - return; - } - this.ros.callOnConnection({ - op: 'unadvertise_service', - service: this.name - }); - this.isAdvertised = false; -}; - -Service.prototype._serviceResponse = function(rosbridgeRequest) { - var response = {}; - var success = this._serviceCallback(rosbridgeRequest.args, response); - - var call = { - op: 'service_response', - service: this.name, - values: new ServiceResponse(response), - result: success - }; - - if (rosbridgeRequest.id) { - call.id = rosbridgeRequest.id; - } - - this.ros.callOnConnection(call); -}; - + var serviceCallId = 'call_service:' + this.name + ':' + (++this.ros.idCounter).toString(); + if (callback || failedCallback) { + this.ros.once(serviceCallId, function (message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } + } + else if (typeof callback === 'function') { + callback(new ServiceResponse(message.values)); + } + }); + } + var call = { + op: 'call_service', + id: serviceCallId, + service: this.name, + type: this.serviceType, + args: request, + }; + this.ros.callOnConnection(call); + }; + /** + * @callback advertiseCallback + * @param {ServiceRequest} request - The service request. + * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the service has finished successfully, + * i.e., without any fatal errors. + */ + /** + * Advertise the service. This turns the Service object from a client + * into a server. The callback will be called with every request + * that's made on this service. + * + * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params + */ + Service.prototype.advertise = function (callback) { + if (this.isAdvertised || typeof callback !== 'function') { + return; + } + this._serviceCallback = callback; + this.ros.on(this.name, this._serviceResponse.bind(this)); + this.ros.callOnConnection({ + op: 'advertise_service', + type: this.serviceType, + service: this.name, + }); + this.isAdvertised = true; + }; + Service.prototype.unadvertise = function () { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: 'unadvertise_service', + service: this.name, + }); + this.isAdvertised = false; + }; + Service.prototype._serviceResponse = function (rosbridgeRequest) { + var response = {}; + if (this._serviceCallback) { + var success = this._serviceCallback(rosbridgeRequest.args, response); + } + var call = { + op: 'service_response', + service: this.name, + values: new ServiceResponse(response), + result: success, + }; + if (rosbridgeRequest.id) { + call.id = rosbridgeRequest.id; + } + this.ros.callOnConnection(call); + }; + return Service; +}(EventEmitter2)); module.exports = Service; -},{"./ServiceRequest":19,"./ServiceResponse":20,"eventemitter2":2}],19:[function(require,module,exports){ +},{"../core/Ros":81,"./ServiceRequest":83,"./ServiceResponse":84,"eventemitter2":16}],83:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com */ - var assign = require('object-assign'); - /** * A ServiceRequest is passed into the service call. * * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. + * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. */ function ServiceRequest(values) { - assign(this, values); + assign(this, values || {}); } - module.exports = ServiceRequest; -},{"object-assign":3}],20:[function(require,module,exports){ + +},{"object-assign":31}],84:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com */ - var assign = require('object-assign'); - /** * A ServiceResponse is returned from the service call. * @@ -4279,11 +21012,11 @@ var assign = require('object-assign'); * @param {Object} values - Object matching the fields defined in the .srv definition file. */ function ServiceResponse(values) { - assign(this, values); + assign(this, values); } - module.exports = ServiceResponse; -},{"object-assign":3}],21:[function(require,module,exports){ + +},{"object-assign":31}],85:[function(require,module,exports){ /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -4293,15 +21026,15 @@ module.exports = ServiceResponse; * @fileOverview */ 'use strict'; - var decompressPng = require('../util/decompressPng'); var CBOR = require('cbor-js'); var typedArrayTagger = require('../util/cborTypedArrayTags'); var BSON = null; -if(typeof bson !== 'undefined'){ +// @ts-expect-error -- require tricks to not include BSON in roslibjs. should we be doing this? +if (typeof bson !== 'undefined') { + // @ts-expect-error -- require tricks to not include BSON in roslibjs. should we be doing this? BSON = bson().BSON; } - /** * Event listeners for a WebSocket or TCP socket to a JavaScript * ROS Client. Sets up Messages for a given topic to trigger an @@ -4311,323 +21044,352 @@ if(typeof bson !== 'undefined'){ * @private */ function SocketAdapter(client) { - var decoder = null; - if (client.transportOptions.decoder) { - decoder = client.transportOptions.decoder; - } - - function handleMessage(message) { - if (message.op === 'publish') { - client.emit(message.topic, message.msg); - } else if (message.op === 'service_response') { - client.emit(message.id, message); - } else if (message.op === 'call_service') { - client.emit(message.service, message); - } else if(message.op === 'status'){ - if(message.id){ - client.emit('status:'+message.id, message); - } else { - client.emit('status', message); - } + var decoder = null; + if (client.transportOptions.decoder) { + decoder = client.transportOptions.decoder; } - } - - function handlePng(message, callback) { - if (message.op === 'png') { - decompressPng(message.data, callback); - } else { - callback(message); + function handleMessage(message) { + if (message.op === 'publish') { + client.emit(message.topic, message.msg); + } + else if (message.op === 'service_response') { + client.emit(message.id, message); + } + else if (message.op === 'call_service') { + client.emit(message.service, message); + } + else if (message.op === 'status') { + if (message.id) { + client.emit('status:' + message.id, message); + } + else { + client.emit('status', message); + } + } } - } - - function decodeBSON(data, callback) { - if (!BSON) { - throw 'Cannot process BSON encoded message without BSON header.'; + function handlePng(message, callback) { + if (message.op === 'png') { + decompressPng(message.data, callback); + } + else { + callback(message); + } } - var reader = new FileReader(); - reader.onload = function() { - var uint8Array = new Uint8Array(this.result); - var msg = BSON.deserialize(uint8Array); - callback(msg); - }; - reader.readAsArrayBuffer(data); - } - - return { - /** - * Emit a 'connection' event on WebSocket connection. - * - * @param {function} event - The argument to emit with the event. - * @memberof SocketAdapter - */ - onopen: function onOpen(event) { - client.isConnected = true; - client.emit('connection', event); - }, - - /** - * Emit a 'close' event on WebSocket disconnection. - * - * @param {function} event - The argument to emit with the event. - * @memberof SocketAdapter - */ - onclose: function onClose(event) { - client.isConnected = false; - client.emit('close', event); - }, - - /** - * Emit an 'error' event whenever there was an error. - * - * @param {function} event - The argument to emit with the event. - * @memberof SocketAdapter - */ - onerror: function onError(event) { - client.emit('error', event); - }, - - /** - * Parse message responses from rosbridge and send to the appropriate - * topic, service, or param. - * - * @param {Object} data - The raw JSON message from rosbridge. - * @memberof SocketAdapter - */ - onmessage: function onMessage(data) { - if (decoder) { - decoder(data.data, function (message) { - handleMessage(message); - }); - } else if (typeof Blob !== 'undefined' && data.data instanceof Blob) { - decodeBSON(data.data, function (message) { - handlePng(message, handleMessage); - }); - } else if (data.data instanceof ArrayBuffer) { - var decoded = CBOR.decode(data.data, typedArrayTagger); - handleMessage(decoded); - } else { - var message = JSON.parse(typeof data === 'string' ? data : data.data); - handlePng(message, handleMessage); - } + function decodeBSON(data, callback) { + if (!BSON) { + throw 'Cannot process BSON encoded message without BSON header.'; + } + var reader = new FileReader(); + reader.onload = function () { + if (this.result) { + if (typeof this.result === 'string') { + var uint8Array = new Uint8Array(this.result.split('').map(function (c) { return c.charCodeAt(0); })); + } + else { + var uint8Array = new Uint8Array(this.result); + } + var msg = BSON.deserialize(uint8Array); + callback(msg); + } + }; + reader.readAsArrayBuffer(data); } - }; + return { + /** + * Emit a 'connection' event on WebSocket connection. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onopen: function onOpen(event) { + client.isConnected = true; + client.emit('connection', event); + }, + /** + * Emit a 'close' event on WebSocket disconnection. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onclose: function onClose(event) { + client.isConnected = false; + client.emit('close', event); + }, + /** + * Emit an 'error' event whenever there was an error. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onerror: function onError(event) { + client.emit('error', event); + }, + /** + * Parse message responses from rosbridge and send to the appropriate + * topic, service, or param. + * + * @param {Object} data - The raw JSON message from rosbridge. + * @memberof SocketAdapter + */ + onmessage: function onMessage(data) { + if (decoder) { + decoder(data.data, function (message) { + handleMessage(message); + }); + } + else if (typeof Blob !== 'undefined' && data.data instanceof Blob) { + decodeBSON(data.data, function (message) { + handlePng(message, handleMessage); + }); + } + else if (data.data instanceof ArrayBuffer) { + var decoded = CBOR.decode(data.data, typedArrayTagger); + handleMessage(decoded); + } + else { + var message = JSON.parse(typeof data === 'string' ? data : data.data); + handlePng(message, handleMessage); + } + } + }; } - module.exports = SocketAdapter; -},{"../util/cborTypedArrayTags":44,"../util/decompressPng":48,"cbor-js":1}],22:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":108,"../util/decompressPng":109,"cbor-js":14}],86:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com */ - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EventEmitter2 = require('eventemitter2').EventEmitter2; var Message = require('./Message'); - +var Ros = require('../core/Ros'); /** * Publish and/or subscribe to a topic in ROS. * * Emits the following events: * * 'warning' - If there are any warning during the Topic creation. * * 'message' - The message data from rosbridge. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} options.name - The topic name, like '/cmd_vel'. - * @param {string} options.messageType - The message type, like 'std_msgs/String'. - * @param {string} [options.compression=none] - The type of compression to use, like 'png', 'cbor', or 'cbor-raw'. - * @param {number} [options.throttle_rate=0] - The rate (in ms in between messages) at which to throttle the topics. - * @param {number} [options.queue_size=100] - The queue created at bridge side for re-publishing webtopics. - * @param {boolean} [options.latch=false] - Latch the topic when publishing. - * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. - * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. */ -function Topic(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.messageType = options.messageType; - this.isAdvertised = false; - this.compression = options.compression || 'none'; - this.throttle_rate = options.throttle_rate || 0; - this.latch = options.latch || false; - this.queue_size = options.queue_size || 100; - this.queue_length = options.queue_length || 0; - this.reconnect_on_close = options.reconnect_on_close !== undefined ? options.reconnect_on_close : true; - - // Check for valid compression types - if (this.compression && this.compression !== 'png' && - this.compression !== 'cbor' && this.compression !== 'cbor-raw' && - this.compression !== 'none') { - this.emit('warning', this.compression + - ' compression is not supported. No compression will be used.'); - this.compression = 'none'; - } - - // Check if throttle rate is negative - if (this.throttle_rate < 0) { - this.emit('warning', this.throttle_rate + ' is not allowed. Set to 0'); - this.throttle_rate = 0; - } - - var that = this; - if (this.reconnect_on_close) { - this.callForSubscribeAndAdvertise = function(message) { - that.ros.callOnConnection(message); - - that.waitForReconnect = false; - that.reconnectFunc = function() { - if(!that.waitForReconnect) { - that.waitForReconnect = true; - that.ros.callOnConnection(message); - that.ros.once('connection', function() { - that.waitForReconnect = false; - }); +var Topic = /** @class */ (function (_super) { + __extends(Topic, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The topic name, like '/cmd_vel'. + * @param {string} options.messageType - The message type, like 'std_msgs/String'. + * @param {string} [options.compression=none] - The type of compression to use, like 'png', 'cbor', or 'cbor-raw'. + * @param {number} [options.throttle_rate=0] - The rate (in ms in between messages) at which to throttle the topics. + * @param {number} [options.queue_size=100] - The queue created at bridge side for re-publishing webtopics. + * @param {boolean} [options.latch=false] - Latch the topic when publishing. + * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. + * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. + */ + function Topic(options) { + var _this = _super.call(this) || this; + _this.waitForReconnect = false; + /** @type {import('eventemitter2').ListenerFn|undefined} */ + _this.reconnectFunc = undefined; + _this.ros = options.ros; + _this.name = options.name; + _this.messageType = options.messageType; + _this.isAdvertised = false; + _this.compression = options.compression || 'none'; + _this.throttle_rate = options.throttle_rate || 0; + _this.latch = options.latch || false; + _this.queue_size = options.queue_size || 100; + _this.queue_length = options.queue_length || 0; + _this.reconnect_on_close = + options.reconnect_on_close !== undefined + ? options.reconnect_on_close + : true; + // Check for valid compression types + if (_this.compression && + _this.compression !== 'png' && + _this.compression !== 'cbor' && + _this.compression !== 'cbor-raw' && + _this.compression !== 'none') { + _this.emit('warning', _this.compression + + ' compression is not supported. No compression will be used.'); + _this.compression = 'none'; } - }; - that.ros.on('close', that.reconnectFunc); + // Check if throttle rate is negative + if (_this.throttle_rate < 0) { + _this.emit('warning', _this.throttle_rate + ' is not allowed. Set to 0'); + _this.throttle_rate = 0; + } + var that = _this; + if (_this.reconnect_on_close) { + _this.callForSubscribeAndAdvertise = function (message) { + that.ros.callOnConnection(message); + that.waitForReconnect = false; + that.reconnectFunc = function () { + if (!that.waitForReconnect) { + that.waitForReconnect = true; + that.ros.callOnConnection(message); + that.ros.once('connection', function () { + that.waitForReconnect = false; + }); + } + }; + that.ros.on('close', that.reconnectFunc); + }; + } + else { + _this.callForSubscribeAndAdvertise = _this.ros.callOnConnection; + } + _this._messageCallback = function (data) { + that.emit('message', new Message(data)); + }; + return _this; + } + /** + * @callback subscribeCallback + * @param {Object} message - The published message. + */ + /** + * Every time a message is published for the given topic, the callback + * will be called with the message object. + * + * @param {subscribeCallback} callback - Function with the following params: + */ + Topic.prototype.subscribe = function (callback) { + if (typeof callback === 'function') { + this.on('message', callback); + } + if (this.subscribeId) { + return; + } + this.ros.on(this.name, this._messageCallback); + this.subscribeId = + 'subscribe:' + this.name + ':' + (++this.ros.idCounter).toString(); + this.callForSubscribeAndAdvertise({ + op: 'subscribe', + id: this.subscribeId, + type: this.messageType, + topic: this.name, + compression: this.compression, + throttle_rate: this.throttle_rate, + queue_length: this.queue_length, + }); }; - } - else { - this.callForSubscribeAndAdvertise = this.ros.callOnConnection; - } - - this._messageCallback = function(data) { - that.emit('message', new Message(data)); - }; -} -Topic.prototype.__proto__ = EventEmitter2.prototype; - -/** - * Every time a message is published for the given topic, the callback - * will be called with the message object. - * - * @param {function} callback - Function with the following params: - * @param {Object} callback.message - The published message. - */ -Topic.prototype.subscribe = function(callback) { - if (typeof callback === 'function') { - this.on('message', callback); - } - - if (this.subscribeId) { return; } - this.ros.on(this.name, this._messageCallback); - this.subscribeId = 'subscribe:' + this.name + ':' + (++this.ros.idCounter); - - this.callForSubscribeAndAdvertise({ - op: 'subscribe', - id: this.subscribeId, - type: this.messageType, - topic: this.name, - compression: this.compression, - throttle_rate: this.throttle_rate, - queue_length: this.queue_length - }); -}; - -/** - * Unregister as a subscriber for the topic. Unsubscribing will stop - * and remove all subscribe callbacks. To remove a callback, you must - * explicitly pass the callback function in. - * - * @param {function} [callback] - The callback to unregister, if - * provided and other listeners are registered the topic won't - * unsubscribe, just stop emitting to the passed listener. - */ -Topic.prototype.unsubscribe = function(callback) { - if (callback) { - this.off('message', callback); - // If there is any other callbacks still subscribed don't unsubscribe - if (this.listeners('message').length) { return; } - } - if (!this.subscribeId) { return; } - // Note: Don't call this.removeAllListeners, allow client to handle that themselves - this.ros.off(this.name, this._messageCallback); - if(this.reconnect_on_close) { - this.ros.off('close', this.reconnectFunc); - } - this.emit('unsubscribe'); - this.ros.callOnConnection({ - op: 'unsubscribe', - id: this.subscribeId, - topic: this.name - }); - this.subscribeId = null; -}; - - -/** - * Register as a publisher for the topic. - */ -Topic.prototype.advertise = function() { - if (this.isAdvertised) { - return; - } - this.advertiseId = 'advertise:' + this.name + ':' + (++this.ros.idCounter); - this.callForSubscribeAndAdvertise({ - op: 'advertise', - id: this.advertiseId, - type: this.messageType, - topic: this.name, - latch: this.latch, - queue_size: this.queue_size - }); - this.isAdvertised = true; - - if(!this.reconnect_on_close) { - var that = this; - this.ros.on('close', function() { - that.isAdvertised = false; - }); - } -}; - -/** - * Unregister as a publisher for the topic. - */ -Topic.prototype.unadvertise = function() { - if (!this.isAdvertised) { - return; - } - if(this.reconnect_on_close) { - this.ros.off('close', this.reconnectFunc); - } - this.emit('unadvertise'); - this.ros.callOnConnection({ - op: 'unadvertise', - id: this.advertiseId, - topic: this.name - }); - this.isAdvertised = false; -}; - -/** - * Publish the message. - * - * @param {Message} message - A ROSLIB.Message object. - */ -Topic.prototype.publish = function(message) { - if (!this.isAdvertised) { - this.advertise(); - } - - this.ros.idCounter++; - var call = { - op: 'publish', - id: 'publish:' + this.name + ':' + this.ros.idCounter, - topic: this.name, - msg: message, - latch: this.latch - }; - this.ros.callOnConnection(call); -}; - + /** + * Unregister as a subscriber for the topic. Unsubscribing will stop + * and remove all subscribe callbacks. To remove a callback, you must + * explicitly pass the callback function in. + * + * @param {import('eventemitter2').ListenerFn} [callback] - The callback to unregister, if + * provided and other listeners are registered the topic won't + * unsubscribe, just stop emitting to the passed listener. + */ + Topic.prototype.unsubscribe = function (callback) { + if (callback) { + this.off('message', callback); + // If there is any other callbacks still subscribed don't unsubscribe + if (this.listeners('message').length) { + return; + } + } + if (!this.subscribeId) { + return; + } + // Note: Don't call this.removeAllListeners, allow client to handle that themselves + this.ros.off(this.name, this._messageCallback); + if (this.reconnect_on_close && this.reconnectFunc) { + this.ros.off('close', this.reconnectFunc); + } + this.emit('unsubscribe'); + this.ros.callOnConnection({ + op: 'unsubscribe', + id: this.subscribeId, + topic: this.name, + }); + this.subscribeId = null; + }; + /** + * Register as a publisher for the topic. + */ + Topic.prototype.advertise = function () { + if (this.isAdvertised) { + return; + } + this.advertiseId = + 'advertise:' + this.name + ':' + (++this.ros.idCounter).toString(); + this.callForSubscribeAndAdvertise({ + op: 'advertise', + id: this.advertiseId, + type: this.messageType, + topic: this.name, + latch: this.latch, + queue_size: this.queue_size, + }); + this.isAdvertised = true; + if (!this.reconnect_on_close) { + var that = this; + this.ros.on('close', function () { + that.isAdvertised = false; + }); + } + }; + /** + * Unregister as a publisher for the topic. + */ + Topic.prototype.unadvertise = function () { + if (!this.isAdvertised) { + return; + } + if (this.reconnect_on_close && this.reconnectFunc) { + this.ros.off('close', this.reconnectFunc); + } + this.emit('unadvertise'); + this.ros.callOnConnection({ + op: 'unadvertise', + id: this.advertiseId, + topic: this.name, + }); + this.isAdvertised = false; + }; + /** + * Publish the message. + * + * @param {Message} message - A ROSLIB.Message object. + */ + Topic.prototype.publish = function (message) { + if (!this.isAdvertised) { + this.advertise(); + } + this.ros.idCounter++; + var call = { + op: 'publish', + id: 'publish:' + this.name + ':' + this.ros.idCounter, + topic: this.name, + msg: message, + latch: this.latch, + }; + this.ros.callOnConnection(call); + }; + return Topic; +}(EventEmitter2)); module.exports = Topic; -},{"./Message":15,"eventemitter2":2}],23:[function(require,module,exports){ +},{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ +"use strict"; var mixin = require('../mixin'); - var core = module.exports = { Ros: require('./Ros'), Topic: require('./Topic'), @@ -4637,283 +21399,280 @@ var core = module.exports = { ServiceRequest: require('./ServiceRequest'), ServiceResponse: require('./ServiceResponse') }; - mixin(core.Ros, ['Param', 'Service', 'Topic'], core); -},{"../mixin":29,"./Message":15,"./Param":16,"./Ros":17,"./Service":18,"./ServiceRequest":19,"./ServiceResponse":20,"./Topic":22}],24:[function(require,module,exports){ +},{"../mixin":93,"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com */ - var Vector3 = require('./Vector3'); var Quaternion = require('./Quaternion'); - +var Transform = require('./Transform'); /** * A Pose in 3D space. Values are copied into this object. - * - * @constructor - * @param {Object} options - * @param {Vector3} options.position - The ROSLIB.Vector3 describing the position. - * @param {Quaternion} options.orientation - The ROSLIB.Quaternion describing the orientation. - */ -function Pose(options) { - options = options || {}; - // copy the values into this object if they exist - this.position = new Vector3(options.position); - this.orientation = new Quaternion(options.orientation); -} - -/** - * Apply a transform against this pose. - * - * @param {Transform} tf - The transform to be applied. - */ -Pose.prototype.applyTransform = function(tf) { - this.position.multiplyQuaternion(tf.rotation); - this.position.add(tf.translation); - var tmp = tf.rotation.clone(); - tmp.multiply(this.orientation); - this.orientation = tmp; -}; - -/** - * Clone a copy of this pose. - * - * @returns {Pose} The cloned pose. - */ -Pose.prototype.clone = function() { - return new Pose(this); -}; - -/** - * Multiply this pose with another pose without altering this pose. - * - * @returns {Pose} The result of the multiplication. - */ -Pose.prototype.multiply = function(pose) { - var p = pose.clone(); - p.applyTransform({ rotation: this.orientation, translation: this.position }); - return p; -}; - -/** - * Compute the inverse of this pose. - * - * @returns {Pose} The inverse of the pose. */ -Pose.prototype.getInverse = function() { - var inverse = this.clone(); - inverse.orientation.invert(); - inverse.position.multiplyQuaternion(inverse.orientation); - inverse.position.x *= -1; - inverse.position.y *= -1; - inverse.position.z *= -1; - return inverse; -}; - +var Pose = /** @class */ (function () { + /** + * @param {Object} [options] + * @param {Vector3} [options.position] - The ROSLIB.Vector3 describing the position. + * @param {Quaternion} [options.orientation] - The ROSLIB.Quaternion describing the orientation. + */ + function Pose(options) { + options = options || {}; + // copy the values into this object if they exist + options = options || {}; + this.position = new Vector3(options.position); + this.orientation = new Quaternion(options.orientation); + } + /** + * Apply a transform against this pose. + * + * @param {Transform} tf - The transform to be applied. + */ + Pose.prototype.applyTransform = function (tf) { + this.position.multiplyQuaternion(tf.rotation); + this.position.add(tf.translation); + var tmp = tf.rotation.clone(); + tmp.multiply(this.orientation); + this.orientation = tmp; + }; + /** + * Clone a copy of this pose. + * + * @returns {Pose} The cloned pose. + */ + Pose.prototype.clone = function () { + return new Pose(this); + }; + /** + * Multiply this pose with another pose without altering this pose. + * + * @returns {Pose} The result of the multiplication. + */ + Pose.prototype.multiply = function (pose) { + var p = pose.clone(); + p.applyTransform({ + rotation: this.orientation, + translation: this.position, + }); + return p; + }; + /** + * Compute the inverse of this pose. + * + * @returns {Pose} The inverse of the pose. + */ + Pose.prototype.getInverse = function () { + var inverse = this.clone(); + inverse.orientation.invert(); + inverse.position.multiplyQuaternion(inverse.orientation); + inverse.position.x *= -1; + inverse.position.y *= -1; + inverse.position.z *= -1; + return inverse; + }; + return Pose; +}()); module.exports = Pose; -},{"./Quaternion":25,"./Vector3":27}],25:[function(require,module,exports){ +},{"./Quaternion":89,"./Transform":90,"./Vector3":91}],89:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com */ - /** * A Quaternion. - * - * @constructor - * @param {Object} options - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. - * @param {number} [options.w=1] - The w value. - */ -function Quaternion(options) { - options = options || {}; - this.x = options.x || 0; - this.y = options.y || 0; - this.z = options.z || 0; - this.w = (typeof options.w === 'number') ? options.w : 1; -} - -/** - * Perform a conjugation on this quaternion. - */ -Quaternion.prototype.conjugate = function() { - this.x *= -1; - this.y *= -1; - this.z *= -1; -}; - -/** - * Return the norm of this quaternion. - */ -Quaternion.prototype.norm = function() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); -}; - -/** - * Perform a normalization on this quaternion. - */ -Quaternion.prototype.normalize = function() { - var l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - if (l === 0) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - } else { - l = 1 / l; - this.x = this.x * l; - this.y = this.y * l; - this.z = this.z * l; - this.w = this.w * l; - } -}; - -/** - * Convert this quaternion into its inverse. - */ -Quaternion.prototype.invert = function() { - this.conjugate(); - this.normalize(); -}; - -/** - * Set the values of this quaternion to the product of itself and the given quaternion. - * - * @param {Quaternion} q - The quaternion to multiply with. */ -Quaternion.prototype.multiply = function(q) { - var newX = this.x * q.w + this.y * q.z - this.z * q.y + this.w * q.x; - var newY = -this.x * q.z + this.y * q.w + this.z * q.x + this.w * q.y; - var newZ = this.x * q.y - this.y * q.x + this.z * q.w + this.w * q.z; - var newW = -this.x * q.x - this.y * q.y - this.z * q.z + this.w * q.w; - this.x = newX; - this.y = newY; - this.z = newZ; - this.w = newW; -}; - -/** - * Clone a copy of this quaternion. - * - * @returns {Quaternion} The cloned quaternion. - */ -Quaternion.prototype.clone = function() { - return new Quaternion(this); -}; - +var Quaternion = /** @class */ (function () { + /** + * @param {Object} [options] + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + * @param {number} [options.w=1] - The w value. + */ + function Quaternion(options) { + options = options || {}; + this.x = options.x || 0; + this.y = options.y || 0; + this.z = options.z || 0; + this.w = typeof options.w === 'number' ? options.w : 1; + } + /** + * Perform a conjugation on this quaternion. + */ + Quaternion.prototype.conjugate = function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + }; + /** + * Return the norm of this quaternion. + */ + Quaternion.prototype.norm = function () { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + }; + /** + * Perform a normalization on this quaternion. + */ + Quaternion.prototype.normalize = function () { + var l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if (l === 0) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } + else { + l = 1 / l; + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + }; + /** + * Convert this quaternion into its inverse. + */ + Quaternion.prototype.invert = function () { + this.conjugate(); + this.normalize(); + }; + /** + * Set the values of this quaternion to the product of itself and the given quaternion. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + Quaternion.prototype.multiply = function (q) { + var newX = this.x * q.w + this.y * q.z - this.z * q.y + this.w * q.x; + var newY = -this.x * q.z + this.y * q.w + this.z * q.x + this.w * q.y; + var newZ = this.x * q.y - this.y * q.x + this.z * q.w + this.w * q.z; + var newW = -this.x * q.x - this.y * q.y - this.z * q.z + this.w * q.w; + this.x = newX; + this.y = newY; + this.z = newZ; + this.w = newW; + }; + /** + * Clone a copy of this quaternion. + * + * @returns {Quaternion} The cloned quaternion. + */ + Quaternion.prototype.clone = function () { + return new Quaternion(this); + }; + return Quaternion; +}()); module.exports = Quaternion; -},{}],26:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com */ - var Vector3 = require('./Vector3'); var Quaternion = require('./Quaternion'); - /** * A Transform in 3-space. Values are copied into this object. - * - * @constructor - * @param {Object} options - * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. - * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. - */ -function Transform(options) { - options = options || {}; - // Copy the values into this object if they exist - this.translation = new Vector3(options.translation); - this.rotation = new Quaternion(options.rotation); -} - -/** - * Clone a copy of this transform. - * - * @returns {Transform} The cloned transform. */ -Transform.prototype.clone = function() { - return new Transform(this); -}; - +var Transform = /** @class */ (function () { + /** + * @param {Object} options + * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. + * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. + */ + function Transform(options) { + // Copy the values into this object if they exist + this.translation = new Vector3(options.translation); + this.rotation = new Quaternion(options.rotation); + } + /** + * Clone a copy of this transform. + * + * @returns {Transform} The cloned transform. + */ + Transform.prototype.clone = function () { + return new Transform(this); + }; + return Transform; +}()); module.exports = Transform; -},{"./Quaternion":25,"./Vector3":27}],27:[function(require,module,exports){ +},{"./Quaternion":89,"./Vector3":91}],91:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com */ - +var Quaternion = require('./Quaternion'); /** * A 3D vector. - * - * @constructor - * @param {Object} options - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. */ -function Vector3(options) { - options = options || {}; - this.x = options.x || 0; - this.y = options.y || 0; - this.z = options.z || 0; -} - -/** - * Set the values of this vector to the sum of itself and the given vector. - * - * @param {Vector3} v - The vector to add with. - */ -Vector3.prototype.add = function(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; -}; - -/** - * Set the values of this vector to the difference of itself and the given vector. - * - * @param {Vector3} v - The vector to subtract with. - */ -Vector3.prototype.subtract = function(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; -}; - -/** - * Multiply the given Quaternion with this vector. - * - * @param {Quaternion} q - The quaternion to multiply with. - */ -Vector3.prototype.multiplyQuaternion = function(q) { - var ix = q.w * this.x + q.y * this.z - q.z * this.y; - var iy = q.w * this.y + q.z * this.x - q.x * this.z; - var iz = q.w * this.z + q.x * this.y - q.y * this.x; - var iw = -q.x * this.x - q.y * this.y - q.z * this.z; - this.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y; - this.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z; - this.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x; -}; - -/** - * Clone a copy of this vector. - * - * @returns {Vector3} The cloned vector. - */ -Vector3.prototype.clone = function() { - return new Vector3(this); -}; - +var Vector3 = /** @class */ (function () { + /** + * @param {Object} [options] + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + */ + function Vector3(options) { + options = options || {}; + this.x = options.x || 0; + this.y = options.y || 0; + this.z = options.z || 0; + } + /** + * Set the values of this vector to the sum of itself and the given vector. + * + * @param {Vector3} v - The vector to add with. + */ + Vector3.prototype.add = function (v) { + this.x += v.x; + this.y += v.y; + this.z += v.z; + }; + /** + * Set the values of this vector to the difference of itself and the given vector. + * + * @param {Vector3} v - The vector to subtract with. + */ + Vector3.prototype.subtract = function (v) { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + }; + /** + * Multiply the given Quaternion with this vector. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + Vector3.prototype.multiplyQuaternion = function (q) { + var ix = q.w * this.x + q.y * this.z - q.z * this.y; + var iy = q.w * this.y + q.z * this.x - q.x * this.z; + var iz = q.w * this.z + q.x * this.y - q.y * this.x; + var iw = -q.x * this.x - q.y * this.y - q.z * this.z; + this.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y; + this.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z; + this.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x; + }; + /** + * Clone a copy of this vector. + * + * @returns {Vector3} The cloned vector. + */ + Vector3.prototype.clone = function () { + return new Vector3(this); + }; + return Vector3; +}()); module.exports = Vector3; -},{}],28:[function(require,module,exports){ +},{"./Quaternion":89}],92:[function(require,module,exports){ +"use strict"; module.exports = { Pose: require('./Pose'), Quaternion: require('./Quaternion'), @@ -4921,7 +21680,8 @@ module.exports = { Vector3: require('./Vector3') }; -},{"./Pose":24,"./Quaternion":25,"./Transform":26,"./Vector3":27}],29:[function(require,module,exports){ +},{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ +"use strict"; /** * Mixin a feature to the core/Ros prototype. * For example, mixin(Ros, ['Topic'], {Topic: }) @@ -4930,812 +21690,824 @@ module.exports = { * * @author Graeme Yeates - github.com/megawac */ -module.exports = function(Ros, classes, features) { - classes.forEach(function(className) { +module.exports = function (Ros, classes, features) { + classes.forEach(function (className) { var Class = features[className]; - Ros.prototype[className] = function(options) { + Ros.prototype[className] = function (options) { options.ros = this; return new Class(options); }; }); }; -},{}],30:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com */ - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var EventEmitter2 = require('eventemitter2').EventEmitter2; var ActionClient = require('../actionlib/ActionClient'); var Goal = require('../actionlib/Goal'); - var Service = require('../core/Service.js'); var ServiceRequest = require('../core/ServiceRequest.js'); var Topic = require('../core/Topic.js'); - var Transform = require('../math/Transform'); - +var Ros = require('../core/Ros'); /** * A TF Client that listens to TFs from tf2_web_republisher. - * - * @constructor - * @param {Object} options - * @param {Ros} options.ros - The ROSLIB.Ros connection handle. - * @param {string} [options.fixedFrame=base_link] - The fixed frame. - * @param {number} [options.angularThres=2.0] - The angular threshold for the TF republisher. - * @param {number} [options.transThres=0.01] - The translation threshold for the TF republisher. - * @param {number} [options.rate=10.0] - The rate for the TF republisher. - * @param {number} [options.updateDelay=50] - The time (in ms) to wait after a new subscription - * to update the TF republisher's list of TFs. - * @param {number} [options.topicTimeout=2.0] - The timeout parameter for the TF republisher. - * @param {string} [options.serverName=/tf2_web_republisher] - The name of the tf2_web_republisher server. - * @param {string} [options.repubServiceName=/republish_tfs] - The name of the republish_tfs service (non groovy compatibility mode only). - */ -function TFClient(options) { - options = options || {}; - this.ros = options.ros; - this.fixedFrame = options.fixedFrame || 'base_link'; - this.angularThres = options.angularThres || 2.0; - this.transThres = options.transThres || 0.01; - this.rate = options.rate || 10.0; - this.updateDelay = options.updateDelay || 50; - var seconds = options.topicTimeout || 2.0; - var secs = Math.floor(seconds); - var nsecs = Math.floor((seconds - secs) * 1000000000); - this.topicTimeout = { - secs: secs, - nsecs: nsecs - }; - this.serverName = options.serverName || '/tf2_web_republisher'; - this.repubServiceName = options.repubServiceName || '/republish_tfs'; - - this.currentGoal = false; - this.currentTopic = false; - this.frameInfos = {}; - this.republisherUpdateRequested = false; - this._subscribeCB = null; - this._isDisposed = false; - - // Create an Action Client - this.actionClient = new ActionClient({ - ros : options.ros, - serverName : this.serverName, - actionName : 'tf2_web_republisher/TFSubscriptionAction', - omitStatus : true, - omitResult : true - }); - - // Create a Service Client - this.serviceClient = new Service({ - ros: options.ros, - name: this.repubServiceName, - serviceType: 'tf2_web_republisher/RepublishTFs' - }); -} - -/** - * Process the incoming TF message and send them out using the callback - * functions. - * - * @param {Object} tf - The TF message from the server. - */ -TFClient.prototype.processTFArray = function(tf) { - var that = this; - tf.transforms.forEach(function(transform) { - var frameID = transform.child_frame_id; - if (frameID[0] === '/') - { - frameID = frameID.substring(1); - } - var info = this.frameInfos[frameID]; - if (info) { - info.transform = new Transform({ - translation : transform.transform.translation, - rotation : transform.transform.rotation - }); - info.cbs.forEach(function(cb) { - cb(info.transform); - }); - } - }, this); -}; - -/** - * Create and send a new goal (or service request) to the tf2_web_republisher - * based on the current list of TFs. */ -TFClient.prototype.updateGoal = function() { - var goalMessage = { - source_frames : Object.keys(this.frameInfos), - target_frame : this.fixedFrame, - angular_thres : this.angularThres, - trans_thres : this.transThres, - rate : this.rate - }; - - // if we're running in groovy compatibility mode (the default) - // then use the action interface to tf2_web_republisher - if(this.ros.groovyCompatibility) { - if (this.currentGoal) { - this.currentGoal.cancel(); +var TFClient = /** @class */ (function (_super) { + __extends(TFClient, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} [options.fixedFrame=base_link] - The fixed frame. + * @param {number} [options.angularThres=2.0] - The angular threshold for the TF republisher. + * @param {number} [options.transThres=0.01] - The translation threshold for the TF republisher. + * @param {number} [options.rate=10.0] - The rate for the TF republisher. + * @param {number} [options.updateDelay=50] - The time (in ms) to wait after a new subscription + * to update the TF republisher's list of TFs. + * @param {number} [options.topicTimeout=2.0] - The timeout parameter for the TF republisher. + * @param {string} [options.serverName="/tf2_web_republisher"] - The name of the tf2_web_republisher server. + * @param {string} [options.repubServiceName="/republish_tfs"] - The name of the republish_tfs service (non groovy compatibility mode only). + */ + function TFClient(options) { + var _this = _super.call(this) || this; + /** @type {Goal|undefined} */ + _this.currentGoal = undefined; + /** @type {Topic|undefined} */ + _this.currentTopic = undefined; + _this.ros = options.ros; + _this.fixedFrame = options.fixedFrame || 'base_link'; + _this.angularThres = options.angularThres || 2.0; + _this.transThres = options.transThres || 0.01; + _this.rate = options.rate || 10.0; + _this.updateDelay = options.updateDelay || 50; + var seconds = options.topicTimeout || 2.0; + var secs = Math.floor(seconds); + var nsecs = Math.floor((seconds - secs) * 1000000000); + _this.topicTimeout = { + secs: secs, + nsecs: nsecs, + }; + _this.serverName = options.serverName || '/tf2_web_republisher'; + _this.repubServiceName = options.repubServiceName || '/republish_tfs'; + _this.frameInfos = {}; + _this.republisherUpdateRequested = false; + _this._subscribeCB = null; + _this._isDisposed = false; + // Create an Action Client + _this.actionClient = new ActionClient({ + ros: options.ros, + serverName: _this.serverName, + actionName: 'tf2_web_republisher/TFSubscriptionAction', + omitStatus: true, + omitResult: true, + }); + // Create a Service Client + _this.serviceClient = new Service({ + ros: options.ros, + name: _this.repubServiceName, + serviceType: 'tf2_web_republisher/RepublishTFs', + }); + return _this; } - this.currentGoal = new Goal({ - actionClient : this.actionClient, - goalMessage : goalMessage - }); - - this.currentGoal.on('feedback', this.processTFArray.bind(this)); - this.currentGoal.send(); - } - else { - // otherwise, use the service interface - // The service interface has the same parameters as the action, - // plus the timeout - goalMessage.timeout = this.topicTimeout; - var request = new ServiceRequest(goalMessage); - - this.serviceClient.callService(request, this.processResponse.bind(this)); - } - - this.republisherUpdateRequested = false; -}; - -/** - * Process the service response and subscribe to the tf republisher - * topic. - * - * @param {Object} response - The service response containing the topic name. - */ -TFClient.prototype.processResponse = function(response) { - // Do not setup a topic subscription if already disposed. Prevents a race condition where - // The dispose() function is called before the service call receives a response. - if (this._isDisposed) { - return; - } - - // if we subscribed to a topic before, unsubscribe so - // the republisher stops publishing it - if (this.currentTopic) { - this.currentTopic.unsubscribe(this._subscribeCB); - } - - this.currentTopic = new Topic({ - ros: this.ros, - name: response.topic_name, - messageType: 'tf2_web_republisher/TFArray' - }); - this._subscribeCB = this.processTFArray.bind(this); - this.currentTopic.subscribe(this._subscribeCB); -}; - -/** - * Subscribe to the given TF frame. - * - * @param {string} frameID - The TF frame to subscribe to. - * @param {function} callback - Function with the following params: - * @param {Transform} callback.transform - The transform data. - */ -TFClient.prototype.subscribe = function(frameID, callback) { - // remove leading slash, if it's there - if (frameID[0] === '/') - { - frameID = frameID.substring(1); - } - // if there is no callback registered for the given frame, create empty callback list - if (!this.frameInfos[frameID]) { - this.frameInfos[frameID] = { - cbs: [] + /** + * Process the incoming TF message and send them out using the callback + * functions. + * + * @param {Object} tf - The TF message from the server. + * @param {Array} tf.transforms - The list of transforms. + */ + TFClient.prototype.processTFArray = function (tf) { + var that = this; + tf.transforms.forEach(function (transform) { + var frameID = transform.child_frame_id; + if (frameID[0] === '/') { + frameID = frameID.substring(1); + } + var info = that.frameInfos[frameID]; + if (info) { + info.transform = new Transform({ + translation: transform.transform.translation, + rotation: transform.transform.rotation, + }); + info.cbs.forEach(function (cb) { + cb(info.transform); + }); + } + }, this); }; - if (!this.republisherUpdateRequested) { - setTimeout(this.updateGoal.bind(this), this.updateDelay); - this.republisherUpdateRequested = true; - } - } - // if we already have a transform, callback immediately - else if (this.frameInfos[frameID].transform) { - callback(this.frameInfos[frameID].transform); - } - this.frameInfos[frameID].cbs.push(callback); -}; - -/** - * Unsubscribe from the given TF frame. - * - * @param {string} frameID - The TF frame to unsubscribe from. - * @param {function} callback - The callback function to remove. - */ -TFClient.prototype.unsubscribe = function(frameID, callback) { - // remove leading slash, if it's there - if (frameID[0] === '/') - { - frameID = frameID.substring(1); - } - var info = this.frameInfos[frameID]; - for (var cbs = info && info.cbs || [], idx = cbs.length; idx--;) { - if (cbs[idx] === callback) { - cbs.splice(idx, 1); - } - } - if (!callback || cbs.length === 0) { - delete this.frameInfos[frameID]; - } -}; - -/** - * Unsubscribe and unadvertise all topics associated with this TFClient. - */ -TFClient.prototype.dispose = function() { - this._isDisposed = true; - this.actionClient.dispose(); - if (this.currentTopic) { - this.currentTopic.unsubscribe(this._subscribeCB); - } -}; - + /** + * Create and send a new goal (or service request) to the tf2_web_republisher + * based on the current list of TFs. + */ + TFClient.prototype.updateGoal = function () { + var goalMessage = { + source_frames: Object.keys(this.frameInfos), + target_frame: this.fixedFrame, + angular_thres: this.angularThres, + trans_thres: this.transThres, + rate: this.rate, + }; + // if we're running in groovy compatibility mode (the default) + // then use the action interface to tf2_web_republisher + if (this.ros.groovyCompatibility) { + if (this.currentGoal) { + this.currentGoal.cancel(); + } + this.currentGoal = new Goal({ + actionClient: this.actionClient, + goalMessage: goalMessage, + }); + this.currentGoal.on('feedback', this.processTFArray.bind(this)); + this.currentGoal.send(); + } + else { + // otherwise, use the service interface + // The service interface has the same parameters as the action, + // plus the timeout + goalMessage.timeout = this.topicTimeout; + var request = new ServiceRequest(goalMessage); + this.serviceClient.callService(request, this.processResponse.bind(this)); + } + this.republisherUpdateRequested = false; + }; + /** + * Process the service response and subscribe to the tf republisher + * topic. + * + * @param {Object} response - The service response containing the topic name. + */ + TFClient.prototype.processResponse = function (response) { + // Do not setup a topic subscription if already disposed. Prevents a race condition where + // The dispose() function is called before the service call receives a response. + if (this._isDisposed) { + return; + } + // if we subscribed to a topic before, unsubscribe so + // the republisher stops publishing it + if (this.currentTopic && this._subscribeCB) { + this.currentTopic.unsubscribe(this._subscribeCB); + } + this.currentTopic = new Topic({ + ros: this.ros, + name: response.topic_name, + messageType: 'tf2_web_republisher/TFArray', + }); + this._subscribeCB = this.processTFArray.bind(this); + this.currentTopic.subscribe(this._subscribeCB); + }; + /** + * @callback subscribeCallback + * @param {Transform} callback.transform - The transform data. + */ + /** + * Subscribe to the given TF frame. + * + * @param {string} frameID - The TF frame to subscribe to. + * @param {subscribeCallback} callback - Function with the following params: + */ + TFClient.prototype.subscribe = function (frameID, callback) { + // remove leading slash, if it's there + if (frameID[0] === '/') { + frameID = frameID.substring(1); + } + // if there is no callback registered for the given frame, create empty callback list + if (!this.frameInfos[frameID]) { + this.frameInfos[frameID] = { + cbs: [], + }; + if (!this.republisherUpdateRequested) { + setTimeout(this.updateGoal.bind(this), this.updateDelay); + this.republisherUpdateRequested = true; + } + } + // if we already have a transform, callback immediately + else if (this.frameInfos[frameID].transform) { + callback(this.frameInfos[frameID].transform); + } + this.frameInfos[frameID].cbs.push(callback); + }; + /** + * Unsubscribe from the given TF frame. + * + * @param {string} frameID - The TF frame to unsubscribe from. + * @param {function} callback - The callback function to remove. + */ + TFClient.prototype.unsubscribe = function (frameID, callback) { + // remove leading slash, if it's there + if (frameID[0] === '/') { + frameID = frameID.substring(1); + } + var info = this.frameInfos[frameID]; + for (var cbs = (info && info.cbs) || [], idx = cbs.length; idx--;) { + if (cbs[idx] === callback) { + cbs.splice(idx, 1); + } + } + if (!callback || cbs.length === 0) { + delete this.frameInfos[frameID]; + } + }; + /** + * Unsubscribe and unadvertise all topics associated with this TFClient. + */ + TFClient.prototype.dispose = function () { + this._isDisposed = true; + this.actionClient.dispose(); + if (this.currentTopic && this._subscribeCB) { + this.currentTopic.unsubscribe(this._subscribeCB); + } + }; + return TFClient; +}(EventEmitter2)); module.exports = TFClient; -},{"../actionlib/ActionClient":10,"../actionlib/Goal":12,"../core/Service.js":18,"../core/ServiceRequest.js":19,"../core/Topic.js":22,"../math/Transform":26}],31:[function(require,module,exports){ +},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],95:[function(require,module,exports){ +"use strict"; var Ros = require('../core/Ros'); var mixin = require('../mixin'); - var tf = module.exports = { TFClient: require('./TFClient') }; - mixin(Ros, ['TFClient'], tf); -},{"../core/Ros":17,"../mixin":29,"./TFClient":30}],32:[function(require,module,exports){ + +},{"../core/Ros":81,"../mixin":93,"./TFClient":94}],96:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - var Vector3 = require('../math/Vector3'); var UrdfTypes = require('./UrdfTypes'); - /** * A Box element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ -function UrdfBox(options) { - this.dimension = null; - this.type = UrdfTypes.URDF_BOX; - - // Parse the xml string - var xyz = options.xml.getAttribute('size').split(' '); - this.dimension = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); -} - +var UrdfBox = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfBox(options) { + this.dimension = null; + this.type = UrdfTypes.URDF_BOX; + // Parse the xml string + var size = options.xml.getAttribute('size'); + if (size) { + var xyz = size.split(' '); + this.dimension = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } + } + return UrdfBox; +}()); module.exports = UrdfBox; -},{"../math/Vector3":27,"./UrdfTypes":41}],33:[function(require,module,exports){ +},{"../math/Vector3":91,"./UrdfTypes":105}],97:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - /** * A Color element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ -function UrdfColor(options) { - // Parse the xml string - var rgba = options.xml.getAttribute('rgba').split(' '); - this.r = parseFloat(rgba[0]); - this.g = parseFloat(rgba[1]); - this.b = parseFloat(rgba[2]); - this.a = parseFloat(rgba[3]); -} - +var UrdfColor = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfColor(options) { + // Parse the xml string + var rgbaValue = options.xml.getAttribute('rgba'); + if (rgbaValue) { + var rgba = rgbaValue.split(' '); + this.r = parseFloat(rgba[0]); + this.g = parseFloat(rgba[1]); + this.b = parseFloat(rgba[2]); + this.a = parseFloat(rgba[3]); + } + } + return UrdfColor; +}()); module.exports = UrdfColor; -},{}],34:[function(require,module,exports){ +},{}],98:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - var UrdfTypes = require('./UrdfTypes'); - /** * A Cylinder element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ -function UrdfCylinder(options) { - this.type = UrdfTypes.URDF_CYLINDER; - this.length = parseFloat(options.xml.getAttribute('length')); - this.radius = parseFloat(options.xml.getAttribute('radius')); -} - -module.exports = UrdfCylinder; - -},{"./UrdfTypes":41}],35:[function(require,module,exports){ -/** - * @fileOverview - * @author David V. Lu!! - davidvlu@gmail.com - */ - -var Pose = require('../math/Pose'); -var Vector3 = require('../math/Vector3'); -var Quaternion = require('../math/Quaternion'); - -/** - * A Joint element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. - */ -function UrdfJoint(options) { - this.name = options.xml.getAttribute('name'); - this.type = options.xml.getAttribute('type'); - - var parents = options.xml.getElementsByTagName('parent'); - if(parents.length > 0) { - this.parent = parents[0].getAttribute('link'); - } - - var children = options.xml.getElementsByTagName('child'); - if(children.length > 0) { - this.child = children[0].getAttribute('link'); - } - - var limits = options.xml.getElementsByTagName('limit'); - if (limits.length > 0) { - this.minval = parseFloat( limits[0].getAttribute('lower') ); - this.maxval = parseFloat( limits[0].getAttribute('upper') ); - } - - // Origin - var origins = options.xml.getElementsByTagName('origin'); - if (origins.length === 0) { - // use the identity as the default - this.origin = new Pose(); - } else { - // Check the XYZ - var xyz = origins[0].getAttribute('xyz'); - var position = new Vector3(); - if (xyz) { - xyz = xyz.split(' '); - position = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); - } - - // Check the RPY - var rpy = origins[0].getAttribute('rpy'); - var orientation = new Quaternion(); - if (rpy) { - rpy = rpy.split(' '); - // Convert from RPY - var roll = parseFloat(rpy[0]); - var pitch = parseFloat(rpy[1]); - var yaw = parseFloat(rpy[2]); - var phi = roll / 2.0; - var the = pitch / 2.0; - var psi = yaw / 2.0; - var x = Math.sin(phi) * Math.cos(the) * Math.cos(psi) - Math.cos(phi) * Math.sin(the) - * Math.sin(psi); - var y = Math.cos(phi) * Math.sin(the) * Math.cos(psi) + Math.sin(phi) * Math.cos(the) - * Math.sin(psi); - var z = Math.cos(phi) * Math.cos(the) * Math.sin(psi) - Math.sin(phi) * Math.sin(the) - * Math.cos(psi); - var w = Math.cos(phi) * Math.cos(the) * Math.cos(psi) + Math.sin(phi) * Math.sin(the) - * Math.sin(psi); - - orientation = new Quaternion({ - x : x, - y : y, - z : z, - w : w - }); - orientation.normalize(); +var UrdfCylinder = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfCylinder(options) { + this.type = UrdfTypes.URDF_CYLINDER; + this.length = parseFloat(options.xml.getAttribute('length') || 'NaN'); + this.radius = parseFloat(options.xml.getAttribute('radius') || 'NaN'); } - this.origin = new Pose({ - position : position, - orientation : orientation - }); - } -} + return UrdfCylinder; +}()); +module.exports = UrdfCylinder; +},{"./UrdfTypes":105}],99:[function(require,module,exports){ +"use strict"; +/** + * @fileOverview + * @author David V. Lu!! - davidvlu@gmail.com + */ +var Pose = require('../math/Pose'); +var Vector3 = require('../math/Vector3'); +var Quaternion = require('../math/Quaternion'); +/** + * A Joint element in a URDF. + */ +var UrdfJoint = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfJoint(options) { + this.name = options.xml.getAttribute('name'); + this.type = options.xml.getAttribute('type'); + var parents = options.xml.getElementsByTagName('parent'); + if (parents.length > 0) { + this.parent = parents[0].getAttribute('link'); + } + var children = options.xml.getElementsByTagName('child'); + if (children.length > 0) { + this.child = children[0].getAttribute('link'); + } + var limits = options.xml.getElementsByTagName('limit'); + if (limits.length > 0) { + this.minval = parseFloat(limits[0].getAttribute('lower') || 'NaN'); + this.maxval = parseFloat(limits[0].getAttribute('upper') || 'NaN'); + } + // Origin + var origins = options.xml.getElementsByTagName('origin'); + if (origins.length === 0) { + // use the identity as the default + this.origin = new Pose(); + } + else { + // Check the XYZ + var xyzValue = origins[0].getAttribute('xyz'); + var position = new Vector3(); + if (xyzValue) { + var xyz = xyzValue.split(' '); + position = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } + // Check the RPY + var rpyValue = origins[0].getAttribute('rpy'); + var orientation = new Quaternion(); + if (rpyValue) { + var rpy = rpyValue.split(' '); + // Convert from RPY + var roll = parseFloat(rpy[0]); + var pitch = parseFloat(rpy[1]); + var yaw = parseFloat(rpy[2]); + var phi = roll / 2.0; + var the = pitch / 2.0; + var psi = yaw / 2.0; + var x = Math.sin(phi) * Math.cos(the) * Math.cos(psi) - + Math.cos(phi) * Math.sin(the) * Math.sin(psi); + var y = Math.cos(phi) * Math.sin(the) * Math.cos(psi) + + Math.sin(phi) * Math.cos(the) * Math.sin(psi); + var z = Math.cos(phi) * Math.cos(the) * Math.sin(psi) - + Math.sin(phi) * Math.sin(the) * Math.cos(psi); + var w = Math.cos(phi) * Math.cos(the) * Math.cos(psi) + + Math.sin(phi) * Math.sin(the) * Math.sin(psi); + orientation = new Quaternion({ + x: x, + y: y, + z: z, + w: w, + }); + orientation.normalize(); + } + this.origin = new Pose({ + position: position, + orientation: orientation, + }); + } + } + return UrdfJoint; +}()); module.exports = UrdfJoint; -},{"../math/Pose":24,"../math/Quaternion":25,"../math/Vector3":27}],36:[function(require,module,exports){ +},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91}],100:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - var UrdfVisual = require('./UrdfVisual'); - /** * A Link element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ -function UrdfLink(options) { - this.name = options.xml.getAttribute('name'); - this.visuals = []; - var visuals = options.xml.getElementsByTagName('visual'); - - for( var i=0; i 0) { - this.textureFilename = textures[0].getAttribute('filename'); - } - - // Color - var colors = options.xml.getElementsByTagName('color'); - if (colors.length > 0) { - // Parse the RBGA string - this.color = new UrdfColor({ - xml : colors[0] - }); - } -} - -UrdfMaterial.prototype.isLink = function() { - return this.color === null && this.textureFilename === null; -}; - +var UrdfMaterial = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfMaterial(options) { + this.textureFilename = null; + this.color = null; + this.name = options.xml.getAttribute('name'); + // Texture + var textures = options.xml.getElementsByTagName('texture'); + if (textures.length > 0) { + this.textureFilename = textures[0].getAttribute('filename'); + } + // Color + var colors = options.xml.getElementsByTagName('color'); + if (colors.length > 0) { + // Parse the RBGA string + this.color = new UrdfColor({ + xml: colors[0], + }); + } + } + UrdfMaterial.prototype.isLink = function () { + return this.color === null && this.textureFilename === null; + }; + UrdfMaterial.prototype.assign = function (obj) { + return assign(this, obj); + }; + return UrdfMaterial; +}()); var assign = require('object-assign'); - -UrdfMaterial.prototype.assign = function(obj) { - return assign(this, obj); -}; - module.exports = UrdfMaterial; -},{"./UrdfColor":33,"object-assign":3}],38:[function(require,module,exports){ +},{"./UrdfColor":97,"object-assign":31}],102:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - var Vector3 = require('../math/Vector3'); var UrdfTypes = require('./UrdfTypes'); - /** * A Mesh element in a URDF. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. */ -function UrdfMesh(options) { - this.scale = null; - - this.type = UrdfTypes.URDF_MESH; - this.filename = options.xml.getAttribute('filename'); - - // Check for a scale - var scale = options.xml.getAttribute('scale'); - if (scale) { - // Get the XYZ - var xyz = scale.split(' '); - this.scale = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); - } -} - +var UrdfMesh = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfMesh(options) { + this.scale = null; + this.type = UrdfTypes.URDF_MESH; + this.filename = options.xml.getAttribute('filename'); + // Check for a scale + var scale = options.xml.getAttribute('scale'); + if (scale) { + // Get the XYZ + var xyz = scale.split(' '); + this.scale = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } + } + return UrdfMesh; +}()); module.exports = UrdfMesh; -},{"../math/Vector3":27,"./UrdfTypes":41}],39:[function(require,module,exports){ +},{"../math/Vector3":91,"./UrdfTypes":105}],103:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com * @author Russell Toris - rctoris@wpi.edu */ - var UrdfMaterial = require('./UrdfMaterial'); var UrdfLink = require('./UrdfLink'); var UrdfJoint = require('./UrdfJoint'); var DOMParser = require('@xmldom/xmldom').DOMParser; - // See https://developer.mozilla.org/docs/XPathResult#Constants var XPATH_FIRST_ORDERED_NODE_TYPE = 9; - /** * A URDF Model can be used to parse a given URDF into the appropriate elements. - * - * @constructor - * @param {Object} options - * @param {Element} options.xml - The XML element to parse. - * @param {string} options.string - The XML element to parse as a string. */ -function UrdfModel(options) { - options = options || {}; - var xmlDoc = options.xml; - var string = options.string; - this.materials = {}; - this.links = {}; - this.joints = {}; - - // Check if we are using a string or an XML element - if (string) { - // Parse the string - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(string, 'text/xml'); - } - - // Initialize the model with the given XML node. - // Get the robot tag - var robotXml = xmlDoc.documentElement; - - // Get the robot name - this.name = robotXml.getAttribute('name'); - - // Parse all the visual elements we need - for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (node.tagName === 'material') { - var material = new UrdfMaterial({ - xml : node - }); - // Make sure this is unique - if (this.materials[material.name] !== void 0) { - if( this.materials[material.name].isLink() ) { - this.materials[material.name].assign( material ); - } else { - console.warn('Material ' + material.name + 'is not unique.'); +var UrdfModel = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + * @param {string} options.string - The XML element to parse as a string. + */ + function UrdfModel(options) { + var xmlDoc = options.xml; + var string = options.string; + this.materials = {}; + this.links = {}; + this.joints = {}; + // Check if we are using a string or an XML element + if (string) { + // Parse the string + var parser = new DOMParser(); + xmlDoc = parser.parseFromString(string, "text/xml").documentElement; } - } else { - this.materials[material.name] = material; - } - } else if (node.tagName === 'link') { - var link = new UrdfLink({ - xml : node - }); - // Make sure this is unique - if (this.links[link.name] !== void 0) { - console.warn('Link ' + link.name + ' is not unique.'); - } else { - // Check for a material - for( var j=0; j 0) { - var geom = geoms[0]; - var shape = null; - // Check for the shape - for (var i = 0; i < geom.childNodes.length; i++) { - var node = geom.childNodes[i]; - if (node.nodeType === 1) { - shape = node; - break; - } - } - // Check the type - var type = shape.nodeName; - if (type === 'sphere') { - this.geometry = new UrdfSphere({ - xml : shape - }); - } else if (type === 'box') { - this.geometry = new UrdfBox({ - xml : shape - }); - } else if (type === 'cylinder') { - this.geometry = new UrdfCylinder({ - xml : shape - }); - } else if (type === 'mesh') { - this.geometry = new UrdfMesh({ - xml : shape - }); - } else { - console.warn('Unknown geometry type ' + type); +var UrdfVisual = /** @class */ (function () { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + function UrdfVisual(options) { + var xml = options.xml; + this.origin = null; + this.geometry = null; + this.material = null; + this.name = options.xml.getAttribute('name'); + // Origin + var origins = xml.getElementsByTagName('origin'); + if (origins.length === 0) { + // use the identity as the default + this.origin = new Pose(); + } + else { + // Check the XYZ + var xyzValue = origins[0].getAttribute('xyz'); + var position = new Vector3(); + if (xyzValue) { + var xyz = xyzValue.split(' '); + position = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]), + }); + } + // Check the RPY + var rpyValue = origins[0].getAttribute('rpy'); + var orientation = new Quaternion(); + if (rpyValue) { + var rpy = rpyValue.split(' '); + // Convert from RPY + var roll = parseFloat(rpy[0]); + var pitch = parseFloat(rpy[1]); + var yaw = parseFloat(rpy[2]); + var phi = roll / 2.0; + var the = pitch / 2.0; + var psi = yaw / 2.0; + var x = Math.sin(phi) * Math.cos(the) * Math.cos(psi) - + Math.cos(phi) * Math.sin(the) * Math.sin(psi); + var y = Math.cos(phi) * Math.sin(the) * Math.cos(psi) + + Math.sin(phi) * Math.cos(the) * Math.sin(psi); + var z = Math.cos(phi) * Math.cos(the) * Math.sin(psi) - + Math.sin(phi) * Math.sin(the) * Math.cos(psi); + var w = Math.cos(phi) * Math.cos(the) * Math.cos(psi) + + Math.sin(phi) * Math.sin(the) * Math.sin(psi); + orientation = new Quaternion({ + x: x, + y: y, + z: z, + w: w, + }); + orientation.normalize(); + } + this.origin = new Pose({ + position: position, + orientation: orientation, + }); + } + // Geometry + var geoms = xml.getElementsByTagName('geometry'); + if (geoms.length > 0) { + var geom = geoms[0]; + var shape = null; + // Check for the shape + for (var i = 0; i < geom.childNodes.length; i++) { + /** @type {Element} */ + // @ts-expect-error -- unknown why this doesn't work properly. + var node = geom.childNodes[i]; + if (node.nodeType === 1) { + shape = node; + break; + } + } + if (shape) { + // Check the type + var type = shape.nodeName; + if (type === 'sphere') { + this.geometry = new UrdfSphere({ + xml: shape, + }); + } + else if (type === 'box') { + this.geometry = new UrdfBox({ + xml: shape, + }); + } + else if (type === 'cylinder') { + this.geometry = new UrdfCylinder({ + xml: shape, + }); + } + else if (type === 'mesh') { + this.geometry = new UrdfMesh({ + xml: shape, + }); + } + else { + console.warn('Unknown geometry type ' + type); + } + } + } + // Material + var materials = xml.getElementsByTagName('material'); + if (materials.length > 0) { + this.material = new UrdfMaterial({ + xml: materials[0], + }); + } } - } - - // Material - var materials = xml.getElementsByTagName('material'); - if (materials.length > 0) { - this.material = new UrdfMaterial({ - xml : materials[0] - }); - } -} - + return UrdfVisual; +}()); module.exports = UrdfVisual; -},{"../math/Pose":24,"../math/Quaternion":25,"../math/Vector3":27,"./UrdfBox":32,"./UrdfCylinder":34,"./UrdfMaterial":37,"./UrdfMesh":38,"./UrdfSphere":40}],43:[function(require,module,exports){ +},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":96,"./UrdfCylinder":98,"./UrdfMaterial":101,"./UrdfMesh":102,"./UrdfSphere":104}],107:[function(require,module,exports){ +"use strict"; module.exports = require('object-assign')({ UrdfBox: require('./UrdfBox'), UrdfColor: require('./UrdfColor'), @@ -5748,82 +22520,68 @@ module.exports = require('object-assign')({ UrdfVisual: require('./UrdfVisual') }, require('./UrdfTypes')); -},{"./UrdfBox":32,"./UrdfColor":33,"./UrdfCylinder":34,"./UrdfLink":36,"./UrdfMaterial":37,"./UrdfMesh":38,"./UrdfModel":39,"./UrdfSphere":40,"./UrdfTypes":41,"./UrdfVisual":42,"object-assign":3}],44:[function(require,module,exports){ +},{"./UrdfBox":96,"./UrdfColor":97,"./UrdfCylinder":98,"./UrdfLink":100,"./UrdfMaterial":101,"./UrdfMesh":102,"./UrdfModel":103,"./UrdfSphere":104,"./UrdfTypes":105,"./UrdfVisual":106,"object-assign":31}],108:[function(require,module,exports){ 'use strict'; - var UPPER32 = Math.pow(2, 32); - var warnedPrecision = false; function warnPrecision() { - if (!warnedPrecision) { - warnedPrecision = true; - console.warn('CBOR 64-bit integer array values may lose precision. No further warnings.'); - } + if (!warnedPrecision) { + warnedPrecision = true; + console.warn('CBOR 64-bit integer array values may lose precision. No further warnings.'); + } } - /** * Unpack 64-bit unsigned integer from byte array. * @param {Uint8Array} bytes */ function decodeUint64LE(bytes) { - warnPrecision(); - - var byteLen = bytes.byteLength; - var offset = bytes.byteOffset; - var arrLen = byteLen / 8; - - var buffer = bytes.buffer.slice(offset, offset + byteLen); - var uint32View = new Uint32Array(buffer); - - var arr = new Array(arrLen); - for (var i = 0; i < arrLen; i++) { - var si = i * 2; - var lo = uint32View[si]; - var hi = uint32View[si+1]; - arr[i] = lo + UPPER32 * hi; - } - - return arr; + warnPrecision(); + var byteLen = bytes.byteLength; + var offset = bytes.byteOffset; + var arrLen = byteLen / 8; + var buffer = bytes.buffer.slice(offset, offset + byteLen); + var uint32View = new Uint32Array(buffer); + var arr = new Array(arrLen); + for (var i = 0; i < arrLen; i++) { + var si = i * 2; + var lo = uint32View[si]; + var hi = uint32View[si + 1]; + arr[i] = lo + UPPER32 * hi; + } + return arr; } - /** * Unpack 64-bit signed integer from byte array. * @param {Uint8Array} bytes */ function decodeInt64LE(bytes) { - warnPrecision(); - - var byteLen = bytes.byteLength; - var offset = bytes.byteOffset; - var arrLen = byteLen / 8; - - var buffer = bytes.buffer.slice(offset, offset + byteLen); - var uint32View = new Uint32Array(buffer); - var int32View = new Int32Array(buffer); - - var arr = new Array(arrLen); - for (var i = 0; i < arrLen; i++) { - var si = i * 2; - var lo = uint32View[si]; - var hi = int32View[si+1]; - arr[i] = lo + UPPER32 * hi; - } - - return arr; + warnPrecision(); + var byteLen = bytes.byteLength; + var offset = bytes.byteOffset; + var arrLen = byteLen / 8; + var buffer = bytes.buffer.slice(offset, offset + byteLen); + var uint32View = new Uint32Array(buffer); + var int32View = new Int32Array(buffer); + var arr = new Array(arrLen); + for (var i = 0; i < arrLen; i++) { + var si = i * 2; + var lo = uint32View[si]; + var hi = int32View[si + 1]; + arr[i] = lo + UPPER32 * hi; + } + return arr; } - /** * Unpack typed array from byte array. * @param {Uint8Array} bytes - * @param {type} ArrayType - Desired output array type + * @param {ArrayConstructor} ArrayType - Desired output array type */ function decodeNativeArray(bytes, ArrayType) { - var byteLen = bytes.byteLength; - var offset = bytes.byteOffset; - var buffer = bytes.buffer.slice(offset, offset + byteLen); - return new ArrayType(buffer); + var byteLen = bytes.byteLength; + var offset = bytes.byteOffset; + var buffer = bytes.buffer.slice(offset, offset + byteLen); + return new ArrayType(buffer); } - /** * Supports a subset of draft CBOR typed array tags: * @@ -5831,214 +22589,181 @@ function decodeNativeArray(bytes, ArrayType) { * Only supports little-endian tags for now. */ var nativeArrayTypes = { - 64: Uint8Array, - 69: Uint16Array, - 70: Uint32Array, - 72: Int8Array, - 77: Int16Array, - 78: Int32Array, - 85: Float32Array, - 86: Float64Array + 64: Uint8Array, + 69: Uint16Array, + 70: Uint32Array, + 72: Int8Array, + 77: Int16Array, + 78: Int32Array, + 85: Float32Array, + 86: Float64Array }; - /** * We can also decode 64-bit integer arrays, since ROS has these types. */ var conversionArrayTypes = { - 71: decodeUint64LE, - 79: decodeInt64LE + 71: decodeUint64LE, + 79: decodeInt64LE }; - /** * Handle CBOR typed array tags during decoding. * @param {Uint8Array} data * @param {Number} tag */ function cborTypedArrayTagger(data, tag) { - if (tag in nativeArrayTypes) { - var arrayType = nativeArrayTypes[tag]; - return decodeNativeArray(data, arrayType); - } - if (tag in conversionArrayTypes) { - return conversionArrayTypes[tag](data); - } - return data; + if (tag in nativeArrayTypes) { + var arrayType = nativeArrayTypes[tag]; + return decodeNativeArray(data, arrayType); + } + if (tag in conversionArrayTypes) { + return conversionArrayTypes[tag](data); + } + return data; } - if (typeof module !== 'undefined' && module.exports) { - module.exports = cborTypedArrayTagger; + module.exports = cborTypedArrayTagger; } -},{}],45:[function(require,module,exports){ -exports.DOMImplementation = window.DOMImplementation; -exports.XMLSerializer = window.XMLSerializer; -exports.DOMParser = window.DOMParser; - -},{}],46:[function(require,module,exports){ -module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; - -},{}],47:[function(require,module,exports){ -/* global document */ -module.exports = function Canvas() { - return document.createElement('canvas'); -}; -},{}],48:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ +(function (Buffer){(function (){ /** * @fileOverview - * @author Graeme Yeates - github.com/megawac + * @author Ramon Wijnands - rayman747@hotmail.com */ - 'use strict'; - -var Canvas = require('canvas'); -var Image = Canvas.Image || window.Image; - +var pngparse = require('pngparse'); +/** + * @callback decompressPngCallback + * @param data - The uncompressed data. + */ /** * If a message was compressed as a PNG image (a compression hack since - * gzipping over WebSockets * is not supported yet), this function places the - * "image" in a canvas element then decodes the * "image" as a Base64 string. + * gzipping over WebSockets * is not supported yet), this function decodes + * the "image" as a Base64 string. * * @private * @param data - An object containing the PNG data. - * @param callback - Function with the following params: - * @param callback.data - The uncompressed data. + * @param {decompressPngCallback} callback - Function with the following params: */ function decompressPng(data, callback) { - // Uncompresses the data before sending it through (use image/canvas to do so). - var image = new Image(); - // When the image loads, extracts the raw data (JSON message). - image.onload = function() { - // Creates a local canvas to draw on. - var canvas = new Canvas(); - var context = canvas.getContext('2d'); - - // Sets width and height. - canvas.width = image.width; - canvas.height = image.height; - - // Prevents anti-aliasing and loosing data - context.imageSmoothingEnabled = false; - context.webkitImageSmoothingEnabled = false; - context.mozImageSmoothingEnabled = false; - - // Puts the data into the image. - context.drawImage(image, 0, 0); - // Grabs the raw, uncompressed data. - var imageData = context.getImageData(0, 0, image.width, image.height).data; - - // Constructs the JSON. - var jsonData = ''; - for (var i = 0; i < imageData.length; i += 4) { - // RGB - jsonData += String.fromCharCode(imageData[i], imageData[i + 1], imageData[i + 2]); - } - callback(JSON.parse(jsonData)); - }; - // Sends the image data to load. - image.src = 'data:image/png;base64,' + data; + var buffer = new Buffer(data, 'base64'); + pngparse.parse(buffer, function (err, data) { + if (err) { + console.warn('Cannot process PNG encoded message '); + } + else { + var jsonData = data.data.toString(); + callback(JSON.parse(jsonData)); + } + }); } - module.exports = decompressPng; -},{"canvas":47}],49:[function(require,module,exports){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":11,"pngparse":43}],110:[function(require,module,exports){ +"use strict"; try { + // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now var work = require('webworkify'); -} catch(ReferenceError) { +} +catch (ReferenceError) { + // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now // webworkify raises ReferenceError when required inside webpack var work = require('webworkify-webpack'); } var workerSocketImpl = require('./workerSocketImpl'); - -function WorkerSocket(uri) { - this.socket_ = work(workerSocketImpl); - - this.socket_.addEventListener('message', this.handleWorkerMessage_.bind(this)); - - this.socket_.postMessage({ - uri: uri, - }); -} - -WorkerSocket.prototype.handleWorkerMessage_ = function(ev) { - var data = ev.data; - if (data instanceof ArrayBuffer || typeof data === 'string') { - // binary or JSON message from rosbridge - this.onmessage(ev); - } else { - // control message from the wrapped WebSocket - var type = data.type; - if (type === 'close') { - this.onclose(null); - } else if (type === 'open') { - this.onopen(null); - } else if (type === 'error') { - this.onerror(null); - } else { - throw 'Unknown message from workersocket'; +var WorkerSocket = /** @class */ (function () { + function WorkerSocket(uri) { + this.onmessage = undefined; + this.onclose = undefined; + this.onopen = undefined; + this.onerror = undefined; + this.socket_ = work(workerSocketImpl); + this.socket_.addEventListener('message', this.handleWorkerMessage_.bind(this)); + this.socket_.postMessage({ + uri: uri, + }); } - } -}; - -WorkerSocket.prototype.send = function(data) { - this.socket_.postMessage(data); -}; - -WorkerSocket.prototype.close = function() { - this.socket_.postMessage({ - close: true - }); -}; - + WorkerSocket.prototype.handleWorkerMessage_ = function (ev) { + var data = ev.data; + if (data instanceof ArrayBuffer || typeof data === 'string') { + // binary or JSON message from rosbridge + this.onmessage(ev); + } + else { + // control message from the wrapped WebSocket + var type = data.type; + if (type === 'close') { + this.onclose(null); + } + else if (type === 'open') { + this.onopen(null); + } + else if (type === 'error') { + this.onerror(null); + } + else { + throw 'Unknown message from workersocket'; + } + } + }; + WorkerSocket.prototype.send = function (data) { + this.socket_.postMessage(data); + }; + WorkerSocket.prototype.close = function () { + this.socket_.postMessage({ + close: true, + }); + }; + return WorkerSocket; +}()); module.exports = WorkerSocket; -},{"./workerSocketImpl":50,"webworkify":7,"webworkify-webpack":6}],50:[function(require,module,exports){ +},{"./workerSocketImpl":111,"webworkify":68,"webworkify-webpack":67}],111:[function(require,module,exports){ +"use strict"; var WebSocket = WebSocket || require('ws'); - -module.exports = function(self) { - var socket = null; - - function handleSocketMessage(ev) { - var data = ev.data; - - if (data instanceof ArrayBuffer) { - // binary message, transfer for speed - self.postMessage(data, [data]); - } else { - // JSON message, copy string - self.postMessage(data); +module.exports = function (self) { + var socket = null; + function handleSocketMessage(ev) { + var data = ev.data; + if (data instanceof ArrayBuffer) { + // binary message, transfer for speed + self.postMessage(data, [data]); + } + else { + // JSON message, copy string + self.postMessage(data); + } } - } - - function handleSocketControl(ev) { - self.postMessage({type: ev.type}); - } - - self.addEventListener('message', function(ev) { - var data = ev.data; - - if (typeof data === 'string') { - // JSON message from ROSLIB - socket.send(data); - } else { - // control message - if (data.hasOwnProperty('close')) { - socket.close(); - socket = null; - } else if (data.hasOwnProperty('uri')) { - var uri = data.uri; - - socket = new WebSocket(uri); - socket.binaryType = 'arraybuffer'; - - socket.onmessage = handleSocketMessage; - socket.onclose = handleSocketControl; - socket.onopen = handleSocketControl; - socket.onerror = handleSocketControl; - } else { - throw 'Unknown message to WorkerSocket'; - } + function handleSocketControl(ev) { + self.postMessage({ type: ev.type }); } - }); + self.addEventListener('message', function (ev) { + var data = ev.data; + if (typeof data === 'string') { + // JSON message from ROSLIB + socket.send(data); + } + else { + // control message + if (data.hasOwnProperty('close')) { + socket.close(); + socket = null; + } + else if (data.hasOwnProperty('uri')) { + var uri = data.uri; + socket = new WebSocket(uri); + socket.binaryType = 'arraybuffer'; + socket.onmessage = handleSocketMessage; + socket.onclose = handleSocketControl; + socket.onopen = handleSocketControl; + socket.onerror = handleSocketControl; + } + else { + throw 'Unknown message to WorkerSocket'; + } + } + }); }; -},{"ws":46}]},{},[9]); +},{"ws":71}]},{},[73]); diff --git a/build/roslib.min.js b/build/roslib.min.js index cdb33e83a..798509034 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(r,s,o){function a(t,e){if(!s[t]){if(!r[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}i=s[t]={exports:{}},r[t][0].call(i.exports,function(e){return a(r[t][1][e]||e)},i,i.exports,n,r,s,o)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;e>2),s=0;s>6):(s<55296?n.push(224|s>>12):(s=65536+((s=(1023&s)<<10)|1023&t.charCodeAt(++r)),n.push(240|s>>18),n.push(128|s>>12&63)),n.push(128|s>>6&63)),n.push(128|63&s))}return m(3,n.length),p(n);default:if(Array.isArray(t))for(m(4,o=t.length),r=0;r>5!==e)throw"Invalid indefinite length element";return i}function M(e,t){for(var i=0;i>10),e.push(56320|1023&n))}}"function"!=typeof d&&(d=function(e){return e}),"function"!=typeof y&&(y=function(){return A});var e=function e(){var t,i,n=x(),r=n>>5,n=31&n;if(7==r)switch(n){case 25:var s=new ArrayBuffer(4),s=new DataView(s),o=T(),a=31744&o,c=1023&o;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=c)return c*U;return s.setUint32(0,(32768&o)<<16|a<<13|c<<13),s.getFloat32(0);case 26:return w(g.getFloat32(b),4);case 27:return w(g.getFloat64(b),8)}if((t=L(n))<0&&(r<2||6this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,c))):l._listeners=t,!0;return!0}.call(this,e,t,i):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),i?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=t,r},r.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var i=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;o=this._events[e],i.push({_listeners:o})}for(var r=0;rt.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){x(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function x(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function A(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){x(this,e),T.nextTick(A,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw x(this),new RangeError(b);var r=y.concat(h,p);return x(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=x(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,S=2,k=3,x=4;function A(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return A(e,-5);if(666===n.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==x||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(x=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(x=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(x=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(A+1),o=0,s=1;s<=A;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=A;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,S,k,l,x,A,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,x=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,A=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=x[3*w[0]];break;case 2:m[L++]=x[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function x(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(A,e))}function A(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + }, + "peerDependencies": { + "grunt": ">=1" + } + }, + "node_modules/grunt-shell/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/grunt/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -5001,6 +5038,27 @@ "node": ">=0.10.0" } }, + "node_modules/npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "dev": true, + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -9342,9 +9400,9 @@ "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, "gaze": { @@ -9812,6 +9870,29 @@ } } }, + "grunt-shell": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-4.0.0.tgz", + "integrity": "sha512-dHFy8VZDfWGYLTeNvIHze4PKXGvIlDWuN0UE7hUZstTQeiEyv1VmW1MaDYQ3X5tE3bCi3bEia1gGKH8z/f1czQ==", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "npm-run-path": "^2.0.0", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } + } + }, "gzip-size": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz", @@ -11241,6 +11322,23 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "dev": true, + "requires": { + "path-key": "^2.0.0" + }, + "dependencies": { + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true + } + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", diff --git a/package.json b/package.json index b5b000844..f9ddfa22b 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "grunt-jsdoc": "^2.1.0", "grunt-karma": "^4.0.0", "grunt-mocha-test": "^0.13.0", + "grunt-shell": "^4.0.0", "karma": "^6.3.0", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.1", From 3d5b9a10f3827a5ab4b9bb2fe801885e3d645069 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 15:04:52 -0700 Subject: [PATCH 26/66] expect some possible null current implementations --- src/core/Service.js | 1 + src/urdf/UrdfBox.js | 1 + src/urdf/UrdfColor.js | 1 + src/urdf/UrdfCylinder.js | 2 ++ 4 files changed, 5 insertions(+) diff --git a/src/core/Service.js b/src/core/Service.js index 28915f8fc..bc1e8007e 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -112,6 +112,7 @@ class Service extends EventEmitter2 { } _serviceResponse(rosbridgeRequest) { var response = {}; + // @ts-expect-error -- possibly null var success = this._serviceCallback(rosbridgeRequest.args, response); var call = { diff --git a/src/urdf/UrdfBox.js b/src/urdf/UrdfBox.js index aba6efa08..1f71aa1c1 100644 --- a/src/urdf/UrdfBox.js +++ b/src/urdf/UrdfBox.js @@ -20,6 +20,7 @@ class UrdfBox { this.type = UrdfTypes.URDF_BOX; // Parse the xml string + // @ts-expect-error -- possibly null var xyz = options.xml.getAttribute('size').split(' '); this.dimension = new Vector3({ x: parseFloat(xyz[0]), diff --git a/src/urdf/UrdfColor.js b/src/urdf/UrdfColor.js index aec99f7f8..1232daaba 100644 --- a/src/urdf/UrdfColor.js +++ b/src/urdf/UrdfColor.js @@ -14,6 +14,7 @@ class UrdfColor { */ constructor(options) { // Parse the xml string + // @ts-expect-error -- possibly null var rgba = options.xml.getAttribute('rgba').split(' '); this.r = parseFloat(rgba[0]); this.g = parseFloat(rgba[1]); diff --git a/src/urdf/UrdfCylinder.js b/src/urdf/UrdfCylinder.js index 38b63a012..cd6f8e4fd 100644 --- a/src/urdf/UrdfCylinder.js +++ b/src/urdf/UrdfCylinder.js @@ -16,7 +16,9 @@ class UrdfCylinder { */ constructor(options) { this.type = UrdfTypes.URDF_CYLINDER; + // @ts-expect-error -- possibly null this.length = parseFloat(options.xml.getAttribute('length')); + // @ts-expect-error -- possibly null this.radius = parseFloat(options.xml.getAttribute('radius')); } } From 24a9d3a9a83f120bda899e3012c991df3b3dcfb4 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Fri, 17 Nov 2023 15:09:23 -0700 Subject: [PATCH 27/66] fix some class type errors --- build/roslib.js | 301 +++++++++++++++++++-------------------- build/roslib.min.js | 2 +- src/actionlib/Goal.js | 3 + src/core/Topic.js | 2 + src/tf/TFClient.js | 6 +- src/util/workerSocket.js | 4 + 6 files changed, 157 insertions(+), 161 deletions(-) diff --git a/build/roslib.js b/build/roslib.js index 21518b7ba..4a9bdfb07 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19400,27 +19400,27 @@ var ActionClient = /** @class */ (function (_super) { _this.feedbackListener = new Topic({ ros: _this.ros, name: _this.serverName + '/feedback', - messageType: _this.actionName + 'Feedback', + messageType: _this.actionName + 'Feedback' }); _this.statusListener = new Topic({ ros: _this.ros, name: _this.serverName + '/status', - messageType: 'actionlib_msgs/GoalStatusArray', + messageType: 'actionlib_msgs/GoalStatusArray' }); _this.resultListener = new Topic({ ros: _this.ros, name: _this.serverName + '/result', - messageType: _this.actionName + 'Result', + messageType: _this.actionName + 'Result' }); _this.goalTopic = new Topic({ ros: _this.ros, name: _this.serverName + '/goal', - messageType: _this.actionName + 'Goal', + messageType: _this.actionName + 'Goal' }); _this.cancelTopic = new Topic({ ros: _this.ros, name: _this.serverName + '/cancel', - messageType: 'actionlib_msgs/GoalID', + messageType: 'actionlib_msgs/GoalID' }); // advertise the goal and cancel topics _this.goalTopic.advertise(); @@ -19548,22 +19548,22 @@ var ActionListener = /** @class */ (function (_super) { var goalListener = new Topic({ ros: _this.ros, name: _this.serverName + '/goal', - messageType: _this.actionName + 'Goal', + messageType: _this.actionName + 'Goal' }); var feedbackListener = new Topic({ ros: _this.ros, name: _this.serverName + '/feedback', - messageType: _this.actionName + 'Feedback', + messageType: _this.actionName + 'Feedback' }); var statusListener = new Topic({ ros: _this.ros, name: _this.serverName + '/status', - messageType: 'actionlib_msgs/GoalStatusArray', + messageType: 'actionlib_msgs/GoalStatusArray' }); var resultListener = new Topic({ ros: _this.ros, name: _this.serverName + '/result', - messageType: _this.actionName + 'Result', + messageType: _this.actionName + 'Result' }); goalListener.subscribe(function (goalMessage) { that.emit('goal', goalMessage); @@ -19627,13 +19627,13 @@ var Goal = /** @class */ (function (_super) { */ function Goal(options) { var _this = _super.call(this) || this; - _this.feedback = undefined; - _this.status = undefined; - _this.result = undefined; var that = _this; _this.actionClient = options.actionClient; _this.goalMessage = options.goalMessage; _this.isFinished = false; + _this.status = undefined; + _this.result = undefined; + _this.feedback = undefined; // Used to create random IDs var date = new Date(); // Create a random ID @@ -19643,11 +19643,11 @@ var Goal = /** @class */ (function (_super) { goal_id: { stamp: { secs: 0, - nsecs: 0, + nsecs: 0 }, - id: _this.goalID, + id: _this.goalID }, - goal: _this.goalMessage, + goal: _this.goalMessage }); _this.on('status', function (status) { that.status = status; @@ -19684,7 +19684,7 @@ var Goal = /** @class */ (function (_super) { */ Goal.prototype.cancel = function () { var cancelMessage = new Message({ - id: this.goalID, + id: this.goalID }); this.actionClient.cancelTopic.publish(cancelMessage); }; @@ -19742,39 +19742,39 @@ var SimpleActionServer = /** @class */ (function (_super) { _this.feedbackPublisher = new Topic({ ros: _this.ros, name: _this.serverName + '/feedback', - messageType: _this.actionName + 'Feedback', + messageType: _this.actionName + 'Feedback' }); _this.feedbackPublisher.advertise(); var statusPublisher = new Topic({ ros: _this.ros, name: _this.serverName + '/status', - messageType: 'actionlib_msgs/GoalStatusArray', + messageType: 'actionlib_msgs/GoalStatusArray' }); statusPublisher.advertise(); _this.resultPublisher = new Topic({ ros: _this.ros, name: _this.serverName + '/result', - messageType: _this.actionName + 'Result', + messageType: _this.actionName + 'Result' }); _this.resultPublisher.advertise(); // create and subscribe to listeners var goalListener = new Topic({ ros: _this.ros, name: _this.serverName + '/goal', - messageType: _this.actionName + 'Goal', + messageType: _this.actionName + 'Goal' }); var cancelListener = new Topic({ ros: _this.ros, name: _this.serverName + '/cancel', - messageType: 'actionlib_msgs/GoalID', + messageType: 'actionlib_msgs/GoalID' }); // Track the goals and their status in order to publish status... _this.statusMessage = new Message({ header: { stamp: { secs: 0, nsecs: 100 }, - frame_id: '', + frame_id: '' }, - status_list: [], + status_list: [] }); // needed for handling preemption prompted by a new goal being received _this.currentGoal = null; // currently tracked goal @@ -19788,7 +19788,7 @@ var SimpleActionServer = /** @class */ (function (_super) { else { // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. that.statusMessage.status_list = [ - { goal_id: goalMessage.goal_id, status: 1 }, + { goal_id: goalMessage.goal_id, status: 1 } ]; that.currentGoal = goalMessage; that.emit('goal', goalMessage.goal); @@ -19865,7 +19865,7 @@ var SimpleActionServer = /** @class */ (function (_super) { SimpleActionServer.prototype.setSucceeded = function (result) { var resultMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 3 }, - result: result, + result: result }); this.resultPublisher.publish(resultMessage); // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. @@ -19887,7 +19887,7 @@ var SimpleActionServer = /** @class */ (function (_super) { SimpleActionServer.prototype.setAborted = function (result) { var resultMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 4 }, - result: result, + result: result }); this.resultPublisher.publish(resultMessage); // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. @@ -19909,7 +19909,7 @@ var SimpleActionServer = /** @class */ (function (_super) { SimpleActionServer.prototype.sendFeedback = function (feedback) { var feedbackMessage = new Message({ status: { goal_id: this.currentGoal.goal_id, status: 1 }, - feedback: feedback, + feedback: feedback }); this.feedbackPublisher.publish(feedbackMessage); }; @@ -19920,7 +19920,7 @@ var SimpleActionServer = /** @class */ (function (_super) { // @ts-expect-error -- we need to design a way to handle arbitrary fields in Message types. this.statusMessage.status_list = []; var resultMessage = new Message({ - status: { goal_id: this.currentGoal.goal_id, status: 2 }, + status: { goal_id: this.currentGoal.goal_id, status: 2 } }); this.resultPublisher.publish(resultMessage); if (this.nextGoal) { @@ -19940,12 +19940,12 @@ module.exports = SimpleActionServer; "use strict"; var Ros = require('../core/Ros'); var mixin = require('../mixin'); -var action = module.exports = { +var action = (module.exports = { ActionClient: require('./ActionClient'), ActionListener: require('./ActionListener'), Goal: require('./Goal'), SimpleActionServer: require('./SimpleActionServer') -}; +}); mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); },{"../core/Ros":81,"../mixin":93,"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ @@ -20000,11 +20000,11 @@ var Param = /** @class */ (function () { Param.prototype.get = function (callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/get_param", - serviceType: "rosapi/GetParam", + name: '/rosapi/get_param', + serviceType: 'rosapi/GetParam' }); var request = new ServiceRequest({ - name: this.name, + name: this.name }); paramClient.callService(request, function (result) { var value = JSON.parse(result.value); @@ -20028,12 +20028,12 @@ var Param = /** @class */ (function () { Param.prototype.set = function (value, callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/set_param", - serviceType: "rosapi/SetParam", + name: '/rosapi/set_param', + serviceType: 'rosapi/SetParam' }); var request = new ServiceRequest({ name: this.name, - value: JSON.stringify(value), + value: JSON.stringify(value) }); paramClient.callService(request, callback); }; @@ -20045,11 +20045,11 @@ var Param = /** @class */ (function () { Param.prototype.delete = function (callback) { var paramClient = new Service({ ros: this.ros, - name: "/rosapi/delete_param", - serviceType: "rosapi/DeleteParam", + name: '/rosapi/delete_param', + serviceType: 'rosapi/DeleteParam' }); var request = new ServiceRequest({ - name: this.name, + name: this.name }); paramClient.callService(request, callback); }; @@ -20193,7 +20193,7 @@ var Ros = /** @class */ (function (_super) { rand: rand, t: t, level: level, - end: end, + end: end }; // send the request this.callOnConnection(auth); @@ -20249,7 +20249,7 @@ var Ros = /** @class */ (function (_super) { var levelMsg = { op: 'set_level', level: level, - id: id, + id: id }; this.callOnConnection(levelMsg); }; @@ -20271,7 +20271,7 @@ var Ros = /** @class */ (function (_super) { var getActionServers = new Service({ ros: this, name: '/rosapi/action_servers', - serviceType: 'rosapi/GetActionServers', + serviceType: 'rosapi/GetActionServers' }); var request = new ServiceRequest({}); if (typeof failedCallback === 'function') { @@ -20307,7 +20307,7 @@ var Ros = /** @class */ (function (_super) { var topicsClient = new Service({ ros: this, name: '/rosapi/topics', - serviceType: 'rosapi/Topics', + serviceType: 'rosapi/Topics' }); var request = new ServiceRequest(); if (typeof failedCallback === 'function') { @@ -20342,10 +20342,10 @@ var Ros = /** @class */ (function (_super) { var topicsForTypeClient = new Service({ ros: this, name: '/rosapi/topics_for_type', - serviceType: 'rosapi/TopicsForType', + serviceType: 'rosapi/TopicsForType' }); var request = new ServiceRequest({ - type: topicType, + type: topicType }); if (typeof failedCallback === 'function') { topicsForTypeClient.callService(request, function (result) { @@ -20378,7 +20378,7 @@ var Ros = /** @class */ (function (_super) { var servicesClient = new Service({ ros: this, name: '/rosapi/services', - serviceType: 'rosapi/Services', + serviceType: 'rosapi/Services' }); var request = new ServiceRequest(); if (typeof failedCallback === 'function') { @@ -20413,10 +20413,10 @@ var Ros = /** @class */ (function (_super) { var servicesForTypeClient = new Service({ ros: this, name: '/rosapi/services_for_type', - serviceType: 'rosapi/ServicesForType', + serviceType: 'rosapi/ServicesForType' }); var request = new ServiceRequest({ - type: serviceType, + type: serviceType }); if (typeof failedCallback === 'function') { servicesForTypeClient.callService(request, function (result) { @@ -20451,10 +20451,10 @@ var Ros = /** @class */ (function (_super) { var serviceTypeClient = new Service({ ros: this, name: '/rosapi/service_request_details', - serviceType: 'rosapi/ServiceRequestDetails', + serviceType: 'rosapi/ServiceRequestDetails' }); var request = new ServiceRequest({ - type: type, + type: type }); if (typeof failedCallback === 'function') { serviceTypeClient.callService(request, function (result) { @@ -20489,10 +20489,10 @@ var Ros = /** @class */ (function (_super) { var serviceTypeClient = new Service({ ros: this, name: '/rosapi/service_response_details', - serviceType: 'rosapi/ServiceResponseDetails', + serviceType: 'rosapi/ServiceResponseDetails' }); var request = new ServiceRequest({ - type: type, + type: type }); if (typeof failedCallback === 'function') { serviceTypeClient.callService(request, function (result) { @@ -20525,7 +20525,7 @@ var Ros = /** @class */ (function (_super) { var nodesClient = new Service({ ros: this, name: '/rosapi/nodes', - serviceType: 'rosapi/Nodes', + serviceType: 'rosapi/Nodes' }); var request = new ServiceRequest(); if (typeof failedCallback === 'function') { @@ -20581,10 +20581,10 @@ var Ros = /** @class */ (function (_super) { var nodesClient = new Service({ ros: this, name: '/rosapi/node_details', - serviceType: 'rosapi/NodeDetails', + serviceType: 'rosapi/NodeDetails' }); var request = new ServiceRequest({ - node: node, + node: node }); if (typeof failedCallback === 'function') { nodesClient.callService(request, function (result) { @@ -20618,7 +20618,7 @@ var Ros = /** @class */ (function (_super) { var paramsClient = new Service({ ros: this, name: '/rosapi/get_param_names', - serviceType: 'rosapi/GetParamNames', + serviceType: 'rosapi/GetParamNames' }); var request = new ServiceRequest(); if (typeof failedCallback === 'function') { @@ -20653,10 +20653,10 @@ var Ros = /** @class */ (function (_super) { var topicTypeClient = new Service({ ros: this, name: '/rosapi/topic_type', - serviceType: 'rosapi/TopicType', + serviceType: 'rosapi/TopicType' }); var request = new ServiceRequest({ - topic: topic, + topic: topic }); if (typeof failedCallback === 'function') { topicTypeClient.callService(request, function (result) { @@ -20690,10 +20690,10 @@ var Ros = /** @class */ (function (_super) { var serviceTypeClient = new Service({ ros: this, name: '/rosapi/service_type', - serviceType: 'rosapi/ServiceType', + serviceType: 'rosapi/ServiceType' }); var request = new ServiceRequest({ - service: service, + service: service }); if (typeof failedCallback === 'function') { serviceTypeClient.callService(request, function (result) { @@ -20727,10 +20727,10 @@ var Ros = /** @class */ (function (_super) { var messageDetailClient = new Service({ ros: this, name: '/rosapi/message_details', - serviceType: 'rosapi/MessageDetails', + serviceType: 'rosapi/MessageDetails' }); var request = new ServiceRequest({ - type: message, + type: message }); if (typeof failedCallback === 'function') { messageDetailClient.callService(request, function (result) { @@ -20816,7 +20816,7 @@ var Ros = /** @class */ (function (_super) { var topicsAndRawTypesClient = new Service({ ros: this, name: '/rosapi/topics_and_raw_types', - serviceType: 'rosapi/TopicsAndRawTypes', + serviceType: 'rosapi/TopicsAndRawTypes' }); var request = new ServiceRequest(); if (typeof failedCallback === 'function') { @@ -20919,7 +20919,7 @@ var Service = /** @class */ (function (_super) { id: serviceCallId, service: this.name, type: this.serviceType, - args: request, + args: request }; this.ros.callOnConnection(call); }; @@ -20946,7 +20946,7 @@ var Service = /** @class */ (function (_super) { this.ros.callOnConnection({ op: 'advertise_service', type: this.serviceType, - service: this.name, + service: this.name }); this.isAdvertised = true; }; @@ -20956,20 +20956,19 @@ var Service = /** @class */ (function (_super) { } this.ros.callOnConnection({ op: 'unadvertise_service', - service: this.name, + service: this.name }); this.isAdvertised = false; }; Service.prototype._serviceResponse = function (rosbridgeRequest) { var response = {}; - if (this._serviceCallback) { - var success = this._serviceCallback(rosbridgeRequest.args, response); - } + // @ts-expect-error -- possibly null + var success = this._serviceCallback(rosbridgeRequest.args, response); var call = { op: 'service_response', service: this.name, values: new ServiceResponse(response), - result: success, + result: success }; if (rosbridgeRequest.id) { call.id = rosbridgeRequest.id; @@ -21030,9 +21029,9 @@ var decompressPng = require('../util/decompressPng'); var CBOR = require('cbor-js'); var typedArrayTagger = require('../util/cborTypedArrayTags'); var BSON = null; -// @ts-expect-error -- require tricks to not include BSON in roslibjs. should we be doing this? +// @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit if (typeof bson !== 'undefined') { - // @ts-expect-error -- require tricks to not include BSON in roslibjs. should we be doing this? + // @ts-expect-error -- Workarounds for not including BSON in bundle. need to revisit BSON = bson().BSON; } /** @@ -21081,16 +21080,10 @@ function SocketAdapter(client) { } var reader = new FileReader(); reader.onload = function () { - if (this.result) { - if (typeof this.result === 'string') { - var uint8Array = new Uint8Array(this.result.split('').map(function (c) { return c.charCodeAt(0); })); - } - else { - var uint8Array = new Uint8Array(this.result); - } - var msg = BSON.deserialize(uint8Array); - callback(msg); - } + // @ts-expect-error -- this doesn't seem right, but don't want to break current type coercion assumption + var uint8Array = new Uint8Array(this.result); + var msg = BSON.deserialize(uint8Array); + callback(msg); }; reader.readAsArrayBuffer(data); } @@ -21202,9 +21195,6 @@ var Topic = /** @class */ (function (_super) { */ function Topic(options) { var _this = _super.call(this) || this; - _this.waitForReconnect = false; - /** @type {import('eventemitter2').ListenerFn|undefined} */ - _this.reconnectFunc = undefined; _this.ros = options.ros; _this.name = options.name; _this.messageType = options.messageType; @@ -21218,6 +21208,8 @@ var Topic = /** @class */ (function (_super) { options.reconnect_on_close !== undefined ? options.reconnect_on_close : true; + _this.waitForReconnect = undefined; + _this.reconnectFunc = undefined; // Check for valid compression types if (_this.compression && _this.compression !== 'png' && @@ -21285,7 +21277,7 @@ var Topic = /** @class */ (function (_super) { topic: this.name, compression: this.compression, throttle_rate: this.throttle_rate, - queue_length: this.queue_length, + queue_length: this.queue_length }); }; /** @@ -21310,14 +21302,14 @@ var Topic = /** @class */ (function (_super) { } // Note: Don't call this.removeAllListeners, allow client to handle that themselves this.ros.off(this.name, this._messageCallback); - if (this.reconnect_on_close && this.reconnectFunc) { + if (this.reconnect_on_close) { this.ros.off('close', this.reconnectFunc); } this.emit('unsubscribe'); this.ros.callOnConnection({ op: 'unsubscribe', id: this.subscribeId, - topic: this.name, + topic: this.name }); this.subscribeId = null; }; @@ -21336,7 +21328,7 @@ var Topic = /** @class */ (function (_super) { type: this.messageType, topic: this.name, latch: this.latch, - queue_size: this.queue_size, + queue_size: this.queue_size }); this.isAdvertised = true; if (!this.reconnect_on_close) { @@ -21353,14 +21345,14 @@ var Topic = /** @class */ (function (_super) { if (!this.isAdvertised) { return; } - if (this.reconnect_on_close && this.reconnectFunc) { + if (this.reconnect_on_close) { this.ros.off('close', this.reconnectFunc); } this.emit('unadvertise'); this.ros.callOnConnection({ op: 'unadvertise', id: this.advertiseId, - topic: this.name, + topic: this.name }); this.isAdvertised = false; }; @@ -21379,7 +21371,7 @@ var Topic = /** @class */ (function (_super) { id: 'publish:' + this.name + ':' + this.ros.idCounter, topic: this.name, msg: message, - latch: this.latch, + latch: this.latch }; this.ros.callOnConnection(call); }; @@ -21390,7 +21382,7 @@ module.exports = Topic; },{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ "use strict"; var mixin = require('../mixin'); -var core = module.exports = { +var core = (module.exports = { Ros: require('./Ros'), Topic: require('./Topic'), Message: require('./Message'), @@ -21398,7 +21390,7 @@ var core = module.exports = { Service: require('./Service'), ServiceRequest: require('./ServiceRequest'), ServiceResponse: require('./ServiceResponse') -}; +}); mixin(core.Ros, ['Param', 'Service', 'Topic'], core); },{"../mixin":93,"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ @@ -21455,7 +21447,7 @@ var Pose = /** @class */ (function () { var p = pose.clone(); p.applyTransform({ rotation: this.orientation, - translation: this.position, + translation: this.position }); return p; }; @@ -21749,10 +21741,6 @@ var TFClient = /** @class */ (function (_super) { */ function TFClient(options) { var _this = _super.call(this) || this; - /** @type {Goal|undefined} */ - _this.currentGoal = undefined; - /** @type {Topic|undefined} */ - _this.currentTopic = undefined; _this.ros = options.ros; _this.fixedFrame = options.fixedFrame || 'base_link'; _this.angularThres = options.angularThres || 2.0; @@ -21764,13 +21752,17 @@ var TFClient = /** @class */ (function (_super) { var nsecs = Math.floor((seconds - secs) * 1000000000); _this.topicTimeout = { secs: secs, - nsecs: nsecs, + nsecs: nsecs }; _this.serverName = options.serverName || '/tf2_web_republisher'; _this.repubServiceName = options.repubServiceName || '/republish_tfs'; + /** @type {Goal|false} */ + _this.currentGoal = false; + /** @type {Topic|false} */ + _this.currentTopic = false; _this.frameInfos = {}; _this.republisherUpdateRequested = false; - _this._subscribeCB = null; + _this._subscribeCB = undefined; _this._isDisposed = false; // Create an Action Client _this.actionClient = new ActionClient({ @@ -21778,13 +21770,13 @@ var TFClient = /** @class */ (function (_super) { serverName: _this.serverName, actionName: 'tf2_web_republisher/TFSubscriptionAction', omitStatus: true, - omitResult: true, + omitResult: true }); // Create a Service Client _this.serviceClient = new Service({ ros: options.ros, name: _this.repubServiceName, - serviceType: 'tf2_web_republisher/RepublishTFs', + serviceType: 'tf2_web_republisher/RepublishTFs' }); return _this; } @@ -21793,7 +21785,6 @@ var TFClient = /** @class */ (function (_super) { * functions. * * @param {Object} tf - The TF message from the server. - * @param {Array} tf.transforms - The list of transforms. */ TFClient.prototype.processTFArray = function (tf) { var that = this; @@ -21806,7 +21797,7 @@ var TFClient = /** @class */ (function (_super) { if (info) { info.transform = new Transform({ translation: transform.transform.translation, - rotation: transform.transform.rotation, + rotation: transform.transform.rotation }); info.cbs.forEach(function (cb) { cb(info.transform); @@ -21824,7 +21815,7 @@ var TFClient = /** @class */ (function (_super) { target_frame: this.fixedFrame, angular_thres: this.angularThres, trans_thres: this.transThres, - rate: this.rate, + rate: this.rate }; // if we're running in groovy compatibility mode (the default) // then use the action interface to tf2_web_republisher @@ -21834,7 +21825,7 @@ var TFClient = /** @class */ (function (_super) { } this.currentGoal = new Goal({ actionClient: this.actionClient, - goalMessage: goalMessage, + goalMessage: goalMessage }); this.currentGoal.on('feedback', this.processTFArray.bind(this)); this.currentGoal.send(); @@ -21863,13 +21854,13 @@ var TFClient = /** @class */ (function (_super) { } // if we subscribed to a topic before, unsubscribe so // the republisher stops publishing it - if (this.currentTopic && this._subscribeCB) { + if (this.currentTopic) { this.currentTopic.unsubscribe(this._subscribeCB); } this.currentTopic = new Topic({ ros: this.ros, name: response.topic_name, - messageType: 'tf2_web_republisher/TFArray', + messageType: 'tf2_web_republisher/TFArray' }); this._subscribeCB = this.processTFArray.bind(this); this.currentTopic.subscribe(this._subscribeCB); @@ -21892,7 +21883,7 @@ var TFClient = /** @class */ (function (_super) { // if there is no callback registered for the given frame, create empty callback list if (!this.frameInfos[frameID]) { this.frameInfos[frameID] = { - cbs: [], + cbs: [] }; if (!this.republisherUpdateRequested) { setTimeout(this.updateGoal.bind(this), this.updateDelay); @@ -21932,7 +21923,7 @@ var TFClient = /** @class */ (function (_super) { TFClient.prototype.dispose = function () { this._isDisposed = true; this.actionClient.dispose(); - if (this.currentTopic && this._subscribeCB) { + if (this.currentTopic) { this.currentTopic.unsubscribe(this._subscribeCB); } }; @@ -21944,9 +21935,9 @@ module.exports = TFClient; "use strict"; var Ros = require('../core/Ros'); var mixin = require('../mixin'); -var tf = module.exports = { +var tf = (module.exports = { TFClient: require('./TFClient') -}; +}); mixin(Ros, ['TFClient'], tf); },{"../core/Ros":81,"../mixin":93,"./TFClient":94}],96:[function(require,module,exports){ @@ -21970,15 +21961,13 @@ var UrdfBox = /** @class */ (function () { this.dimension = null; this.type = UrdfTypes.URDF_BOX; // Parse the xml string - var size = options.xml.getAttribute('size'); - if (size) { - var xyz = size.split(' '); - this.dimension = new Vector3({ - x: parseFloat(xyz[0]), - y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), - }); - } + // @ts-expect-error -- possibly null + var xyz = options.xml.getAttribute('size').split(' '); + this.dimension = new Vector3({ + x: parseFloat(xyz[0]), + y: parseFloat(xyz[1]), + z: parseFloat(xyz[2]) + }); } return UrdfBox; }()); @@ -22001,14 +21990,12 @@ var UrdfColor = /** @class */ (function () { */ function UrdfColor(options) { // Parse the xml string - var rgbaValue = options.xml.getAttribute('rgba'); - if (rgbaValue) { - var rgba = rgbaValue.split(' '); - this.r = parseFloat(rgba[0]); - this.g = parseFloat(rgba[1]); - this.b = parseFloat(rgba[2]); - this.a = parseFloat(rgba[3]); - } + // @ts-expect-error -- possibly null + var rgba = options.xml.getAttribute('rgba').split(' '); + this.r = parseFloat(rgba[0]); + this.g = parseFloat(rgba[1]); + this.b = parseFloat(rgba[2]); + this.a = parseFloat(rgba[3]); } return UrdfColor; }()); @@ -22032,8 +22019,10 @@ var UrdfCylinder = /** @class */ (function () { */ function UrdfCylinder(options) { this.type = UrdfTypes.URDF_CYLINDER; - this.length = parseFloat(options.xml.getAttribute('length') || 'NaN'); - this.radius = parseFloat(options.xml.getAttribute('radius') || 'NaN'); + // @ts-expect-error -- possibly null + this.length = parseFloat(options.xml.getAttribute('length')); + // @ts-expect-error -- possibly null + this.radius = parseFloat(options.xml.getAttribute('radius')); } return UrdfCylinder; }()); @@ -22087,7 +22076,7 @@ var UrdfJoint = /** @class */ (function () { position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } // Check the RPY @@ -22114,13 +22103,13 @@ var UrdfJoint = /** @class */ (function () { x: x, y: y, z: z, - w: w, + w: w }); orientation.normalize(); } this.origin = new Pose({ position: position, - orientation: orientation, + orientation: orientation }); } } @@ -22150,7 +22139,7 @@ var UrdfLink = /** @class */ (function () { var visuals = options.xml.getElementsByTagName('visual'); for (var i = 0; i < visuals.length; i++) { this.visuals.push(new UrdfVisual({ - xml: visuals[i], + xml: visuals[i] })); } } @@ -22188,7 +22177,7 @@ var UrdfMaterial = /** @class */ (function () { if (colors.length > 0) { // Parse the RBGA string this.color = new UrdfColor({ - xml: colors[0], + xml: colors[0] }); } } @@ -22232,7 +22221,7 @@ var UrdfMesh = /** @class */ (function () { this.scale = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } } @@ -22286,7 +22275,7 @@ var UrdfModel = /** @class */ (function () { var node = nodes[i]; if (node.tagName === "material") { var material = new UrdfMaterial({ - xml: node, + xml: node }); // Make sure this is unique if (this.materials[material.name] !== void 0) { @@ -22303,7 +22292,7 @@ var UrdfModel = /** @class */ (function () { } else if (node.tagName === "link") { var link = new UrdfLink({ - xml: node, + xml: node }); // Make sure this is unique if (this.links[link.name] !== void 0) { @@ -22328,7 +22317,7 @@ var UrdfModel = /** @class */ (function () { } else if (node.tagName === "joint") { var joint = new UrdfJoint({ - xml: node, + xml: node }); this.joints[joint.name] = joint; } @@ -22415,7 +22404,7 @@ var UrdfVisual = /** @class */ (function () { position = new Vector3({ x: parseFloat(xyz[0]), y: parseFloat(xyz[1]), - z: parseFloat(xyz[2]), + z: parseFloat(xyz[2]) }); } // Check the RPY @@ -22442,13 +22431,13 @@ var UrdfVisual = /** @class */ (function () { x: x, y: y, z: z, - w: w, + w: w }); orientation.normalize(); } this.origin = new Pose({ position: position, - orientation: orientation, + orientation: orientation }); } // Geometry @@ -22471,22 +22460,22 @@ var UrdfVisual = /** @class */ (function () { var type = shape.nodeName; if (type === 'sphere') { this.geometry = new UrdfSphere({ - xml: shape, + xml: shape }); } else if (type === 'box') { this.geometry = new UrdfBox({ - xml: shape, + xml: shape }); } else if (type === 'cylinder') { this.geometry = new UrdfCylinder({ - xml: shape, + xml: shape }); } else if (type === 'mesh') { this.geometry = new UrdfMesh({ - xml: shape, + xml: shape }); } else { @@ -22498,7 +22487,7 @@ var UrdfVisual = /** @class */ (function () { var materials = xml.getElementsByTagName('material'); if (materials.length > 0) { this.material = new UrdfMaterial({ - xml: materials[0], + xml: materials[0] }); } } @@ -22533,7 +22522,7 @@ function warnPrecision() { /** * Unpack 64-bit unsigned integer from byte array. * @param {Uint8Array} bytes -*/ + */ function decodeUint64LE(bytes) { warnPrecision(); var byteLen = bytes.byteLength; @@ -22553,7 +22542,7 @@ function decodeUint64LE(bytes) { /** * Unpack 64-bit signed integer from byte array. * @param {Uint8Array} bytes -*/ + */ function decodeInt64LE(bytes) { warnPrecision(); var byteLen = bytes.byteLength; @@ -22575,7 +22564,7 @@ function decodeInt64LE(bytes) { * Unpack typed array from byte array. * @param {Uint8Array} bytes * @param {ArrayConstructor} ArrayType - Desired output array type -*/ + */ function decodeNativeArray(bytes, ArrayType) { var byteLen = bytes.byteLength; var offset = bytes.byteOffset; @@ -22674,14 +22663,10 @@ catch (ReferenceError) { var workerSocketImpl = require('./workerSocketImpl'); var WorkerSocket = /** @class */ (function () { function WorkerSocket(uri) { - this.onmessage = undefined; - this.onclose = undefined; - this.onopen = undefined; - this.onerror = undefined; this.socket_ = work(workerSocketImpl); this.socket_.addEventListener('message', this.handleWorkerMessage_.bind(this)); this.socket_.postMessage({ - uri: uri, + uri: uri }); } WorkerSocket.prototype.handleWorkerMessage_ = function (ev) { @@ -22712,7 +22697,7 @@ var WorkerSocket = /** @class */ (function () { }; WorkerSocket.prototype.close = function () { this.socket_.postMessage({ - close: true, + close: true }); }; return WorkerSocket; diff --git a/build/roslib.min.js b/build/roslib.min.js index 798509034..7574575c3 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){x(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function x(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function A(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){x(this,e),T.nextTick(A,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw x(this),new RangeError(b);var r=y.concat(h,p);return x(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=x(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,S=2,k=3,x=4;function A(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return A(e,-5);if(666===n.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==x||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(x=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(x=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(x=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(A+1),o=0,s=1;s<=A;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=A;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,S,k,l,x,A,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,x=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,A=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=x[3*w[0]];break;case 2:m[L++]=x[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function x(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(A,e))}function A(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){x(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function x(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function A(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){x(this,e),T.nextTick(A,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw x(this),new RangeError(b);var r=y.concat(h,p);return x(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=x(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,S=2,k=3,x=4;function A(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return A(e,-5);if(666===n.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==x||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(x=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(x=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(x=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(A+1),o=0,s=1;s<=A;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=A;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,S,k,l,x,A,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,x=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,A=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=x[3*w[0]];break;case 2:m[L++]=x[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function x(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(A,e))}function A(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Fri, 17 Nov 2023 15:17:54 -0700 Subject: [PATCH 28/66] replace deprecated prototype call with super() --- src/node/RosTCP.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node/RosTCP.js b/src/node/RosTCP.js index 0563ecdcf..4f0a8165d 100644 --- a/src/node/RosTCP.js +++ b/src/node/RosTCP.js @@ -11,7 +11,6 @@ var socketAdapter = require('../core/SocketAdapter.js'); */ class RosTCP extends Ros { constructor(options) { - super(options); options = options || {}; if (!options.encoding) { console.error( @@ -19,8 +18,8 @@ class RosTCP extends Ros { 'It would be more efficient to use ascii (if possible).' ); } + super(options); this.encoding = options.encoding || 'utf8'; - Ros.call(this, options); if (!this.socket && (options.host || options.port)) { this.connect({ From 7e39eff7caae2ff5bc91758554115330390c555b Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 08:52:35 -0700 Subject: [PATCH 29/66] Use more modern export syntax to enable types --- Gruntfile.js | 42 ++- build/RosLib.d.ts | 5 + build/RosLibBrowser.d.ts | 1 + build/RosLibNode.d.ts | 2 + build/actionlib/ActionClient.d.ts | 57 ++++ build/actionlib/ActionListener.d.ts | 30 +++ build/actionlib/Goal.d.ts | 39 +++ build/actionlib/SimpleActionServer.d.ts | 56 ++++ build/actionlib/index.d.ts | 4 + build/core/Message.d.ts | 17 ++ build/core/Param.d.ts | 49 ++++ build/core/Ros.d.ts | 340 ++++++++++++++++++++++++ build/core/Service.d.ts | 60 +++++ build/core/ServiceRequest.d.ts | 17 ++ build/core/ServiceResponse.d.ts | 17 ++ build/core/SocketAdapter.d.ts | 40 +++ build/core/Topic.d.ts | 88 ++++++ build/core/index.d.ts | 7 + build/math/Pose.d.ts | 44 +++ build/math/Quaternion.d.ts | 55 ++++ build/math/Transform.d.ts | 25 ++ build/math/Vector3.d.ts | 45 ++++ build/math/index.d.ts | 7 + build/node/RosTCP.d.ts | 21 ++ build/node/SocketIO.d.ts | 8 + build/node/TopicStream.d.ts | 2 + build/roslib.js | 190 ++++++------- build/roslib.min.js | 2 +- build/tf/TFClient.d.ts | 100 +++++++ build/tf/index.d.ts | 1 + build/urdf/UrdfBox.d.ts | 16 ++ build/urdf/UrdfColor.d.ts | 22 ++ build/urdf/UrdfCylinder.d.ts | 16 ++ build/urdf/UrdfJoint.d.ts | 21 ++ build/urdf/UrdfLink.d.ts | 16 ++ build/urdf/UrdfMaterial.d.ts | 19 ++ build/urdf/UrdfMesh.d.ts | 17 ++ build/urdf/UrdfModel.d.ts | 19 ++ build/urdf/UrdfSphere.d.ts | 15 ++ build/urdf/UrdfTypes.d.ts | 4 + build/urdf/UrdfVisual.d.ts | 23 ++ build/urdf/index.d.ts | 10 + build/util/cborTypedArrayTags.d.ts | 7 + build/util/decompressPng.d.ts | 19 ++ build/util/shim/@xmldom/xmldom.d.ts | 1 + build/util/shim/WebSocket.d.ts | 9 + build/util/shim/canvas.d.ts | 2 + build/util/shim/decompressPng.d.ts | 19 ++ build/util/workerSocket.d.ts | 12 + build/util/workerSocketImpl.d.ts | 2 + package-lock.json | 148 +++++++++++ package.json | 2 + src/RosLib.js | 8 +- src/actionlib/index.js | 15 +- src/core/index.js | 20 +- src/math/index.js | 2 +- src/mixin.js | 17 -- src/tf/index.js | 9 +- src/urdf/UrdfTypes.js | 10 +- src/urdf/index.js | 24 +- tsconfig.json | 2 +- 61 files changed, 1709 insertions(+), 188 deletions(-) create mode 100644 build/RosLib.d.ts create mode 100644 build/RosLibBrowser.d.ts create mode 100644 build/RosLibNode.d.ts create mode 100644 build/actionlib/ActionClient.d.ts create mode 100644 build/actionlib/ActionListener.d.ts create mode 100644 build/actionlib/Goal.d.ts create mode 100644 build/actionlib/SimpleActionServer.d.ts create mode 100644 build/actionlib/index.d.ts create mode 100644 build/core/Message.d.ts create mode 100644 build/core/Param.d.ts create mode 100644 build/core/Ros.d.ts create mode 100644 build/core/Service.d.ts create mode 100644 build/core/ServiceRequest.d.ts create mode 100644 build/core/ServiceResponse.d.ts create mode 100644 build/core/SocketAdapter.d.ts create mode 100644 build/core/Topic.d.ts create mode 100644 build/core/index.d.ts create mode 100644 build/math/Pose.d.ts create mode 100644 build/math/Quaternion.d.ts create mode 100644 build/math/Transform.d.ts create mode 100644 build/math/Vector3.d.ts create mode 100644 build/math/index.d.ts create mode 100644 build/node/RosTCP.d.ts create mode 100644 build/node/SocketIO.d.ts create mode 100644 build/node/TopicStream.d.ts create mode 100644 build/tf/TFClient.d.ts create mode 100644 build/tf/index.d.ts create mode 100644 build/urdf/UrdfBox.d.ts create mode 100644 build/urdf/UrdfColor.d.ts create mode 100644 build/urdf/UrdfCylinder.d.ts create mode 100644 build/urdf/UrdfJoint.d.ts create mode 100644 build/urdf/UrdfLink.d.ts create mode 100644 build/urdf/UrdfMaterial.d.ts create mode 100644 build/urdf/UrdfMesh.d.ts create mode 100644 build/urdf/UrdfModel.d.ts create mode 100644 build/urdf/UrdfSphere.d.ts create mode 100644 build/urdf/UrdfTypes.d.ts create mode 100644 build/urdf/UrdfVisual.d.ts create mode 100644 build/urdf/index.d.ts create mode 100644 build/util/cborTypedArrayTags.d.ts create mode 100644 build/util/decompressPng.d.ts create mode 100644 build/util/shim/@xmldom/xmldom.d.ts create mode 100644 build/util/shim/WebSocket.d.ts create mode 100644 build/util/shim/canvas.d.ts create mode 100644 build/util/shim/decompressPng.d.ts create mode 100644 build/util/workerSocket.d.ts create mode 100644 build/util/workerSocketImpl.d.ts delete mode 100644 src/mixin.js diff --git a/Gruntfile.js b/Gruntfile.js index 7266ec6c0..de9c3d74c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,6 +15,14 @@ module.exports = function(grunt) { command: 'tsc -p .' } }, + copy: { + main: { + expand: true, + cwd: 'tsbuild', + src: ['**/*.d.ts'], + dest: 'build/' + } + }, browserify: { dist: { src: ['./tsbuild/RosLibBrowser.js'], @@ -25,10 +33,7 @@ module.exports = function(grunt) { options: { jshintrc: true }, - files: [ - './Gruntfile.js', - './src/**/*.js' - ] + files: ['./Gruntfile.js', './src/**/*.js'] }, karma: { options: { @@ -42,19 +47,19 @@ module.exports = function(grunt) { } }, test: { - configFile: './test/karma.conf.js', + configFile: './test/karma.conf.js' }, examples: { - configFile: './test/examples/karma.conf.js', + configFile: './test/examples/karma.conf.js' }, workersocket: { - configFile: './test/workersocket/karma.conf.js', - }, + configFile: './test/workersocket/karma.conf.js' + } }, mochaTest: { options: { - reporter: 'spec', - timeout: 5000 + reporter: 'spec', + timeout: 5000 }, test: { src: ['./test/*.test.js'] @@ -80,20 +85,14 @@ module.exports = function(grunt) { options: { interrupt: true }, - files: [ - './src/**/*.js' - ], + files: ['./src/**/*.js'], tasks: ['browserify'] }, build_and_watch: { options: { interrupt: true }, - files: [ - 'Gruntfile.js', - '.jshintrc', - './src/**/*.js' - ], + files: ['Gruntfile.js', '.jshintrc', './src/**/*.js'], tasks: ['build'] } }, @@ -105,10 +104,7 @@ module.exports = function(grunt) { }, jsdoc: { doc: { - src: [ - './src/*.js', - './src/**/*.js' - ], + src: ['./src/*.js', './src/**/*.js'], options: { destination: './doc', configure: 'jsdoc_conf.json' @@ -122,7 +118,7 @@ module.exports = function(grunt) { grunt.registerTask('test-examples', ['mochaTest:examples', 'karma:examples']); grunt.registerTask('test-tcp', ['mochaTest:tcp']); grunt.registerTask('test-workersocket', ['karma:workersocket']); - grunt.registerTask('build', ['shell', 'browserify', 'uglify']); + grunt.registerTask('build', ['shell', 'copy', 'browserify', 'uglify']); grunt.registerTask('build_and_watch', ['watch']); grunt.registerTask('doc', ['clean', 'jsdoc']); }; diff --git a/build/RosLib.d.ts b/build/RosLib.d.ts new file mode 100644 index 000000000..750ffcd22 --- /dev/null +++ b/build/RosLib.d.ts @@ -0,0 +1,5 @@ +export * from "./core"; +export * from "./actionlib"; +export * from "./math"; +export * from "./tf"; +export * from "./urdf"; diff --git a/build/RosLibBrowser.d.ts b/build/RosLibBrowser.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/build/RosLibBrowser.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/build/RosLibNode.d.ts b/build/RosLibNode.d.ts new file mode 100644 index 000000000..1cce63507 --- /dev/null +++ b/build/RosLibNode.d.ts @@ -0,0 +1,2 @@ +declare const _exports: any; +export = _exports; diff --git a/build/actionlib/ActionClient.d.ts b/build/actionlib/ActionClient.d.ts new file mode 100644 index 000000000..2b53d5ec8 --- /dev/null +++ b/build/actionlib/ActionClient.d.ts @@ -0,0 +1,57 @@ +export = ActionClient; +/** + * An actionlib action client. + * + * Emits the following events: + * * 'timeout' - If a timeout occurred while sending a goal. + * * 'status' - The status messages received from the action server. + * * 'feedback' - The feedback messages received from the action server. + * * 'result' - The result returned from the action server. + * + */ +declare class ActionClient extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + * @param {number} [options.timeout] - The timeout length when connecting to the action server. + * @param {boolean} [options.omitFeedback] - The flag to indicate whether to omit the feedback channel or not. + * @param {boolean} [options.omitStatus] - The flag to indicate whether to omit the status channel or not. + * @param {boolean} [options.omitResult] - The flag to indicate whether to omit the result channel or not. + */ + constructor(options: { + ros: Ros; + serverName: string; + actionName: string; + timeout?: number | undefined; + omitFeedback?: boolean | undefined; + omitStatus?: boolean | undefined; + omitResult?: boolean | undefined; + }); + ros: Ros; + serverName: string; + actionName: string; + timeout: number | undefined; + omitFeedback: boolean | undefined; + omitStatus: boolean | undefined; + omitResult: boolean | undefined; + goals: {}; + feedbackListener: Topic; + statusListener: Topic; + resultListener: Topic; + goalTopic: Topic; + cancelTopic: Topic; + /** + * Cancel all goals associated with this ActionClient. + */ + cancel(): void; + /** + * Unsubscribe and unadvertise all topics associated with this ActionClient. + */ + dispose(): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); +import Topic = require("../core/Topic"); diff --git a/build/actionlib/ActionListener.d.ts b/build/actionlib/ActionListener.d.ts new file mode 100644 index 000000000..ebfe19aba --- /dev/null +++ b/build/actionlib/ActionListener.d.ts @@ -0,0 +1,30 @@ +export = ActionListener; +/** + * An actionlib action listener. + * + * Emits the following events: + * * 'status' - The status messages received from the action server. + * * 'feedback' - The feedback messages received from the action server. + * * 'result' - The result returned from the action server. + * + + */ +declare class ActionListener extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ + constructor(options: { + ros: Ros; + serverName: string; + actionName: string; + }); + ros: Ros; + serverName: string; + actionName: string; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); diff --git a/build/actionlib/Goal.d.ts b/build/actionlib/Goal.d.ts new file mode 100644 index 000000000..5d0f4bd02 --- /dev/null +++ b/build/actionlib/Goal.d.ts @@ -0,0 +1,39 @@ +export = Goal; +/** + * An actionlib goal that is associated with an action server. + * + * Emits the following events: + * * 'timeout' - If a timeout occurred while sending a goal. + */ +declare class Goal extends EventEmitter2 { + /** + * @param {Object} options + * @param {ActionClient} options.actionClient - The ROSLIB.ActionClient to use with this goal. + * @param {Object} options.goalMessage - The JSON object containing the goal for the action server. + */ + constructor(options: { + actionClient: ActionClient; + goalMessage: any; + }); + actionClient: ActionClient; + goalMessage: Message; + isFinished: boolean; + status: any; + result: any; + feedback: any; + goalID: string; + /** + * Send the goal to the action server. + * + * @param {number} [timeout] - A timeout length for the goal's result. + */ + send(timeout?: number | undefined): void; + /** + * Cancel the current goal. + */ + cancel(): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import ActionClient = require("./ActionClient"); +import Message = require("../core/Message"); diff --git a/build/actionlib/SimpleActionServer.d.ts b/build/actionlib/SimpleActionServer.d.ts new file mode 100644 index 000000000..cc736ba28 --- /dev/null +++ b/build/actionlib/SimpleActionServer.d.ts @@ -0,0 +1,56 @@ +export = SimpleActionServer; +/** + * An actionlib action server client. + * + * Emits the following events: + * * 'goal' - Goal sent by action client. + * * 'cancel' - Action client has canceled the request. + */ +declare class SimpleActionServer extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.serverName - The action server name, like '/fibonacci'. + * @param {string} options.actionName - The action message name, like 'actionlib_tutorials/FibonacciAction'. + */ + constructor(options: { + ros: Ros; + serverName: string; + actionName: string; + }); + ros: Ros; + serverName: string; + actionName: string; + feedbackPublisher: Topic; + resultPublisher: Topic; + statusMessage: Message; + currentGoal: any; + nextGoal: any; + /** + * Set action state to succeeded and return to client. + * + * @param {Object} result - The result to return to the client. + */ + setSucceeded(result: any): void; + /** + * Set action state to aborted and return to client. + * + * @param {Object} result - The result to return to the client. + */ + setAborted(result: any): void; + /** + * Send a feedback message. + * + * @param {Object} feedback - The feedback to send to the client. + */ + sendFeedback(feedback: any): void; + /** + * Handle case where client requests preemption. + */ + setPreempted(): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); +import Topic = require("../core/Topic"); +import Message = require("../core/Message"); diff --git a/build/actionlib/index.d.ts b/build/actionlib/index.d.ts new file mode 100644 index 000000000..96cc884d7 --- /dev/null +++ b/build/actionlib/index.d.ts @@ -0,0 +1,4 @@ +export const ActionClient: typeof import("./ActionClient"); +export const ActionListener: typeof import("./ActionListener"); +export const Goal: typeof import("./Goal"); +export const SimpleActionServer: typeof import("./SimpleActionServer"); diff --git a/build/core/Message.d.ts b/build/core/Message.d.ts new file mode 100644 index 000000000..ff775521f --- /dev/null +++ b/build/core/Message.d.ts @@ -0,0 +1,17 @@ +export = Message; +/** + * Message objects are used for publishing and subscribing to and from topics. + * + * @constructor + * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. + */ +declare function Message(values?: any): void; +declare class Message { + /** + * Message objects are used for publishing and subscribing to and from topics. + * + * @constructor + * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. + */ + constructor(values?: any); +} diff --git a/build/core/Param.d.ts b/build/core/Param.d.ts new file mode 100644 index 000000000..e440dab9c --- /dev/null +++ b/build/core/Param.d.ts @@ -0,0 +1,49 @@ +export = Param; +/** + * A ROS parameter. + */ +declare class Param { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The param name, like max_vel_x. + */ + constructor(options: { + ros: Ros; + name: string; + }); + ros: Ros; + name: string; + /** + * @callback getCallback + * @param {Object} value - The value of the param from ROS. + */ + /** + * Fetch the value of the param. + * + * @param {getCallback} callback - Function with the following params: + */ + get(callback: (value: any) => any): void; + /** + * @callback setParamCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback setParamFailedCallback + * @param {Object} response - The response from the service request. + */ + /** + * Set the value of the param in ROS. + * + * @param {Object} value - The value to set param to. + * @param {setParamCallback} callback - The callback function. + */ + set(value: any, callback: (response: any) => any): void; + /** + * Delete this parameter on the ROS server. + * + * @param {setParamCallback} callback - The callback function. + */ + delete(callback: (response: any) => any): void; +} +import Ros = require("../core/Ros"); diff --git a/build/core/Ros.d.ts b/build/core/Ros.d.ts new file mode 100644 index 000000000..ac0c6d91c --- /dev/null +++ b/build/core/Ros.d.ts @@ -0,0 +1,340 @@ +export = Ros; +/** + * Manages connection to the server and all interactions with ROS. + * + * Emits the following events: + * * 'error' - There was an error with ROS. + * * 'connection' - Connected to the WebSocket server. + * * 'close' - Disconnected to the WebSocket server. + * * <topicName> - A message came from rosbridge with the given topic name. + * * <serviceID> - A service response came from rosbridge with the given ID. + */ +declare class Ros extends EventEmitter2 { + /** + * @param {Object} options + * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. + * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. + * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. + * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. + */ + constructor(options: { + url?: string | undefined; + groovyCompatibility?: boolean | undefined; + transportLibrary?: string | undefined; + transportOptions?: any; + }); + socket: any; + idCounter: number; + isConnected: boolean; + transportLibrary: string; + transportOptions: any; + _sendFunc: (msg: any) => void; + groovyCompatibility: boolean; + /** + * Connect to the specified WebSocket. + * + * @param {string} url - WebSocket URL or RTCDataChannel label for rosbridge. + */ + connect(url: string): void; + /** + * Disconnect from the WebSocket server. + */ + close(): void; + /** + * Send an authorization request to the server. + * + * @param {string} mac - MAC (hash) string given by the trusted source. + * @param {string} client - IP of the client. + * @param {string} dest - IP of the destination. + * @param {string} rand - Random string given by the trusted source. + * @param {Object} t - Time of the authorization request. + * @param {string} level - User level as a string given by the client. + * @param {Object} end - End time of the client's session. + */ + authenticate(mac: string, client: string, dest: string, rand: string, t: any, level: string, end: any): void; + /** + * Send an encoded message over the WebSocket. + * + * @param {Object} messageEncoded - The encoded message to be sent. + */ + sendEncodedMessage(messageEncoded: any): void; + /** + * Send the message over the WebSocket, but queue the message up if not yet + * connected. + * + * @param {Object} message - The message to be sent. + */ + callOnConnection(message: any): void; + /** + * Send a set_level request to the server. + * + * @param {string} level - Status level (none, error, warning, info). + * @param {number} [id] - Operation ID to change status level on. + */ + setStatusLevel(level: string, id?: number | undefined): void; + /** + * @callback getActionServersCallback + * @param {string[]} actionservers - Array of action server names. + */ + /** + * @callback getActionServersFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of action servers in ROS as an array of string. + * + * @param {getActionServersCallback} callback - Function with the following params: + * @param {getActionServersFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getActionServers(callback: (actionservers: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getTopicsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + */ + /** + * @callback getTopicsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics in ROS as an array. + * + * @param {getTopicsCallback} callback - Function with the following params: + * @param {getTopicsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getTopics(callback: (result: { + topics: string[]; + types: string[]; + }) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getTopicsForTypeCallback + * @param {string[]} topics - Array of topic names. + */ + /** + * @callback getTopicsForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics in ROS as an array of a specific type. + * + * @param {string} topicType - The topic type to find. + * @param {getTopicsForTypeCallback} callback - Function with the following params: + * @param {getTopicsForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getTopicsForType(topicType: string, callback: (topics: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getServicesCallback + * @param {string[]} services - Array of service names. + */ + /** + * @callback getServicesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of active service names in ROS. + * + * @param {getServicesCallback} callback - Function with the following params: + * @param {getServicesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getServices(callback: (services: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getServicesForTypeCallback + * @param {string[]} topics - Array of service names. + */ + /** + * @callback getServicesForTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of services in ROS as an array as specific type. + * + * @param {string} serviceType - The service type to find. + * @param {getServicesForTypeCallback} callback - Function with the following params: + * @param {getServicesForTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getServicesForType(serviceType: string, callback: (topics: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getServiceRequestDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service request. + */ + /** + * @callback getServiceRequestDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS service request. + * + * @param {string} type - The type of the service. + * @param {getServiceRequestDetailsCallback} callback - Function with the following params: + * @param {getServiceRequestDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getServiceRequestDetails(type: string, callback: (result: { + typedefs: string[]; + }) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getServiceResponseDetailsCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.typedefs - An array containing the details of the service response. + */ + /** + * @callback getServiceResponseDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS service response. + * + * @param {string} type - The type of the service. + * @param {getServiceResponseDetailsCallback} callback - Function with the following params: + * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getServiceResponseDetails(type: string, callback: (result: { + typedefs: string[]; + }) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getNodesCallback + * @param {string[]} nodes - Array of node names. + */ + /** + * @callback getNodesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of active node names in ROS. + * + * @param {getNodesCallback} callback - Function with the following params: + * @param {getNodesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getNodes(callback: (nodes: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getNodeDetailsCallback + * @param {string[]} subscriptions - Array of subscribed topic names. + * @param {string[]} publications - Array of published topic names. + * @param {string[]} services - Array of service names hosted. + */ + /** + * @callback getNodeDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * @callback getNodeDetailsLegacyCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.subscribing - Array of subscribed topic names. + * @param {string[]} result.publishing - Array of published topic names. + * @param {string[]} result.services - Array of service names hosted. + */ + /** + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is defined. + * + * @param {string} node - Name of the node. + * @param {getNodeDetailsCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + * + * @also + * + * Retrieve a list of subscribed topics, publishing topics and services of a specific node. + *
+ * These are the parameters if failedCallback is undefined. + * + * @param {string} node - Name of the node. + * @param {getNodeDetailsLegacyCallback} callback - Function with the following params: + * @param {getNodeDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getNodeDetails(node: string, callback: (subscriptions: string[], publications: string[], services: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getParamsCallback + * @param {string[]} params - Array of param names. + */ + /** + * @callback getParamsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of parameter names from the ROS Parameter Server. + * + * @param {getParamsCallback} callback - Function with the following params: + * @param {getParamsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getParams(callback: (params: string[]) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getTopicTypeCallback + * @param {string} type - The type of the topic. + */ + /** + * @callback getTopicTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the type of a ROS topic. + * + * @param {string} topic - Name of the topic. + * @param {getTopicTypeCallback} callback - Function with the following params: + * @param {getTopicTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getTopicType(topic: string, callback: (type: string) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getServiceTypeCallback + * @param {string} type - The type of the service. + */ + /** + * @callback getServiceTypeFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the type of a ROS service. + * + * @param {string} service - Name of the service. + * @param {getServiceTypeCallback} callback - Function with the following params: + * @param {getServiceTypeFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getServiceType(service: string, callback: (type: string) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback getMessageDetailsCallback + * @param {string} details - An array of the message details. + */ + /** + * @callback getMessageDetailsFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve the details of a ROS message. + * + * @param {string} message - The name of the message type. + * @param {getMessageDetailsCallback} callback - Function with the following params: + * @param {getMessageDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getMessageDetails(message: string, callback: (details: string) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * Decode a typedef array into a dictionary like `rosmsg show foo/bar`. + * + * @param {Object[]} defs - Array of type_def dictionary. + */ + decodeTypeDefs(defs: any[]): {}; + /** + * @callback getTopicsAndRawTypesCallback + * @param {Object} result - The result object with the following params: + * @param {string[]} result.topics - Array of topic names. + * @param {string[]} result.types - Array of message type names. + * @param {string[]} result.typedefs_full_text - Array of full definitions of message types, similar to `gendeps --cat`. + */ + /** + * @callback getTopicsAndRawTypesFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Retrieve a list of topics and their associated type definitions. + * + * @param {getTopicsAndRawTypesCallback} callback - Function with the following params: + * @param {getTopicsAndRawTypesFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + getTopicsAndRawTypes(callback: (result: { + topics: string[]; + types: string[]; + typedefs_full_text: string[]; + }) => any, failedCallback?: ((error: string) => any) | undefined): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; diff --git a/build/core/Service.d.ts b/build/core/Service.d.ts new file mode 100644 index 000000000..9fe265d93 --- /dev/null +++ b/build/core/Service.d.ts @@ -0,0 +1,60 @@ +export = Service; +/** + * A ROS service client. + */ +declare class Service extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The service name, like '/add_two_ints'. + * @param {string} options.serviceType - The service type, like 'rospy_tutorials/AddTwoInts'. + */ + constructor(options: { + ros: Ros; + name: string; + serviceType: string; + }); + ros: Ros; + name: string; + serviceType: string; + isAdvertised: boolean; + _serviceCallback: ((request: ServiceRequest, response: any) => any) | null; + /** + * @callback callServiceCallback + * @param {Object} response - The response from the service request. + */ + /** + * @callback callServiceFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Call the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {callServiceCallback} callback - Function with the following params: + * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: + */ + callService(request: ServiceRequest, callback: (response: any) => any, failedCallback?: ((error: string) => any) | undefined): void; + /** + * @callback advertiseCallback + * @param {ServiceRequest} request - The service request. + * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the service has finished successfully, + * i.e., without any fatal errors. + */ + /** + * Advertise the service. This turns the Service object from a client + * into a server. The callback will be called with every request + * that's made on this service. + * + * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params + */ + advertise(callback: (request: ServiceRequest, response: any) => any): void; + unadvertise(): void; + _serviceResponse(rosbridgeRequest: any): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); +import ServiceRequest = require("./ServiceRequest"); diff --git a/build/core/ServiceRequest.d.ts b/build/core/ServiceRequest.d.ts new file mode 100644 index 000000000..6e11010f8 --- /dev/null +++ b/build/core/ServiceRequest.d.ts @@ -0,0 +1,17 @@ +export = ServiceRequest; +/** + * A ServiceRequest is passed into the service call. + * + * @constructor + * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. + */ +declare function ServiceRequest(values?: any): void; +declare class ServiceRequest { + /** + * A ServiceRequest is passed into the service call. + * + * @constructor + * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. + */ + constructor(values?: any); +} diff --git a/build/core/ServiceResponse.d.ts b/build/core/ServiceResponse.d.ts new file mode 100644 index 000000000..a78933e16 --- /dev/null +++ b/build/core/ServiceResponse.d.ts @@ -0,0 +1,17 @@ +export = ServiceResponse; +/** + * A ServiceResponse is returned from the service call. + * + * @constructor + * @param {Object} values - Object matching the fields defined in the .srv definition file. + */ +declare function ServiceResponse(values: any): void; +declare class ServiceResponse { + /** + * A ServiceResponse is returned from the service call. + * + * @constructor + * @param {Object} values - Object matching the fields defined in the .srv definition file. + */ + constructor(values: any); +} diff --git a/build/core/SocketAdapter.d.ts b/build/core/SocketAdapter.d.ts new file mode 100644 index 000000000..89bcf253f --- /dev/null +++ b/build/core/SocketAdapter.d.ts @@ -0,0 +1,40 @@ +export = SocketAdapter; +/** + * Event listeners for a WebSocket or TCP socket to a JavaScript + * ROS Client. Sets up Messages for a given topic to trigger an + * event on the ROS client. + * + * @namespace SocketAdapter + * @private + */ +declare function SocketAdapter(client: any): { + /** + * Emit a 'connection' event on WebSocket connection. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onopen: (event: Function) => void; + /** + * Emit a 'close' event on WebSocket disconnection. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onclose: (event: Function) => void; + /** + * Emit an 'error' event whenever there was an error. + * + * @param {function} event - The argument to emit with the event. + * @memberof SocketAdapter + */ + onerror: (event: Function) => void; + /** + * Parse message responses from rosbridge and send to the appropriate + * topic, service, or param. + * + * @param {Object} data - The raw JSON message from rosbridge. + * @memberof SocketAdapter + */ + onmessage: (data: any) => void; +}; diff --git a/build/core/Topic.d.ts b/build/core/Topic.d.ts new file mode 100644 index 000000000..846ec0d37 --- /dev/null +++ b/build/core/Topic.d.ts @@ -0,0 +1,88 @@ +export = Topic; +/** + * Publish and/or subscribe to a topic in ROS. + * + * Emits the following events: + * * 'warning' - If there are any warning during the Topic creation. + * * 'message' - The message data from rosbridge. + */ +declare class Topic extends EventEmitter2 { + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The topic name, like '/cmd_vel'. + * @param {string} options.messageType - The message type, like 'std_msgs/String'. + * @param {string} [options.compression=none] - The type of compression to use, like 'png', 'cbor', or 'cbor-raw'. + * @param {number} [options.throttle_rate=0] - The rate (in ms in between messages) at which to throttle the topics. + * @param {number} [options.queue_size=100] - The queue created at bridge side for re-publishing webtopics. + * @param {boolean} [options.latch=false] - Latch the topic when publishing. + * @param {number} [options.queue_length=0] - The queue length at bridge side used when subscribing. + * @param {boolean} [options.reconnect_on_close=true] - The flag to enable resubscription and readvertisement on close event. + */ + constructor(options: { + ros: Ros; + name: string; + messageType: string; + compression?: string | undefined; + throttle_rate?: number | undefined; + queue_size?: number | undefined; + latch?: boolean | undefined; + queue_length?: number | undefined; + reconnect_on_close?: boolean | undefined; + }); + ros: Ros; + name: string; + messageType: string; + isAdvertised: boolean; + compression: string; + throttle_rate: number; + latch: boolean; + queue_size: number; + queue_length: number; + reconnect_on_close: boolean; + waitForReconnect: any; + reconnectFunc: any; + callForSubscribeAndAdvertise: (message: any) => void; + _messageCallback: (data: any) => void; + /** + * @callback subscribeCallback + * @param {Object} message - The published message. + */ + /** + * Every time a message is published for the given topic, the callback + * will be called with the message object. + * + * @param {subscribeCallback} callback - Function with the following params: + */ + subscribe(callback: (message: any) => any): void; + subscribeId: string | null | undefined; + /** + * Unregister as a subscriber for the topic. Unsubscribing will stop + * and remove all subscribe callbacks. To remove a callback, you must + * explicitly pass the callback function in. + * + * @param {import('eventemitter2').ListenerFn} [callback] - The callback to unregister, if + * provided and other listeners are registered the topic won't + * unsubscribe, just stop emitting to the passed listener. + */ + unsubscribe(callback?: import("eventemitter2").ListenerFn | undefined): void; + /** + * Register as a publisher for the topic. + */ + advertise(): void; + advertiseId: string | undefined; + /** + * Unregister as a publisher for the topic. + */ + unadvertise(): void; + /** + * Publish the message. + * + * @param {Message} message - A ROSLIB.Message object. + */ + publish(message: Message): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); +import Message = require("./Message"); diff --git a/build/core/index.d.ts b/build/core/index.d.ts new file mode 100644 index 000000000..6b984016c --- /dev/null +++ b/build/core/index.d.ts @@ -0,0 +1,7 @@ +export const Ros: typeof import("./Ros"); +export const Topic: typeof import("./Topic"); +export const Message: typeof import("./Message"); +export const Param: typeof import("./Param"); +export const Service: typeof import("./Service"); +export const ServiceRequest: typeof import("./ServiceRequest"); +export const ServiceResponse: typeof import("./ServiceResponse"); diff --git a/build/math/Pose.d.ts b/build/math/Pose.d.ts new file mode 100644 index 000000000..163b944ec --- /dev/null +++ b/build/math/Pose.d.ts @@ -0,0 +1,44 @@ +export = Pose; +/** + * A Pose in 3D space. Values are copied into this object. + */ +declare class Pose { + /** + * @param {Object} [options] + * @param {Vector3} [options.position] - The ROSLIB.Vector3 describing the position. + * @param {Quaternion} [options.orientation] - The ROSLIB.Quaternion describing the orientation. + */ + constructor(options?: { + position?: Vector3 | undefined; + orientation?: Quaternion | undefined; + } | undefined); + position: Vector3; + orientation: Quaternion; + /** + * Apply a transform against this pose. + * + * @param {Transform} tf - The transform to be applied. + */ + applyTransform(tf: Transform): void; + /** + * Clone a copy of this pose. + * + * @returns {Pose} The cloned pose. + */ + clone(): Pose; + /** + * Multiply this pose with another pose without altering this pose. + * + * @returns {Pose} The result of the multiplication. + */ + multiply(pose: any): Pose; + /** + * Compute the inverse of this pose. + * + * @returns {Pose} The inverse of the pose. + */ + getInverse(): Pose; +} +import Vector3 = require("./Vector3"); +import Quaternion = require("./Quaternion"); +import Transform = require("./Transform"); diff --git a/build/math/Quaternion.d.ts b/build/math/Quaternion.d.ts new file mode 100644 index 000000000..2546581f3 --- /dev/null +++ b/build/math/Quaternion.d.ts @@ -0,0 +1,55 @@ +export = Quaternion; +/** + * @fileOverview + * @author David Gossow - dgossow@willowgarage.com + */ +/** + * A Quaternion. + */ +declare class Quaternion { + /** + * @param {Object} [options] + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + * @param {number} [options.w=1] - The w value. + */ + constructor(options?: { + x?: number | undefined; + y?: number | undefined; + z?: number | undefined; + w?: number | undefined; + } | undefined); + x: number; + y: number; + z: number; + w: number; + /** + * Perform a conjugation on this quaternion. + */ + conjugate(): void; + /** + * Return the norm of this quaternion. + */ + norm(): number; + /** + * Perform a normalization on this quaternion. + */ + normalize(): void; + /** + * Convert this quaternion into its inverse. + */ + invert(): void; + /** + * Set the values of this quaternion to the product of itself and the given quaternion. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + multiply(q: Quaternion): void; + /** + * Clone a copy of this quaternion. + * + * @returns {Quaternion} The cloned quaternion. + */ + clone(): Quaternion; +} diff --git a/build/math/Transform.d.ts b/build/math/Transform.d.ts new file mode 100644 index 000000000..f41341201 --- /dev/null +++ b/build/math/Transform.d.ts @@ -0,0 +1,25 @@ +export = Transform; +/** + * A Transform in 3-space. Values are copied into this object. + */ +declare class Transform { + /** + * @param {Object} options + * @param {Vector3} options.translation - The ROSLIB.Vector3 describing the translation. + * @param {Quaternion} options.rotation - The ROSLIB.Quaternion describing the rotation. + */ + constructor(options: { + translation: Vector3; + rotation: Quaternion; + }); + translation: Vector3; + rotation: Quaternion; + /** + * Clone a copy of this transform. + * + * @returns {Transform} The cloned transform. + */ + clone(): Transform; +} +import Vector3 = require("./Vector3"); +import Quaternion = require("./Quaternion"); diff --git a/build/math/Vector3.d.ts b/build/math/Vector3.d.ts new file mode 100644 index 000000000..72387d611 --- /dev/null +++ b/build/math/Vector3.d.ts @@ -0,0 +1,45 @@ +export = Vector3; +/** + * A 3D vector. + */ +declare class Vector3 { + /** + * @param {Object} [options] + * @param {number} [options.x=0] - The x value. + * @param {number} [options.y=0] - The y value. + * @param {number} [options.z=0] - The z value. + */ + constructor(options?: { + x?: number | undefined; + y?: number | undefined; + z?: number | undefined; + } | undefined); + x: number; + y: number; + z: number; + /** + * Set the values of this vector to the sum of itself and the given vector. + * + * @param {Vector3} v - The vector to add with. + */ + add(v: Vector3): void; + /** + * Set the values of this vector to the difference of itself and the given vector. + * + * @param {Vector3} v - The vector to subtract with. + */ + subtract(v: Vector3): void; + /** + * Multiply the given Quaternion with this vector. + * + * @param {Quaternion} q - The quaternion to multiply with. + */ + multiplyQuaternion(q: Quaternion): void; + /** + * Clone a copy of this vector. + * + * @returns {Vector3} The cloned vector. + */ + clone(): Vector3; +} +import Quaternion = require("./Quaternion"); diff --git a/build/math/index.d.ts b/build/math/index.d.ts new file mode 100644 index 000000000..abac96910 --- /dev/null +++ b/build/math/index.d.ts @@ -0,0 +1,7 @@ +declare namespace _default { + let Pose: typeof import("./Pose"); + let Quaternion: typeof import("./Quaternion"); + let Transform: typeof import("./Transform"); + let Vector3: typeof import("./Vector3"); +} +export default _default; diff --git a/build/node/RosTCP.d.ts b/build/node/RosTCP.d.ts new file mode 100644 index 000000000..d7ae5b625 --- /dev/null +++ b/build/node/RosTCP.d.ts @@ -0,0 +1,21 @@ +export = RosTCP; +/** + * Same as core Ros except supports TCP connections. + * This can also receive a socket.io instance (options.socketio) or server instance (option.http) + * to connect to the front using socket.io. + * @private + */ +declare class RosTCP extends Ros { + constructor(options: any); + encoding: any; + io: SocketIO | undefined; + /** + * Connect to a live socket. + * + * @param {string|number|Object} url - Address and port to connect to (see http://nodejs.org/api/net.html). + * Format: {host: String, port: Int} or (port:Int) or "host:port". + */ + connect(url: string | number | any): void; +} +import Ros = require("../core/Ros"); +import SocketIO = require("./SocketIO"); diff --git a/build/node/SocketIO.d.ts b/build/node/SocketIO.d.ts new file mode 100644 index 000000000..a1e6ee1da --- /dev/null +++ b/build/node/SocketIO.d.ts @@ -0,0 +1,8 @@ +export = SocketIO; +declare class SocketIO { + constructor(options: any, Ros: any); + socketio: any; + socket: any; + sendToFront(name: any, event: any): (event: any) => void; + sendToRosbridge(msg: any): void; +} diff --git a/build/node/TopicStream.d.ts b/build/node/TopicStream.d.ts new file mode 100644 index 000000000..441cc3eea --- /dev/null +++ b/build/node/TopicStream.d.ts @@ -0,0 +1,2 @@ +export = Topic; +import Topic = require("../core/Topic"); diff --git a/build/roslib.js b/build/roslib.js index a0ce21beb..cb288c7af 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19305,15 +19305,36 @@ module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; },{}],72:[function(require,module,exports){ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu */ +__exportStar(require("./core"), exports); +__exportStar(require("./actionlib"), exports); +__exportStar(require("./math"), exports); +__exportStar(require("./tf"), exports); +__exportStar(require("./urdf"), exports); /** * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. * * If you use nodejs, this is the variable you get when you require('roslib'). */ +// @ts-expect-error var ROSLIB = this.ROSLIB || { /** * @default @@ -19328,9 +19349,8 @@ assign(ROSLIB, require('./actionlib')); assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); -module.exports = ROSLIB; -},{"./actionlib":78,"./core":87,"./math":92,"./tf":95,"./urdf":107,"object-assign":31}],73:[function(require,module,exports){ +},{"./actionlib":78,"./core":87,"./math":92,"./tf":94,"./urdf":106,"object-assign":31}],73:[function(require,module,exports){ (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); @@ -19938,17 +19958,14 @@ module.exports = SimpleActionServer; },{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],78:[function(require,module,exports){ "use strict"; -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); -var action = (module.exports = { - ActionClient: require('./ActionClient'), - ActionListener: require('./ActionListener'), - Goal: require('./Goal'), - SimpleActionServer: require('./SimpleActionServer') -}); -mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); - -},{"../core/Ros":81,"../mixin":93,"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SimpleActionServer = exports.Goal = exports.ActionListener = exports.ActionClient = void 0; +exports.ActionClient = require('./ActionClient'); +exports.ActionListener = require('./ActionListener'); +exports.Goal = require('./Goal'); +exports.SimpleActionServer = require('./SimpleActionServer'); + +},{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20836,7 +20853,7 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; -},{"../util/workerSocket":110,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ +},{"../util/workerSocket":109,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21148,7 +21165,7 @@ function SocketAdapter(client) { } module.exports = SocketAdapter; -},{"../util/cborTypedArrayTags":108,"../util/decompressPng":109,"cbor-js":14}],86:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":107,"../util/decompressPng":108,"cbor-js":14}],86:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21381,19 +21398,17 @@ module.exports = Topic; },{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ "use strict"; -var mixin = require('../mixin'); -var core = (module.exports = { - Ros: require('./Ros'), - Topic: require('./Topic'), - Message: require('./Message'), - Param: require('./Param'), - Service: require('./Service'), - ServiceRequest: require('./ServiceRequest'), - ServiceResponse: require('./ServiceResponse') -}); -mixin(core.Ros, ['Param', 'Service', 'Topic'], core); - -},{"../mixin":93,"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ServiceResponse = exports.ServiceRequest = exports.Service = exports.Param = exports.Message = exports.Topic = exports.Ros = void 0; +exports.Ros = require('./Ros'); +exports.Topic = require('./Topic'); +exports.Message = require('./Message'); +exports.Param = require('./Param'); +exports.Service = require('./Service'); +exports.ServiceRequest = require('./ServiceRequest'); +exports.ServiceResponse = require('./ServiceResponse'); + +},{"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21665,7 +21680,8 @@ module.exports = Vector3; },{"./Quaternion":89}],92:[function(require,module,exports){ "use strict"; -module.exports = { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = { Pose: require('./Pose'), Quaternion: require('./Quaternion'), Transform: require('./Transform'), @@ -21674,26 +21690,6 @@ module.exports = { },{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ "use strict"; -/** - * Mixin a feature to the core/Ros prototype. - * For example, mixin(Ros, ['Topic'], {Topic: }) - * will add a topic bound to any Ros instances so a user - * can call `var topic = ros.Topic({name: '/foo'});` - * - * @author Graeme Yeates - github.com/megawac - */ -module.exports = function (Ros, classes, features) { - classes.forEach(function (className) { - var Class = features[className]; - Ros.prototype[className] = function (options) { - options.ros = this; - return new Class(options); - }; - }); -}; - -},{}],94:[function(require,module,exports){ -"use strict"; /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21931,16 +21927,13 @@ var TFClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = TFClient; -},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],95:[function(require,module,exports){ +},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],94:[function(require,module,exports){ "use strict"; -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); -var tf = (module.exports = { - TFClient: require('./TFClient') -}); -mixin(Ros, ['TFClient'], tf); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TFClient = void 0; +exports.TFClient = require('./TFClient'); -},{"../core/Ros":81,"../mixin":93,"./TFClient":94}],96:[function(require,module,exports){ +},{"./TFClient":93}],95:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21973,7 +21966,7 @@ var UrdfBox = /** @class */ (function () { }()); module.exports = UrdfBox; -},{"../math/Vector3":91,"./UrdfTypes":105}],97:[function(require,module,exports){ +},{"../math/Vector3":91,"./UrdfTypes":104}],96:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22001,7 +21994,7 @@ var UrdfColor = /** @class */ (function () { }()); module.exports = UrdfColor; -},{}],98:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22028,7 +22021,7 @@ var UrdfCylinder = /** @class */ (function () { }()); module.exports = UrdfCylinder; -},{"./UrdfTypes":105}],99:[function(require,module,exports){ +},{"./UrdfTypes":104}],98:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22117,7 +22110,7 @@ var UrdfJoint = /** @class */ (function () { }()); module.exports = UrdfJoint; -},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91}],100:[function(require,module,exports){ +},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91}],99:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22147,7 +22140,7 @@ var UrdfLink = /** @class */ (function () { }()); module.exports = UrdfLink; -},{"./UrdfVisual":106}],101:[function(require,module,exports){ +},{"./UrdfVisual":105}],100:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22192,7 +22185,7 @@ var UrdfMaterial = /** @class */ (function () { var assign = require('object-assign'); module.exports = UrdfMaterial; -},{"./UrdfColor":97,"object-assign":31}],102:[function(require,module,exports){ +},{"./UrdfColor":96,"object-assign":31}],101:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22229,7 +22222,7 @@ var UrdfMesh = /** @class */ (function () { }()); module.exports = UrdfMesh; -},{"../math/Vector3":91,"./UrdfTypes":105}],103:[function(require,module,exports){ +},{"../math/Vector3":91,"./UrdfTypes":104}],102:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22327,7 +22320,7 @@ var UrdfModel = /** @class */ (function () { }()); module.exports = UrdfModel; -},{"./UrdfJoint":99,"./UrdfLink":100,"./UrdfMaterial":101,"@xmldom/xmldom":70}],104:[function(require,module,exports){ +},{"./UrdfJoint":98,"./UrdfLink":99,"./UrdfMaterial":100,"@xmldom/xmldom":70}],103:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22351,16 +22344,16 @@ var UrdfSphere = /** @class */ (function () { }()); module.exports = UrdfSphere; -},{"./UrdfTypes":105}],105:[function(require,module,exports){ +},{"./UrdfTypes":104}],104:[function(require,module,exports){ "use strict"; -module.exports = { - URDF_SPHERE: 0, - URDF_BOX: 1, - URDF_CYLINDER: 2, - URDF_MESH: 3 -}; - -},{}],106:[function(require,module,exports){ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.URDF_MESH = exports.URDF_CYLINDER = exports.URDF_BOX = exports.URDF_SPHERE = void 0; +exports.URDF_SPHERE = 0; +exports.URDF_BOX = 1; +exports.URDF_CYLINDER = 2; +exports.URDF_MESH = 3; + +},{}],105:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22495,21 +22488,36 @@ var UrdfVisual = /** @class */ (function () { }()); module.exports = UrdfVisual; -},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":96,"./UrdfCylinder":98,"./UrdfMaterial":101,"./UrdfMesh":102,"./UrdfSphere":104}],107:[function(require,module,exports){ +},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":95,"./UrdfCylinder":97,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfSphere":103}],106:[function(require,module,exports){ "use strict"; -module.exports = require('object-assign')({ - UrdfBox: require('./UrdfBox'), - UrdfColor: require('./UrdfColor'), - UrdfCylinder: require('./UrdfCylinder'), - UrdfLink: require('./UrdfLink'), - UrdfMaterial: require('./UrdfMaterial'), - UrdfMesh: require('./UrdfMesh'), - UrdfModel: require('./UrdfModel'), - UrdfSphere: require('./UrdfSphere'), - UrdfVisual: require('./UrdfVisual') -}, require('./UrdfTypes')); - -},{"./UrdfBox":96,"./UrdfColor":97,"./UrdfCylinder":98,"./UrdfLink":100,"./UrdfMaterial":101,"./UrdfMesh":102,"./UrdfModel":103,"./UrdfSphere":104,"./UrdfTypes":105,"./UrdfVisual":106,"object-assign":31}],108:[function(require,module,exports){ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UrdfVisual = exports.UrdfSphere = exports.UrdfModel = exports.UrdfMesh = exports.UrdfMaterial = exports.UrdfLink = exports.UrdfCylinder = exports.UrdfColor = exports.UrdfBox = void 0; +exports.UrdfBox = require('./UrdfBox'); +exports.UrdfColor = require('./UrdfColor'); +exports.UrdfCylinder = require('./UrdfCylinder'); +exports.UrdfLink = require('./UrdfLink'); +exports.UrdfMaterial = require('./UrdfMaterial'); +exports.UrdfMesh = require('./UrdfMesh'); +exports.UrdfModel = require('./UrdfModel'); +exports.UrdfSphere = require('./UrdfSphere'); +exports.UrdfVisual = require('./UrdfVisual'); +__exportStar(require("./UrdfTypes"), exports); + +},{"./UrdfBox":95,"./UrdfColor":96,"./UrdfCylinder":97,"./UrdfLink":99,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfModel":102,"./UrdfSphere":103,"./UrdfTypes":104,"./UrdfVisual":105}],107:[function(require,module,exports){ 'use strict'; var UPPER32 = Math.pow(2, 32); var warnedPrecision = false; @@ -22613,7 +22621,7 @@ if (typeof module !== 'undefined' && module.exports) { module.exports = cborTypedArrayTagger; } -},{}],109:[function(require,module,exports){ +},{}],108:[function(require,module,exports){ (function (Buffer){(function (){ /** * @fileOverview @@ -22649,7 +22657,7 @@ function decompressPng(data, callback) { module.exports = decompressPng; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":11,"pngparse":43}],110:[function(require,module,exports){ +},{"buffer":11,"pngparse":43}],109:[function(require,module,exports){ "use strict"; try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now @@ -22708,7 +22716,7 @@ var WorkerSocket = /** @class */ (function () { }()); module.exports = WorkerSocket; -},{"./workerSocketImpl":111,"webworkify":68,"webworkify-webpack":67}],111:[function(require,module,exports){ +},{"./workerSocketImpl":110,"webworkify":68,"webworkify-webpack":67}],110:[function(require,module,exports){ "use strict"; var WebSocket = WebSocket || require('ws'); module.exports = function (self) { diff --git a/build/roslib.min.js b/build/roslib.min.js index d1ef0882d..92aaba896 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){x(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function x(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function A(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){x(this,e),T.nextTick(A,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw x(this),new RangeError(b);var r=y.concat(h,p);return x(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=x(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,S=2,k=3,x=4;function A(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return A(e,-5);if(666===n.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:x):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==x||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(x=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(x=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(x=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&A,!(_+(g=A>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(x=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(A+1),o=0,s=1;s<=A;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=A;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,S,k,l,x,A,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,x=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,A=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=x[3*w[0]];break;case 2:m[L++]=x[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function x(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(A,e))}function A(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs void) | undefined; + _isDisposed: boolean; + actionClient: ActionClient; + serviceClient: Service; + /** + * Process the incoming TF message and send them out using the callback + * functions. + * + * @param {Object} tf - The TF message from the server. + */ + processTFArray(tf: any): void; + /** + * Create and send a new goal (or service request) to the tf2_web_republisher + * based on the current list of TFs. + */ + updateGoal(): void; + /** + * Process the service response and subscribe to the tf republisher + * topic. + * + * @param {Object} response - The service response containing the topic name. + */ + processResponse(response: any): void; + /** + * @callback subscribeCallback + * @param {Transform} callback.transform - The transform data. + */ + /** + * Subscribe to the given TF frame. + * + * @param {string} frameID - The TF frame to subscribe to. + * @param {subscribeCallback} callback - Function with the following params: + */ + subscribe(frameID: string, callback: (transform: Transform) => any): void; + /** + * Unsubscribe from the given TF frame. + * + * @param {string} frameID - The TF frame to unsubscribe from. + * @param {function} callback - The callback function to remove. + */ + unsubscribe(frameID: string, callback: Function): void; + /** + * Unsubscribe and unadvertise all topics associated with this TFClient. + */ + dispose(): void; +} +import { EventEmitter2 } from "eventemitter2"; +import Ros = require("../core/Ros"); +import Goal = require("../actionlib/Goal"); +import Topic = require("../core/Topic.js"); +import ActionClient = require("../actionlib/ActionClient"); +import Service = require("../core/Service.js"); +import Transform = require("../math/Transform"); diff --git a/build/tf/index.d.ts b/build/tf/index.d.ts new file mode 100644 index 000000000..659f789c3 --- /dev/null +++ b/build/tf/index.d.ts @@ -0,0 +1 @@ +export const TFClient: typeof import("./TFClient"); diff --git a/build/urdf/UrdfBox.d.ts b/build/urdf/UrdfBox.d.ts new file mode 100644 index 000000000..1cd9d4692 --- /dev/null +++ b/build/urdf/UrdfBox.d.ts @@ -0,0 +1,16 @@ +export = UrdfBox; +/** + * A Box element in a URDF. + */ +declare class UrdfBox { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + dimension: Vector3; + type: number; +} +import Vector3 = require("../math/Vector3"); diff --git a/build/urdf/UrdfColor.d.ts b/build/urdf/UrdfColor.d.ts new file mode 100644 index 000000000..72be8780f --- /dev/null +++ b/build/urdf/UrdfColor.d.ts @@ -0,0 +1,22 @@ +export = UrdfColor; +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ +/** + * A Color element in a URDF. + */ +declare class UrdfColor { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + r: number; + g: number; + b: number; + a: number; +} diff --git a/build/urdf/UrdfCylinder.d.ts b/build/urdf/UrdfCylinder.d.ts new file mode 100644 index 000000000..11691cd34 --- /dev/null +++ b/build/urdf/UrdfCylinder.d.ts @@ -0,0 +1,16 @@ +export = UrdfCylinder; +/** + * A Cylinder element in a URDF. + */ +declare class UrdfCylinder { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + type: number; + length: number; + radius: number; +} diff --git a/build/urdf/UrdfJoint.d.ts b/build/urdf/UrdfJoint.d.ts new file mode 100644 index 000000000..361978416 --- /dev/null +++ b/build/urdf/UrdfJoint.d.ts @@ -0,0 +1,21 @@ +export = UrdfJoint; +/** + * A Joint element in a URDF. + */ +declare class UrdfJoint { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + name: string | null; + type: string | null; + parent: string | null | undefined; + child: string | null | undefined; + minval: number | undefined; + maxval: number | undefined; + origin: Pose; +} +import Pose = require("../math/Pose"); diff --git a/build/urdf/UrdfLink.d.ts b/build/urdf/UrdfLink.d.ts new file mode 100644 index 000000000..2248a8856 --- /dev/null +++ b/build/urdf/UrdfLink.d.ts @@ -0,0 +1,16 @@ +export = UrdfLink; +/** + * A Link element in a URDF. + */ +declare class UrdfLink { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + name: string | null; + visuals: UrdfVisual[]; +} +import UrdfVisual = require("./UrdfVisual"); diff --git a/build/urdf/UrdfMaterial.d.ts b/build/urdf/UrdfMaterial.d.ts new file mode 100644 index 000000000..6745db55c --- /dev/null +++ b/build/urdf/UrdfMaterial.d.ts @@ -0,0 +1,19 @@ +export = UrdfMaterial; +/** + * A Material element in a URDF. + */ +declare class UrdfMaterial { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + textureFilename: string | null; + color: UrdfColor | null; + name: string | null; + isLink(): boolean; + assign(obj: any): any; +} +import UrdfColor = require("./UrdfColor"); diff --git a/build/urdf/UrdfMesh.d.ts b/build/urdf/UrdfMesh.d.ts new file mode 100644 index 000000000..88069a18b --- /dev/null +++ b/build/urdf/UrdfMesh.d.ts @@ -0,0 +1,17 @@ +export = UrdfMesh; +/** + * A Mesh element in a URDF. + */ +declare class UrdfMesh { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + scale: Vector3 | null; + type: number; + filename: string | null; +} +import Vector3 = require("../math/Vector3"); diff --git a/build/urdf/UrdfModel.d.ts b/build/urdf/UrdfModel.d.ts new file mode 100644 index 000000000..fdb2d1ac6 --- /dev/null +++ b/build/urdf/UrdfModel.d.ts @@ -0,0 +1,19 @@ +export = UrdfModel; +/** + * A URDF Model can be used to parse a given URDF into the appropriate elements. + */ +declare class UrdfModel { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + * @param {string} options.string - The XML element to parse as a string. + */ + constructor(options: { + xml: Element; + string: string; + }); + materials: {}; + links: {}; + joints: {}; + name: string | null; +} diff --git a/build/urdf/UrdfSphere.d.ts b/build/urdf/UrdfSphere.d.ts new file mode 100644 index 000000000..0c5efd36e --- /dev/null +++ b/build/urdf/UrdfSphere.d.ts @@ -0,0 +1,15 @@ +export = UrdfSphere; +/** + * A Sphere element in a URDF. + */ +declare class UrdfSphere { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + type: number; + radius: number; +} diff --git a/build/urdf/UrdfTypes.d.ts b/build/urdf/UrdfTypes.d.ts new file mode 100644 index 000000000..2432ba6b9 --- /dev/null +++ b/build/urdf/UrdfTypes.d.ts @@ -0,0 +1,4 @@ +export const URDF_SPHERE: 0; +export const URDF_BOX: 1; +export const URDF_CYLINDER: 2; +export const URDF_MESH: 3; diff --git a/build/urdf/UrdfVisual.d.ts b/build/urdf/UrdfVisual.d.ts new file mode 100644 index 000000000..8e5d444e8 --- /dev/null +++ b/build/urdf/UrdfVisual.d.ts @@ -0,0 +1,23 @@ +export = UrdfVisual; +/** + * A Visual element in a URDF. + */ +declare class UrdfVisual { + /** + * @param {Object} options + * @param {Element} options.xml - The XML element to parse. + */ + constructor(options: { + xml: Element; + }); + origin: Pose; + geometry: UrdfBox | UrdfCylinder | UrdfMesh | UrdfSphere | null; + material: UrdfMaterial | null; + name: string | null; +} +import Pose = require("../math/Pose"); +import UrdfBox = require("./UrdfBox"); +import UrdfCylinder = require("./UrdfCylinder"); +import UrdfMesh = require("./UrdfMesh"); +import UrdfSphere = require("./UrdfSphere"); +import UrdfMaterial = require("./UrdfMaterial"); diff --git a/build/urdf/index.d.ts b/build/urdf/index.d.ts new file mode 100644 index 000000000..8f27d52db --- /dev/null +++ b/build/urdf/index.d.ts @@ -0,0 +1,10 @@ +export const UrdfBox: typeof import("./UrdfBox"); +export const UrdfColor: typeof import("./UrdfColor"); +export const UrdfCylinder: typeof import("./UrdfCylinder"); +export const UrdfLink: typeof import("./UrdfLink"); +export const UrdfMaterial: typeof import("./UrdfMaterial"); +export const UrdfMesh: typeof import("./UrdfMesh"); +export const UrdfModel: typeof import("./UrdfModel"); +export const UrdfSphere: typeof import("./UrdfSphere"); +export const UrdfVisual: typeof import("./UrdfVisual"); +export * from "./UrdfTypes"; diff --git a/build/util/cborTypedArrayTags.d.ts b/build/util/cborTypedArrayTags.d.ts new file mode 100644 index 000000000..9173ddb0a --- /dev/null +++ b/build/util/cborTypedArrayTags.d.ts @@ -0,0 +1,7 @@ +export = cborTypedArrayTagger; +/** + * Handle CBOR typed array tags during decoding. + * @param {Uint8Array} data + * @param {Number} tag + */ +declare function cborTypedArrayTagger(data: Uint8Array, tag: number): any; diff --git a/build/util/decompressPng.d.ts b/build/util/decompressPng.d.ts new file mode 100644 index 000000000..bb5e03f45 --- /dev/null +++ b/build/util/decompressPng.d.ts @@ -0,0 +1,19 @@ +export = decompressPng; +/** + * @callback decompressPngCallback + * @param data - The uncompressed data. + */ +/** + * If a message was compressed as a PNG image (a compression hack since + * gzipping over WebSockets * is not supported yet), this function decodes + * the "image" as a Base64 string. + * + * @private + * @param data - An object containing the PNG data. + * @param {decompressPngCallback} callback - Function with the following params: + */ +declare function decompressPng(data: any, callback: decompressPngCallback): void; +declare namespace decompressPng { + export { decompressPngCallback }; +} +type decompressPngCallback = (data: any) => any; diff --git a/build/util/shim/@xmldom/xmldom.d.ts b/build/util/shim/@xmldom/xmldom.d.ts new file mode 100644 index 000000000..574ff0571 --- /dev/null +++ b/build/util/shim/@xmldom/xmldom.d.ts @@ -0,0 +1 @@ +export { DOMImplementation, XMLSerializer, DOMParser }; diff --git a/build/util/shim/WebSocket.d.ts b/build/util/shim/WebSocket.d.ts new file mode 100644 index 000000000..b78d1c06c --- /dev/null +++ b/build/util/shim/WebSocket.d.ts @@ -0,0 +1,9 @@ +declare const _exports: { + new (url: string | URL, protocols?: string | string[] | undefined): WebSocket; + prototype: WebSocket; + readonly CONNECTING: 0; + readonly OPEN: 1; + readonly CLOSING: 2; + readonly CLOSED: 3; +}; +export = _exports; diff --git a/build/util/shim/canvas.d.ts b/build/util/shim/canvas.d.ts new file mode 100644 index 000000000..879f160e9 --- /dev/null +++ b/build/util/shim/canvas.d.ts @@ -0,0 +1,2 @@ +declare function _exports(): HTMLCanvasElement; +export = _exports; diff --git a/build/util/shim/decompressPng.d.ts b/build/util/shim/decompressPng.d.ts new file mode 100644 index 000000000..76aa9fadc --- /dev/null +++ b/build/util/shim/decompressPng.d.ts @@ -0,0 +1,19 @@ +export = decompressPng; +/** + * @callback decompressPngCallback + * @param data - The uncompressed data. + */ +/** + * If a message was compressed as a PNG image (a compression hack since + * gzipping over WebSockets * is not supported yet), this function places the + * "image" in a canvas element then decodes the * "image" as a Base64 string. + * + * @private + * @param data - An object containing the PNG data. + * @param {decompressPngCallback} callback - Function with the following params: + */ +declare function decompressPng(data: any, callback: decompressPngCallback): void; +declare namespace decompressPng { + export { decompressPngCallback }; +} +type decompressPngCallback = (data: any) => any; diff --git a/build/util/workerSocket.d.ts b/build/util/workerSocket.d.ts new file mode 100644 index 000000000..6a4b21b44 --- /dev/null +++ b/build/util/workerSocket.d.ts @@ -0,0 +1,12 @@ +export = WorkerSocket; +declare class WorkerSocket { + constructor(uri: any); + onclose: any; + onerror: any; + onopen: any; + onmessage: any; + socket_: any; + handleWorkerMessage_(ev: any): void; + send(data: any): void; + close(): void; +} diff --git a/build/util/workerSocketImpl.d.ts b/build/util/workerSocketImpl.d.ts new file mode 100644 index 000000000..ee9b3d423 --- /dev/null +++ b/build/util/workerSocketImpl.d.ts @@ -0,0 +1,2 @@ +declare function _exports(self: any): void; +export = _exports; diff --git a/package-lock.json b/package-lock.json index 417c5d5d0..b91c8b081 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "grunt-browserify": "^6.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^2.0.0", + "grunt-contrib-copy": "^1.0.0", "grunt-contrib-jshint": "^3.0.0", "grunt-contrib-uglify": "^5.0.0", "grunt-contrib-watch": "^1.0.0", @@ -2317,6 +2318,12 @@ "node": ">=0.8.0" } }, + "node_modules/file-sync-cmp": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", + "integrity": "sha512-0k45oWBokCqh2MOexeYKpyqmGKG+8mQ2Wd8iawx+uWd/weWJQAZ6SoPybagdCI4xFisag8iAR77WPm4h3pTfxA==", + "dev": true + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2869,6 +2876,83 @@ "rimraf": "bin.js" } }, + "node_modules/grunt-contrib-copy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", + "integrity": "sha512-gFRFUB0ZbLcjKb67Magz1yOHGBkyU6uL29hiEW1tdQ9gQt72NuMKIy/kS6dsCbV0cZ0maNCb0s6y+uT1FKU7jA==", + "dev": true, + "dependencies": { + "chalk": "^1.1.1", + "file-sync-cmp": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt-contrib-copy/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/grunt-contrib-jshint": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-3.2.0.tgz", @@ -9271,6 +9355,12 @@ } } }, + "file-sync-cmp": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", + "integrity": "sha512-0k45oWBokCqh2MOexeYKpyqmGKG+8mQ2Wd8iawx+uWd/weWJQAZ6SoPybagdCI4xFisag8iAR77WPm4h3pTfxA==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -9744,6 +9834,64 @@ } } }, + "grunt-contrib-copy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", + "integrity": "sha512-gFRFUB0ZbLcjKb67Magz1yOHGBkyU6uL29hiEW1tdQ9gQt72NuMKIy/kS6dsCbV0cZ0maNCb0s6y+uT1FKU7jA==", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "file-sync-cmp": "^0.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true + } + } + }, "grunt-contrib-jshint": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-3.2.0.tgz", diff --git a/package.json b/package.json index f9ddfa22b..278bbeab1 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "grunt-browserify": "^6.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^2.0.0", + "grunt-contrib-copy": "^1.0.0", "grunt-contrib-jshint": "^3.0.0", "grunt-contrib-uglify": "^5.0.0", "grunt-contrib-watch": "^1.0.0", @@ -77,5 +78,6 @@ "roslibjs", "robot" ], + "types": "build/RosLib.d.ts", "author": "Robot Webtools Team (https://robotwebtools.github.io)" } diff --git a/src/RosLib.js b/src/RosLib.js index 26edb8e7e..66ebdca8c 100644 --- a/src/RosLib.js +++ b/src/RosLib.js @@ -2,12 +2,18 @@ * @fileOverview * @author Russell Toris - rctoris@wpi.edu */ +export * from './core'; +export * from './actionlib'; +export * from './math'; +export * from './tf'; +export * from './urdf'; /** * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. * * If you use nodejs, this is the variable you get when you require('roslib'). */ +// @ts-expect-error -- global browser-only shenanigans var ROSLIB = this.ROSLIB || { /** * @default @@ -28,5 +34,3 @@ assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); - -module.exports = ROSLIB; diff --git a/src/actionlib/index.js b/src/actionlib/index.js index a9dd8bbce..06a8135b2 100644 --- a/src/actionlib/index.js +++ b/src/actionlib/index.js @@ -1,11 +1,4 @@ -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); - -var action = (module.exports = { - ActionClient: require('./ActionClient'), - ActionListener: require('./ActionListener'), - Goal: require('./Goal'), - SimpleActionServer: require('./SimpleActionServer') -}); - -mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); +export const ActionClient = require('./ActionClient'); +export const ActionListener = require('./ActionListener'); +export const Goal = require('./Goal'); +export const SimpleActionServer = require('./SimpleActionServer'); diff --git a/src/core/index.js b/src/core/index.js index 38d337621..13ab113c4 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -1,13 +1,7 @@ -var mixin = require('../mixin'); - -var core = (module.exports = { - Ros: require('./Ros'), - Topic: require('./Topic'), - Message: require('./Message'), - Param: require('./Param'), - Service: require('./Service'), - ServiceRequest: require('./ServiceRequest'), - ServiceResponse: require('./ServiceResponse') -}); - -mixin(core.Ros, ['Param', 'Service', 'Topic'], core); +export const Ros = require('./Ros'); +export const Topic = require('./Topic'); +export const Message = require('./Message'); +export const Param = require('./Param'); +export const Service = require('./Service'); +export const ServiceRequest = require('./ServiceRequest'); +export const ServiceResponse = require('./ServiceResponse'); diff --git a/src/math/index.js b/src/math/index.js index a7934aa27..68f80bf76 100644 --- a/src/math/index.js +++ b/src/math/index.js @@ -1,4 +1,4 @@ -module.exports = { +export default { Pose: require('./Pose'), Quaternion: require('./Quaternion'), Transform: require('./Transform'), diff --git a/src/mixin.js b/src/mixin.js deleted file mode 100644 index d2b2640ff..000000000 --- a/src/mixin.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Mixin a feature to the core/Ros prototype. - * For example, mixin(Ros, ['Topic'], {Topic: }) - * will add a topic bound to any Ros instances so a user - * can call `var topic = ros.Topic({name: '/foo'});` - * - * @author Graeme Yeates - github.com/megawac - */ -module.exports = function (Ros, classes, features) { - classes.forEach(function (className) { - var Class = features[className]; - Ros.prototype[className] = function (options) { - options.ros = this; - return new Class(options); - }; - }); -}; diff --git a/src/tf/index.js b/src/tf/index.js index 5d40cf09d..8cf2b03b1 100644 --- a/src/tf/index.js +++ b/src/tf/index.js @@ -1,8 +1 @@ -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); - -var tf = (module.exports = { - TFClient: require('./TFClient') -}); - -mixin(Ros, ['TFClient'], tf); +export const TFClient = require('./TFClient'); diff --git a/src/urdf/UrdfTypes.js b/src/urdf/UrdfTypes.js index f9d4c4f8b..972d8283a 100644 --- a/src/urdf/UrdfTypes.js +++ b/src/urdf/UrdfTypes.js @@ -1,6 +1,4 @@ -module.exports = { - URDF_SPHERE: 0, - URDF_BOX: 1, - URDF_CYLINDER: 2, - URDF_MESH: 3 -}; +export const URDF_SPHERE = 0; +export const URDF_BOX = 1; +export const URDF_CYLINDER = 2; +export const URDF_MESH = 3; diff --git a/src/urdf/index.js b/src/urdf/index.js index 9687feb8b..a87cb426c 100644 --- a/src/urdf/index.js +++ b/src/urdf/index.js @@ -1,14 +1,10 @@ -module.exports = require('object-assign')( - { - UrdfBox: require('./UrdfBox'), - UrdfColor: require('./UrdfColor'), - UrdfCylinder: require('./UrdfCylinder'), - UrdfLink: require('./UrdfLink'), - UrdfMaterial: require('./UrdfMaterial'), - UrdfMesh: require('./UrdfMesh'), - UrdfModel: require('./UrdfModel'), - UrdfSphere: require('./UrdfSphere'), - UrdfVisual: require('./UrdfVisual') - }, - require('./UrdfTypes') -); +export const UrdfBox = require('./UrdfBox'); +export const UrdfColor = require('./UrdfColor'); +export const UrdfCylinder = require('./UrdfCylinder'); +export const UrdfLink = require('./UrdfLink'); +export const UrdfMaterial = require('./UrdfMaterial'); +export const UrdfMesh = require('./UrdfMesh'); +export const UrdfModel = require('./UrdfModel'); +export const UrdfSphere = require('./UrdfSphere'); +export const UrdfVisual = require('./UrdfVisual'); +export * from './UrdfTypes'; diff --git a/tsconfig.json b/tsconfig.json index ea90ddba8..24318a917 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -49,7 +49,7 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ From c24bc28ec0b636582a4dabbed2b11d88d48d44a2 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 09:37:41 -0700 Subject: [PATCH 30/66] fix math index --- src/math/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/math/index.js b/src/math/index.js index 68f80bf76..119b70ff1 100644 --- a/src/math/index.js +++ b/src/math/index.js @@ -1,6 +1,4 @@ -export default { - Pose: require('./Pose'), - Quaternion: require('./Quaternion'), - Transform: require('./Transform'), - Vector3: require('./Vector3') -}; +export const Pose = require('./Pose'); +export const Quaternion = require('./Quaternion'); +export const Transform = require('./Transform'); +export const Vector3 = require('./Vector3'); From 9d9b54becd65a3dcba1b4460917388d3e96204b0 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 09:41:44 -0700 Subject: [PATCH 31/66] more type fixes --- build/RosLibNode.d.ts | 9 +++++++-- build/math/index.d.ts | 11 ++++------- build/roslib.js | 13 ++++++------- src/RosLibNode.js | 13 ++++++++----- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/build/RosLibNode.d.ts b/build/RosLibNode.d.ts index 1cce63507..3a3fdbe08 100644 --- a/build/RosLibNode.d.ts +++ b/build/RosLibNode.d.ts @@ -1,2 +1,7 @@ -declare const _exports: any; -export = _exports; +export * from "./core"; +export * from "./actionlib"; +export * from "./math"; +export * from "./tf"; +export * from "./urdf"; +export const Ros: typeof import("./node/RosTCP"); +export const Topic: typeof import("./core/Topic"); diff --git a/build/math/index.d.ts b/build/math/index.d.ts index abac96910..78fb6c552 100644 --- a/build/math/index.d.ts +++ b/build/math/index.d.ts @@ -1,7 +1,4 @@ -declare namespace _default { - let Pose: typeof import("./Pose"); - let Quaternion: typeof import("./Quaternion"); - let Transform: typeof import("./Transform"); - let Vector3: typeof import("./Vector3"); -} -export default _default; +export const Pose: typeof import("./Pose"); +export const Quaternion: typeof import("./Quaternion"); +export const Transform: typeof import("./Transform"); +export const Vector3: typeof import("./Vector3"); diff --git a/build/roslib.js b/build/roslib.js index cb288c7af..d5b81cd6f 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19334,7 +19334,7 @@ __exportStar(require("./urdf"), exports); * * If you use nodejs, this is the variable you get when you require('roslib'). */ -// @ts-expect-error +// @ts-expect-error -- global browser-only shenanigans var ROSLIB = this.ROSLIB || { /** * @default @@ -21681,12 +21681,11 @@ module.exports = Vector3; },{"./Quaternion":89}],92:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - Pose: require('./Pose'), - Quaternion: require('./Quaternion'), - Transform: require('./Transform'), - Vector3: require('./Vector3') -}; +exports.Vector3 = exports.Transform = exports.Quaternion = exports.Pose = void 0; +exports.Pose = require('./Pose'); +exports.Quaternion = require('./Quaternion'); +exports.Transform = require('./Transform'); +exports.Vector3 = require('./Vector3'); },{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ "use strict"; diff --git a/src/RosLibNode.js b/src/RosLibNode.js index 8a622a4d2..03bcc3d21 100644 --- a/src/RosLibNode.js +++ b/src/RosLibNode.js @@ -1,9 +1,12 @@ /** * @fileOverview ROSLIB Node exclusive extensions */ -var assign = require('object-assign'); -module.exports = assign(require('./RosLib'), { - Ros: require('./node/RosTCP.js'), - Topic: require('./node/TopicStream') -}); +export * from './core'; +export * from './actionlib'; +export * from './math'; +export * from './tf'; +export * from './urdf'; + +export const Ros = require('./node/RosTCP'); +export const Topic = require('./node/TopicStream'); From 2eb4a9885b281f9a1ec397962ebfc003197a97e0 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 09:43:11 -0700 Subject: [PATCH 32/66] quaternion type fix --- build/math/Quaternion.d.ts | 16 ++++++++-------- build/roslib.js | 8 ++++---- build/roslib.min.js | 2 +- src/math/Quaternion.js | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/math/Quaternion.d.ts b/build/math/Quaternion.d.ts index 2546581f3..17968fa4b 100644 --- a/build/math/Quaternion.d.ts +++ b/build/math/Quaternion.d.ts @@ -9,16 +9,16 @@ export = Quaternion; declare class Quaternion { /** * @param {Object} [options] - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. - * @param {number} [options.w=1] - The w value. + * @param {number|null} [options.x=0] - The x value. + * @param {number|null} [options.y=0] - The y value. + * @param {number|null} [options.z=0] - The z value. + * @param {number|null} [options.w=1] - The w value. */ constructor(options?: { - x?: number | undefined; - y?: number | undefined; - z?: number | undefined; - w?: number | undefined; + x?: number | null | undefined; + y?: number | null | undefined; + z?: number | null | undefined; + w?: number | null | undefined; } | undefined); x: number; y: number; diff --git a/build/roslib.js b/build/roslib.js index d5b81cd6f..441afa170 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -21496,10 +21496,10 @@ module.exports = Pose; var Quaternion = /** @class */ (function () { /** * @param {Object} [options] - * @param {number} [options.x=0] - The x value. - * @param {number} [options.y=0] - The y value. - * @param {number} [options.z=0] - The z value. - * @param {number} [options.w=1] - The w value. + * @param {number|null} [options.x=0] - The x value. + * @param {number|null} [options.y=0] - The y value. + * @param {number|null} [options.z=0] - The z value. + * @param {number|null} [options.w=1] - The w value. */ function Quaternion(options) { options = options || {}; diff --git a/build/roslib.min.js b/build/roslib.min.js index 92aaba896..bd6bdb909 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Mon, 27 Nov 2023 09:45:28 -0700 Subject: [PATCH 33/66] fix this type AGAIN --- build/core/Ros.d.ts | 6 +++--- build/roslib.js | 2 +- src/core/Ros.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/core/Ros.d.ts b/build/core/Ros.d.ts index ac0c6d91c..b703d9f0c 100644 --- a/build/core/Ros.d.ts +++ b/build/core/Ros.d.ts @@ -11,18 +11,18 @@ export = Ros; */ declare class Ros extends EventEmitter2 { /** - * @param {Object} options + * @param {Object} [options] * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. * @param {Object} [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection. */ - constructor(options: { + constructor(options?: { url?: string | undefined; groovyCompatibility?: boolean | undefined; transportLibrary?: string | undefined; transportOptions?: any; - }); + } | undefined); socket: any; idCounter: number; isConnected: boolean; diff --git a/build/roslib.js b/build/roslib.js index 441afa170..3b7840fab 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20115,7 +20115,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Ros = /** @class */ (function (_super) { __extends(Ros, _super); /** - * @param {Object} options + * @param {Object} [options] * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. diff --git a/src/core/Ros.js b/src/core/Ros.js index e3264a5f3..78a58e803 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -25,7 +25,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; */ class Ros extends EventEmitter2 { /** - * @param {Object} options + * @param {Object} [options] * @param {string} [options.url] - The WebSocket URL for rosbridge or the node server URL to connect using socket.io (if socket.io exists in the page). Can be specified later with `connect`. * @param {boolean} [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools. * @param {string} [options.transportLibrary=websocket] - One of 'websocket', 'workersocket', 'socket.io' or RTCPeerConnection instance controlling how the connection is created in `connect`. From d6072639f5c9897baad07bb26aa18ba38b63bebb Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 09:49:53 -0700 Subject: [PATCH 34/66] fix typescript issues in tests --- Gruntfile.js | 3 +- build/roslib.js | 7 +- build/roslib.min.js | 2 +- build/urdf/UrdfModel.d.ts | 8 +- package-lock.json | 307 ++++++++++++++++++++++++++++++++++++++ package.json | 2 + src/urdf/UrdfModel.js | 7 +- test/ros.test.js | 6 +- test/tfclient.test.js | 9 +- test/transform.test.js | 4 +- 10 files changed, 338 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index de9c3d74c..938edd584 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -59,7 +59,8 @@ module.exports = function(grunt) { mochaTest: { options: { reporter: 'spec', - timeout: 5000 + timeout: 5000, + require: 'ts-node/register' }, test: { src: ['./test/*.test.js'] diff --git a/build/roslib.js b/build/roslib.js index 3b7840fab..ff7a38409 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -22240,8 +22240,8 @@ var XPATH_FIRST_ORDERED_NODE_TYPE = 9; var UrdfModel = /** @class */ (function () { /** * @param {Object} options - * @param {Element} options.xml - The XML element to parse. - * @param {string} options.string - The XML element to parse as a string. + * @param {Element} [options.xml] - The XML element to parse. + * @param {string} [options.string] - The XML element to parse as a string. */ function UrdfModel(options) { var xmlDoc = options.xml; @@ -22255,6 +22255,9 @@ var UrdfModel = /** @class */ (function () { var parser = new DOMParser(); xmlDoc = parser.parseFromString(string, 'text/xml').documentElement; } + if (!xmlDoc) { + throw new Error('No URDF document parsed!'); + } // Initialize the model with the given XML node. // Get the robot tag var robotXml = xmlDoc; diff --git a/build/roslib.min.js b/build/roslib.min.js index bd6bdb909..219f624c4 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@puppeteer/browsers": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.8.0.tgz", @@ -343,6 +382,30 @@ "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "node_modules/@types/cookie": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", @@ -384,6 +447,12 @@ "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", "dev": true }, + "node_modules/@types/mocha": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", + "dev": true + }, "node_modules/@types/node": { "version": "17.0.26", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.26.tgz", @@ -538,6 +607,12 @@ "node": ">= 8" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -1518,6 +1593,12 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-fetch": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", @@ -4575,6 +4656,12 @@ "node": ">=12" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -6938,6 +7025,79 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", + "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -7190,6 +7350,12 @@ "node": ">= 0.4.0" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -7494,6 +7660,15 @@ "fd-slicer": "~1.1.0" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -7663,6 +7838,37 @@ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "dev": true }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "@puppeteer/browsers": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.8.0.tgz", @@ -7738,6 +7944,30 @@ "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true }, + "@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "@types/cookie": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", @@ -7779,6 +8009,12 @@ "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", "dev": true }, + "@types/mocha": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", + "dev": true + }, "@types/node": { "version": "17.0.26", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.26.tgz", @@ -7894,6 +8130,12 @@ "picomatch": "^2.0.4" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -8713,6 +8955,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-fetch": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", @@ -11059,6 +11307,12 @@ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -12893,6 +13147,47 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, + "ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "dev": true + }, + "acorn-walk": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", + "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -13090,6 +13385,12 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", "dev": true }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -13322,6 +13623,12 @@ "fd-slicer": "~1.1.0" } }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 278bbeab1..a16307585 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "./src/util/decompressPng.js": "./src/util/shim/decompressPng.js" }, "devDependencies": { + "@types/mocha": "^10.0.6", "chai": "*", "grunt": "^1.0.0", "grunt-browserify": "^6.0.0", @@ -35,6 +36,7 @@ "mocha": "^10.0.0", "puppeteer": "^21.0.1", "time-grunt": "^2.0.0", + "ts-node": "^10.9.1", "typescript": "^5.2.2" }, "dependencies": { diff --git a/src/urdf/UrdfModel.js b/src/urdf/UrdfModel.js index d05be328a..3ecdc3713 100644 --- a/src/urdf/UrdfModel.js +++ b/src/urdf/UrdfModel.js @@ -18,8 +18,8 @@ var XPATH_FIRST_ORDERED_NODE_TYPE = 9; class UrdfModel { /** * @param {Object} options - * @param {Element} options.xml - The XML element to parse. - * @param {string} options.string - The XML element to parse as a string. + * @param {Element} [options.xml] - The XML element to parse. + * @param {string} [options.string] - The XML element to parse as a string. */ constructor(options) { var xmlDoc = options.xml; @@ -34,6 +34,9 @@ class UrdfModel { var parser = new DOMParser(); xmlDoc = parser.parseFromString(string, 'text/xml').documentElement; } + if (!xmlDoc) { + throw new Error('No URDF document parsed!'); + } // Initialize the model with the given XML node. // Get the robot tag diff --git a/test/ros.test.js b/test/ros.test.js index a4a7bf29a..1f90e85ea 100644 --- a/test/ros.test.js +++ b/test/ros.test.js @@ -13,9 +13,11 @@ describe('ROS', function() { var callCount = 50; var eventEmitter = new EventEmitter2(); for (var i = 0; i < callCount; i++) { - eventEmitter.on('foo', function() { }); + eventEmitter.on('foo', function () {}); } + // @ts-expect-error -- hidden property expect(eventEmitter._events['foo']).to.have.length(callCount); + // @ts-expect-error -- hidden property expect(eventEmitter._events['foo']).to.have.property('warned'); // The next part of this test shows that the 'warn' property is not set @@ -24,7 +26,9 @@ describe('ROS', function() { for (var i = 0; i < callCount; i++) { ros.callOnConnection({}); } + // @ts-expect-error -- hidden property expect(ros._events['connection']).to.have.length(callCount); + // @ts-expect-error -- hidden property expect(ros._events['connection']).to.not.have.property('warned'); }); }); diff --git a/test/tfclient.test.js b/test/tfclient.test.js index 79b63c251..0da77750a 100644 --- a/test/tfclient.test.js +++ b/test/tfclient.test.js @@ -6,7 +6,7 @@ describe('TFClient', function() { describe('dispose', function() { it('should not subscribe to republished topic if already disposed', function() { - // This test makes sure we do not subscribe to the republished topic if the + // This test makes sure we do not subscribe to the republished topic if the // tf client has already been disposed when we get the response (from the setup request) // from the server. @@ -15,13 +15,14 @@ describe('TFClient', function() { on: () => {}, off: () => {}, callOnConnection: () => {} - } + }; - var tfclient = new ROSLIB.TFClient({ros: dummyROS}); + // @ts-expect-error -- stub impl + var tfclient = new ROSLIB.TFClient({ ros: dummyROS }); tfclient.dispose(); // Simulated a response from the server after the client is already disposed - tfclient.processResponse({topic_name: "/repub_1"}); + tfclient.processResponse({ topic_name: '/repub_1' }); expect(tfclient.currentTopic).to.be.false; }); diff --git a/test/transform.test.js b/test/transform.test.js index 25af82456..c6de2530e 100644 --- a/test/transform.test.js +++ b/test/transform.test.js @@ -11,8 +11,8 @@ describe('Transform', function() { // }); it('should contain a valid vector and quaternion', function() { var t = new ROSLIB.Transform({ - translation: { x: 1, y: 2, z: 3 }, - rotation: { x: 0.9, y: 0.8, z: 0.7, w: 1 } + translation: new ROSLIB.Vector3({ x: 1, y: 2, z: 3 }), + rotation: new ROSLIB.Quaternion({ x: 0.9, y: 0.8, z: 0.7, w: 1 }) }); // expect(t.translation).to.be.a('ROSLIB.Vector3'); expect(t.translation.x).to.equal(1); From 900ccf1b2398661cde359a0c8087a00568600c0c Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 10:22:15 -0700 Subject: [PATCH 35/66] preserve mixin API without using mixin --- build/core/Param.d.ts | 4 ++-- build/core/Ros.d.ts | 9 +++++++++ build/core/Service.d.ts | 4 ++-- build/roslib.js | 39 ++++++++++++++++++++++++++++++++++++--- build/roslib.min.js | 2 +- src/core/Param.js | 2 +- src/core/Ros.js | 22 ++++++++++++++++++++++ src/core/Service.js | 2 +- 8 files changed, 74 insertions(+), 10 deletions(-) diff --git a/build/core/Param.d.ts b/build/core/Param.d.ts index e440dab9c..58b942907 100644 --- a/build/core/Param.d.ts +++ b/build/core/Param.d.ts @@ -36,9 +36,9 @@ declare class Param { * Set the value of the param in ROS. * * @param {Object} value - The value to set param to. - * @param {setParamCallback} callback - The callback function. + * @param {setParamCallback} [callback] - The callback function. */ - set(value: any, callback: (response: any) => any): void; + set(value: any, callback?: ((response: any) => any) | undefined): void; /** * Delete this parameter on the ROS server. * diff --git a/build/core/Ros.d.ts b/build/core/Ros.d.ts index b703d9f0c..7086b2d32 100644 --- a/build/core/Ros.d.ts +++ b/build/core/Ros.d.ts @@ -335,6 +335,15 @@ declare class Ros extends EventEmitter2 { types: string[]; typedefs_full_text: string[]; }) => any, failedCallback?: ((error: string) => any) | undefined): void; + Topic(options: any): Topic; + Param(options: any): Param; + Service(options: any): Service; + TFClient(options: any): import("../tf/TFClient"); + ActionClient(options: any): import("../actionlib/ActionClient"); + SimpleActionServer(options: any): import("../actionlib/SimpleActionServer"); } import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Topic = require("./Topic"); +import Param = require("./Param"); +import Service = require("./Service"); diff --git a/build/core/Service.d.ts b/build/core/Service.d.ts index 9fe265d93..51513a8bd 100644 --- a/build/core/Service.d.ts +++ b/build/core/Service.d.ts @@ -32,10 +32,10 @@ declare class Service extends EventEmitter2 { * callback. Does nothing if this service is currently advertised. * * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. - * @param {callServiceCallback} callback - Function with the following params: + * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ - callService(request: ServiceRequest, callback: (response: any) => any, failedCallback?: ((error: string) => any) | undefined): void; + callService(request: ServiceRequest, callback?: ((response: any) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback advertiseCallback * @param {ServiceRequest} request - The service request. diff --git a/build/roslib.js b/build/roslib.js index ff7a38409..fad590880 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20040,7 +20040,7 @@ var Param = /** @class */ (function () { * Set the value of the param in ROS. * * @param {Object} value - The value to set param to. - * @param {setParamCallback} callback - The callback function. + * @param {setParamCallback} [callback] - The callback function. */ Param.prototype.set = function (value, callback) { var paramClient = new Service({ @@ -20095,12 +20095,27 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; var WebSocket = require('ws'); var WorkerSocket = require('../util/workerSocket'); var socketAdapter = require('./SocketAdapter.js'); var Service = require('./Service'); var ServiceRequest = require('./ServiceRequest'); var assign = require('object-assign'); +var Topic = require('./Topic'); +var Param = require('./Param'); +var TFClient = require('../tf').TFClient; +var _a = require('../actionlib'), ActionClient = _a.ActionClient, SimpleActionServer = _a.SimpleActionServer; var EventEmitter2 = require('eventemitter2').EventEmitter2; /** * Manages connection to the server and all interactions with ROS. @@ -20849,11 +20864,29 @@ var Ros = /** @class */ (function (_super) { }); } }; + Ros.prototype.Topic = function (options) { + return new Topic(__assign({ ros: this }, options)); + }; + Ros.prototype.Param = function (options) { + return new Param(__assign({ ros: this }, options)); + }; + Ros.prototype.Service = function (options) { + return new Service(__assign({ ros: this }, options)); + }; + Ros.prototype.TFClient = function (options) { + return new TFClient(__assign({ ros: this }, options)); + }; + Ros.prototype.ActionClient = function (options) { + return new ActionClient(__assign({ ros: this }, options)); + }; + Ros.prototype.SimpleActionServer = function (options) { + return new SimpleActionServer(__assign({ ros: this }, options)); + }; return Ros; }(EventEmitter2)); module.exports = Ros; -},{"../util/workerSocket":109,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ +},{"../actionlib":78,"../tf":94,"../util/workerSocket":109,"./Param":80,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"./Topic":86,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20911,7 +20944,7 @@ var Service = /** @class */ (function (_super) { * callback. Does nothing if this service is currently advertised. * * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. - * @param {callServiceCallback} callback - Function with the following params: + * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ Service.prototype.callService = function (request, callback, failedCallback) { diff --git a/build/roslib.min.js b/build/roslib.min.js index 219f624c4..114ae382e 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":b=b||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Mon, 27 Nov 2023 10:37:38 -0700 Subject: [PATCH 36/66] possibly fix topic stream type issues? --- build/RosLibNode.d.ts | 4 +- build/node/TopicStream.d.ts | 21 +++++- src/node/TopicStream.js | 85 +++++++++++++------------ test/examples/topic-listener.example.js | 67 +++++++++---------- 4 files changed, 100 insertions(+), 77 deletions(-) diff --git a/build/RosLibNode.d.ts b/build/RosLibNode.d.ts index 3a3fdbe08..c85695046 100644 --- a/build/RosLibNode.d.ts +++ b/build/RosLibNode.d.ts @@ -1,7 +1,7 @@ -export * from "./core"; export * from "./actionlib"; export * from "./math"; export * from "./tf"; export * from "./urdf"; export const Ros: typeof import("./node/RosTCP"); -export const Topic: typeof import("./core/Topic"); +export const Topic: typeof import("./node/TopicStream"); +export { Message, Param, Service, ServiceRequest, ServiceResponse } from "./core"; diff --git a/build/node/TopicStream.d.ts b/build/node/TopicStream.d.ts index 441cc3eea..ed757ff4b 100644 --- a/build/node/TopicStream.d.ts +++ b/build/node/TopicStream.d.ts @@ -1,2 +1,21 @@ -export = Topic; +export = TopicStream; +declare class TopicStream extends Topic { + /** + * Publish a connected ROS topic to a duplex + * stream. This stream can be piped to, which will + * publish to the topic. + * + * @param {Object} options + * @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. + * @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. + * @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. + */ + toStream(options: { + subscribe?: boolean | undefined; + publish?: boolean | undefined; + transform?: Function | undefined; + }): DuplexStream; +} import Topic = require("../core/Topic"); +import DuplexStream_1 = require("stream"); +import DuplexStream = DuplexStream_1.Duplex; diff --git a/src/node/TopicStream.js b/src/node/TopicStream.js index 5601f5b8a..33c226c33 100644 --- a/src/node/TopicStream.js +++ b/src/node/TopicStream.js @@ -1,50 +1,51 @@ var Topic = require('../core/Topic'); var DuplexStream = require('stream').Duplex; -/** - * Publish a connected ROS topic to a duplex - * stream. This stream can be piped to, which will - * publish to the topic. - * - * @param {Object} options - * @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. - * @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. - * @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. - */ -// @ts-expect-error -- prototype call here is unhappy - maybe we need to get rid of this or roll it into Topic. -Topic.prototype.toStream = function (options) { - options = options || { subscribe: true, publish: true }; - - var topic = this; - - var stream = new DuplexStream({ - objectMode: true - }); - stream._read = function () {}; - - // Publish to the topic if someone pipes to stream - stream._write = function (chunk, encoding, callback) { - if (typeof options.transform === 'function') { - chunk = options.transform(chunk); - } - if (chunk === false) { - topic.publish(chunk); +class TopicStream extends Topic { + /** + * Publish a connected ROS topic to a duplex + * stream. This stream can be piped to, which will + * publish to the topic. + * + * @param {Object} options + * @param {boolean} [options.subscribe=true] - The flag to indicate whether to subscribe to the topic and start emitting data or not. + * @param {boolean} [options.publish=true] - The flag to indicate whether to register the stream as a publisher to the topic or not. + * @param {function} [options.transform] - A function to change the data to be published or filter it if false is returned. + */ + toStream(options) { + options = options || { subscribe: true, publish: true }; + + var topic = this; + + var stream = new DuplexStream({ + objectMode: true + }); + stream._read = function () {}; + + // Publish to the topic if someone pipes to stream + stream._write = function (chunk, encoding, callback) { + if (typeof options.transform === 'function') { + chunk = options.transform(chunk); + } + if (chunk === false) { + topic.publish(chunk); + } + callback(); + }; + + if (options.subscribe) { + this.subscribe(function (message) { + stream.push(message); + }); + this.on('unsubscribe', stream.push.bind(stream, null)); } - callback(); - }; - if (options.subscribe) { - this.subscribe(function (message) { - stream.push(message); - }); - this.on('unsubscribe', stream.push.bind(stream, null)); - } + if (options.publish) { + this.advertise(); + } - if (options.publish) { - this.advertise(); + return stream; } +} - return stream; -}; - -module.exports = Topic; +module.exports = TopicStream; diff --git a/test/examples/topic-listener.example.js b/test/examples/topic-listener.example.js index 733e417f1..fa68d702c 100644 --- a/test/examples/topic-listener.example.js +++ b/test/examples/topic-listener.example.js @@ -55,46 +55,49 @@ describe('Topics Example', function() { }); }); +// @ts-expect-error if (ROSLIB.Topic.prototype.toStream) { var TransformStream = require('stream').Transform; describe('Topic Streams are readable and writable', function() { this.timeout(1000); function createAndStreamTopic(topicName) { - var stream = new TransformStream({objectMode: true}); - var topic = ros.Topic({ - name: topicName, - messageType: 'std_msgs/String' - }); - - var idx = 0; - function emit() { - setTimeout(function() { - stream.push(messages[idx++]); - if (idx < messages.length) { - emit(); - } else { - stream.end(); - topic.unsubscribe(); - topic.unadvertise(); - } - }, 50); - } - emit(); - - stream.pipe(topic.toStream()); - return topic; + var stream = new TransformStream({ objectMode: true }); + var topic = ros.Topic({ + name: topicName, + messageType: 'std_msgs/String' + }); + + var idx = 0; + function emit() { + setTimeout(function () { + stream.push(messages[idx++]); + if (idx < messages.length) { + emit(); + } else { + stream.end(); + topic.unsubscribe(); + topic.unadvertise(); + } + }, 50); + } + emit(); + + // @ts-expect-error + stream.pipe(topic.toStream()); + return topic; } it('Topic.toStream()', function(done) { - var stream = createAndStreamTopic('/echo/test-stream').toStream(); - var expected = messages.slice(); - - expect(stream).to.be.instanceof(require('stream')); - stream.on('data', function(message) { - expect(message).to.be.eql(expected.shift()); - }); - stream.on('end', done); + // @ts-expect-error + var stream = createAndStreamTopic('/echo/test-stream').toStream(); + var expected = messages.slice(); + + expect(stream).to.be.instanceof(require('stream')); + stream.on('data', function (message) { + expect(message).to.be.eql(expected.shift()); + }); + stream.on('end', done); }); }); -} \ No newline at end of file +} From a98a6277428de0ab455198b55257d56d895ab030 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 10:55:15 -0700 Subject: [PATCH 37/66] bump jshint again --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 1391a0a8e..06d3ff0bc 100644 --- a/.jshintrc +++ b/.jshintrc @@ -24,6 +24,6 @@ "proto": true, "laxbreak": true, // TypeScript will compile down to es5. - "esversion": 8 + "esversion": 9 } From 8ccdd433accd9d6a5ba88f16b8a59bc98f26f9b0 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 11:17:33 -0700 Subject: [PATCH 38/66] Have RosTCP return a TopicStream --- src/node/RosTCP.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/RosTCP.js b/src/node/RosTCP.js index 4f0a8165d..add462a30 100644 --- a/src/node/RosTCP.js +++ b/src/node/RosTCP.js @@ -2,6 +2,7 @@ var Ros = require('../core/Ros'); var SocketIO = require('./SocketIO'); var net = require('net'); var socketAdapter = require('../core/SocketAdapter.js'); +const TopicStream = require('./TopicStream'); /** * Same as core Ros except supports TCP connections. @@ -60,6 +61,9 @@ class RosTCP extends Ros { this.socket.close = this.socket.end; } } + Topic(options) { + return new TopicStream({ ros: this, ...options }); + } } module.exports = RosTCP; From 82c438d618bcb157638e049c1721a12f8919214c Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Mon, 27 Nov 2023 14:19:27 -0700 Subject: [PATCH 39/66] adding template types to jsdoc --- build/RosLibNode.d.ts | 2 +- build/actionlib/ActionClient.d.ts | 10 ++-- build/actionlib/Goal.d.ts | 11 +++- build/actionlib/SimpleActionServer.d.ts | 15 ++++-- build/core/Message.d.ts | 14 ++--- build/core/Ros.d.ts | 12 ++--- build/core/Service.d.ts | 15 +++--- build/core/ServiceRequest.d.ts | 14 ++--- build/core/ServiceResponse.d.ts | 14 ++--- build/core/Topic.d.ts | 12 ++--- build/node/RosTCP.d.ts | 2 + build/node/TopicStream.d.ts | 13 ++++- build/roslib.js | 69 ++++++++++++++++--------- build/roslib.min.js | 2 +- build/tf/TFClient.d.ts | 4 +- src/core/Message.js | 13 +++-- src/core/Ros.js | 6 ++- src/core/Service.js | 8 +-- src/core/ServiceRequest.js | 13 +++-- src/core/ServiceResponse.js | 13 +++-- src/core/Topic.js | 5 +- 21 files changed, 165 insertions(+), 102 deletions(-) diff --git a/build/RosLibNode.d.ts b/build/RosLibNode.d.ts index c85695046..744d6069e 100644 --- a/build/RosLibNode.d.ts +++ b/build/RosLibNode.d.ts @@ -1,7 +1,7 @@ +export * from "./core"; export * from "./actionlib"; export * from "./math"; export * from "./tf"; export * from "./urdf"; export const Ros: typeof import("./node/RosTCP"); export const Topic: typeof import("./node/TopicStream"); -export { Message, Param, Service, ServiceRequest, ServiceResponse } from "./core"; diff --git a/build/actionlib/ActionClient.d.ts b/build/actionlib/ActionClient.d.ts index 2b53d5ec8..aea2e0af3 100644 --- a/build/actionlib/ActionClient.d.ts +++ b/build/actionlib/ActionClient.d.ts @@ -37,11 +37,11 @@ declare class ActionClient extends EventEmitter2 { omitStatus: boolean | undefined; omitResult: boolean | undefined; goals: {}; - feedbackListener: Topic; - statusListener: Topic; - resultListener: Topic; - goalTopic: Topic; - cancelTopic: Topic; + feedbackListener: Topic; + statusListener: Topic; + resultListener: Topic; + goalTopic: Topic; + cancelTopic: Topic; /** * Cancel all goals associated with this ActionClient. */ diff --git a/build/actionlib/Goal.d.ts b/build/actionlib/Goal.d.ts index 5d0f4bd02..8408c0463 100644 --- a/build/actionlib/Goal.d.ts +++ b/build/actionlib/Goal.d.ts @@ -16,7 +16,16 @@ declare class Goal extends EventEmitter2 { goalMessage: any; }); actionClient: ActionClient; - goalMessage: Message; + goalMessage: Message<{ + goal_id: { + stamp: { + secs: number; + nsecs: number; + }; + id: string; + }; + goal: any; + }>; isFinished: boolean; status: any; result: any; diff --git a/build/actionlib/SimpleActionServer.d.ts b/build/actionlib/SimpleActionServer.d.ts index cc736ba28..e943913fa 100644 --- a/build/actionlib/SimpleActionServer.d.ts +++ b/build/actionlib/SimpleActionServer.d.ts @@ -21,9 +21,18 @@ declare class SimpleActionServer extends EventEmitter2 { ros: Ros; serverName: string; actionName: string; - feedbackPublisher: Topic; - resultPublisher: Topic; - statusMessage: Message; + feedbackPublisher: Topic; + resultPublisher: Topic; + statusMessage: Message<{ + header: { + stamp: { + secs: number; + nsecs: number; + }; + frame_id: string; + }; + status_list: never[]; + }>; currentGoal: any; nextGoal: any; /** diff --git a/build/core/Message.d.ts b/build/core/Message.d.ts index ff775521f..4f34fb4c6 100644 --- a/build/core/Message.d.ts +++ b/build/core/Message.d.ts @@ -3,15 +3,11 @@ export = Message; * Message objects are used for publishing and subscribing to and from topics. * * @constructor - * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. - */ -declare function Message(values?: any): void; -declare class Message { + * @template T +*/ +declare class Message { /** - * Message objects are used for publishing and subscribing to and from topics. - * - * @constructor - * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. + * @param {T} [values={}] - An object matching the fields defined in the .msg definition file. */ - constructor(values?: any); + constructor(values?: T | undefined); } diff --git a/build/core/Ros.d.ts b/build/core/Ros.d.ts index 7086b2d32..e50326ce7 100644 --- a/build/core/Ros.d.ts +++ b/build/core/Ros.d.ts @@ -175,8 +175,7 @@ declare class Ros extends EventEmitter2 { }) => any, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback getServiceResponseDetailsCallback - * @param {Object} result - The result object with the following params: - * @param {string[]} result.typedefs - An array containing the details of the service response. + * @param {ServiceResponse<{typedefs: string[]}>} result - The result object with the following params: */ /** * @callback getServiceResponseDetailsFailedCallback @@ -189,9 +188,9 @@ declare class Ros extends EventEmitter2 { * @param {getServiceResponseDetailsCallback} callback - Function with the following params: * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ - getServiceResponseDetails(type: string, callback: (result: { + getServiceResponseDetails(type: string, callback: (result: ServiceResponse<{ typedefs: string[]; - }) => any, failedCallback?: ((error: string) => any) | undefined): void; + }>) => any, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback getNodesCallback * @param {string[]} nodes - Array of node names. @@ -335,15 +334,16 @@ declare class Ros extends EventEmitter2 { types: string[]; typedefs_full_text: string[]; }) => any, failedCallback?: ((error: string) => any) | undefined): void; - Topic(options: any): Topic; + Topic(options: any): Topic; Param(options: any): Param; - Service(options: any): Service; + Service(options: any): Service; TFClient(options: any): import("../tf/TFClient"); ActionClient(options: any): import("../actionlib/ActionClient"); SimpleActionServer(options: any): import("../actionlib/SimpleActionServer"); } import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import ServiceResponse = require("./ServiceResponse"); import Topic = require("./Topic"); import Param = require("./Param"); import Service = require("./Service"); diff --git a/build/core/Service.d.ts b/build/core/Service.d.ts index 51513a8bd..5cbb3038a 100644 --- a/build/core/Service.d.ts +++ b/build/core/Service.d.ts @@ -1,8 +1,9 @@ export = Service; /** * A ROS service client. + * @template T, U */ -declare class Service extends EventEmitter2 { +declare class Service extends EventEmitter2 { /** * @param {Object} options * @param {Ros} options.ros - The ROSLIB.Ros connection handle. @@ -18,10 +19,10 @@ declare class Service extends EventEmitter2 { name: string; serviceType: string; isAdvertised: boolean; - _serviceCallback: ((request: ServiceRequest, response: any) => any) | null; + _serviceCallback: ((request: ServiceRequest, response: any) => any) | null; /** * @callback callServiceCallback - * @param {Object} response - The response from the service request. + * @param {U} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -31,14 +32,14 @@ declare class Service extends EventEmitter2 { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {T} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ - callService(request: ServiceRequest, callback?: ((response: any) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; + callService(request: T, callback?: ((response: U) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. @@ -50,7 +51,7 @@ declare class Service extends EventEmitter2 { * * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params */ - advertise(callback: (request: ServiceRequest, response: any) => any): void; + advertise(callback: (request: ServiceRequest, response: any) => any): void; unadvertise(): void; _serviceResponse(rosbridgeRequest: any): void; } diff --git a/build/core/ServiceRequest.d.ts b/build/core/ServiceRequest.d.ts index 6e11010f8..ee3dce6ac 100644 --- a/build/core/ServiceRequest.d.ts +++ b/build/core/ServiceRequest.d.ts @@ -3,15 +3,11 @@ export = ServiceRequest; * A ServiceRequest is passed into the service call. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. - */ -declare function ServiceRequest(values?: any): void; -declare class ServiceRequest { + * @template T +*/ +declare class ServiceRequest { /** - * A ServiceRequest is passed into the service call. - * - * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. + * @param {T} [values={}] - Object matching the fields defined in the .srv definition file. */ - constructor(values?: any); + constructor(values?: T | undefined); } diff --git a/build/core/ServiceResponse.d.ts b/build/core/ServiceResponse.d.ts index a78933e16..c9977aa13 100644 --- a/build/core/ServiceResponse.d.ts +++ b/build/core/ServiceResponse.d.ts @@ -3,15 +3,11 @@ export = ServiceResponse; * A ServiceResponse is returned from the service call. * * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. - */ -declare function ServiceResponse(values: any): void; -declare class ServiceResponse { + * @template T +*/ +declare class ServiceResponse { /** - * A ServiceResponse is returned from the service call. - * - * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. + * @param {T} values - Object matching the fields defined in the .srv definition file. */ - constructor(values: any); + constructor(values: T); } diff --git a/build/core/Topic.d.ts b/build/core/Topic.d.ts index 846ec0d37..beef024bd 100644 --- a/build/core/Topic.d.ts +++ b/build/core/Topic.d.ts @@ -5,8 +5,9 @@ export = Topic; * Emits the following events: * * 'warning' - If there are any warning during the Topic creation. * * 'message' - The message data from rosbridge. + * @template T */ -declare class Topic extends EventEmitter2 { +declare class Topic extends EventEmitter2 { /** * @param {Object} options * @param {Ros} options.ros - The ROSLIB.Ros connection handle. @@ -46,7 +47,7 @@ declare class Topic extends EventEmitter2 { _messageCallback: (data: any) => void; /** * @callback subscribeCallback - * @param {Object} message - The published message. + * @param {T} message - The published message. */ /** * Every time a message is published for the given topic, the callback @@ -54,7 +55,7 @@ declare class Topic extends EventEmitter2 { * * @param {subscribeCallback} callback - Function with the following params: */ - subscribe(callback: (message: any) => any): void; + subscribe(callback: (message: T) => any): void; subscribeId: string | null | undefined; /** * Unregister as a subscriber for the topic. Unsubscribing will stop @@ -78,11 +79,10 @@ declare class Topic extends EventEmitter2 { /** * Publish the message. * - * @param {Message} message - A ROSLIB.Message object. + * @param {T} message - A ROSLIB.Message object. */ - publish(message: Message): void; + publish(message: T): void; } import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; import Ros = require("../core/Ros"); -import Message = require("./Message"); diff --git a/build/node/RosTCP.d.ts b/build/node/RosTCP.d.ts index d7ae5b625..06d5be876 100644 --- a/build/node/RosTCP.d.ts +++ b/build/node/RosTCP.d.ts @@ -16,6 +16,8 @@ declare class RosTCP extends Ros { * Format: {host: String, port: Int} or (port:Int) or "host:port". */ connect(url: string | number | any): void; + Topic(options: any): TopicStream; } import Ros = require("../core/Ros"); import SocketIO = require("./SocketIO"); +import TopicStream = require("./TopicStream"); diff --git a/build/node/TopicStream.d.ts b/build/node/TopicStream.d.ts index ed757ff4b..2326bc42e 100644 --- a/build/node/TopicStream.d.ts +++ b/build/node/TopicStream.d.ts @@ -1,5 +1,16 @@ export = TopicStream; -declare class TopicStream extends Topic { +declare class TopicStream extends Topic { + constructor(options: { + ros: import("../core/Ros"); + name: string; + messageType: string; + compression?: string | undefined; + throttle_rate?: number | undefined; + queue_size?: number | undefined; + latch?: boolean | undefined; + queue_length?: number | undefined; + reconnect_on_close?: boolean | undefined; + }); /** * Publish a connected ROS topic to a duplex * stream. This stream can be piped to, which will diff --git a/build/roslib.js b/build/roslib.js index fad590880..2140e836a 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19976,11 +19976,17 @@ var assign = require('object-assign'); * Message objects are used for publishing and subscribing to and from topics. * * @constructor - * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. - */ -function Message(values) { - assign(this, values || {}); -} + * @template T +*/ +var Message = /** @class */ (function () { + /** + * @param {T} [values={}] - An object matching the fields defined in the .msg definition file. + */ + function Message(values) { + assign(this, values || {}); + } + return Message; +}()); module.exports = Message; },{"object-assign":31}],80:[function(require,module,exports){ @@ -20111,6 +20117,7 @@ var WorkerSocket = require('../util/workerSocket'); var socketAdapter = require('./SocketAdapter.js'); var Service = require('./Service'); var ServiceRequest = require('./ServiceRequest'); +var ServiceResponse = require('./ServiceResponse'); var assign = require('object-assign'); var Topic = require('./Topic'); var Param = require('./Param'); @@ -20300,6 +20307,7 @@ var Ros = /** @class */ (function (_super) { * @param {getActionServersFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ Ros.prototype.getActionServers = function (callback, failedCallback) { + /** @satisfies {Service} */ var getActionServers = new Service({ ros: this, name: '/rosapi/action_servers', @@ -20503,8 +20511,7 @@ var Ros = /** @class */ (function (_super) { }; /** * @callback getServiceResponseDetailsCallback - * @param {Object} result - The result object with the following params: - * @param {string[]} result.typedefs - An array containing the details of the service response. + * @param {ServiceResponse<{typedefs: string[]}>} result - The result object with the following params: */ /** * @callback getServiceResponseDetailsFailedCallback @@ -20518,6 +20525,7 @@ var Ros = /** @class */ (function (_super) { * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ Ros.prototype.getServiceResponseDetails = function (type, callback, failedCallback) { + /** @satisfies {Service<{},{typedefs: string[]}>} */ var serviceTypeClient = new Service({ ros: this, name: '/rosapi/service_response_details', @@ -20886,7 +20894,7 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; -},{"../actionlib":78,"../tf":94,"../util/workerSocket":109,"./Param":80,"./Service":82,"./ServiceRequest":83,"./SocketAdapter.js":85,"./Topic":86,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ +},{"../actionlib":78,"../tf":94,"../util/workerSocket":109,"./Param":80,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./SocketAdapter.js":85,"./Topic":86,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20913,6 +20921,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Ros = require('../core/Ros'); /** * A ROS service client. + * @template T, U */ var Service = /** @class */ (function (_super) { __extends(Service, _super); @@ -20933,7 +20942,7 @@ var Service = /** @class */ (function (_super) { } /** * @callback callServiceCallback - * @param {Object} response - The response from the service request. + * @param {U} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -20943,7 +20952,7 @@ var Service = /** @class */ (function (_super) { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {T} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ @@ -20960,6 +20969,7 @@ var Service = /** @class */ (function (_super) { } } else if (typeof callback === 'function') { + // @ts-expect-error -- can't figure out how to get ServiceResponse to play nice in typescript here callback(new ServiceResponse(message.values)); } }); @@ -20975,7 +20985,7 @@ var Service = /** @class */ (function (_super) { }; /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. @@ -21040,11 +21050,17 @@ var assign = require('object-assign'); * A ServiceRequest is passed into the service call. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. - */ -function ServiceRequest(values) { - assign(this, values || {}); -} + * @template T +*/ +var ServiceRequest = /** @class */ (function () { + /** + * @param {T} [values={}] - Object matching the fields defined in the .srv definition file. + */ + function ServiceRequest(values) { + assign(this, values || {}); + } + return ServiceRequest; +}()); module.exports = ServiceRequest; },{"object-assign":31}],84:[function(require,module,exports){ @@ -21058,11 +21074,17 @@ var assign = require('object-assign'); * A ServiceResponse is returned from the service call. * * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. - */ -function ServiceResponse(values) { - assign(this, values); -} + * @template T +*/ +var ServiceResponse = /** @class */ (function () { + /** + * @param {T} values - Object matching the fields defined in the .srv definition file. + */ + function ServiceResponse(values) { + assign(this, values); + } + return ServiceResponse; +}()); module.exports = ServiceResponse; },{"object-assign":31}],85:[function(require,module,exports){ @@ -21228,6 +21250,7 @@ var Ros = require('../core/Ros'); * Emits the following events: * * 'warning' - If there are any warning during the Topic creation. * * 'message' - The message data from rosbridge. + * @template T */ var Topic = /** @class */ (function (_super) { __extends(Topic, _super); @@ -21302,7 +21325,7 @@ var Topic = /** @class */ (function (_super) { } /** * @callback subscribeCallback - * @param {Object} message - The published message. + * @param {T} message - The published message. */ /** * Every time a message is published for the given topic, the callback @@ -21409,7 +21432,7 @@ var Topic = /** @class */ (function (_super) { /** * Publish the message. * - * @param {Message} message - A ROSLIB.Message object. + * @param {T} message - A ROSLIB.Message object. */ Topic.prototype.publish = function (message) { if (!this.isAdvertised) { diff --git a/build/roslib.min.js b/build/roslib.min.js index 114ae382e..f28ac832b 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs | false; frameInfos: {}; republisherUpdateRequested: boolean; _subscribeCB: ((tf: any) => void) | undefined; _isDisposed: boolean; actionClient: ActionClient; - serviceClient: Service; + serviceClient: Service; /** * Process the incoming TF message and send them out using the callback * functions. diff --git a/src/core/Message.js b/src/core/Message.js index e1b61d472..3c8506b8e 100644 --- a/src/core/Message.js +++ b/src/core/Message.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * Message objects are used for publishing and subscribing to and from topics. * * @constructor - * @param {Object} [values={}] - An object matching the fields defined in the .msg definition file. - */ -function Message(values) { - assign(this, values || {}); + * @template T +*/ +class Message { + /** + * @param {T} [values={}] - An object matching the fields defined in the .msg definition file. + */ + constructor(values) { + assign(this, values || {}); + } } module.exports = Message; diff --git a/src/core/Ros.js b/src/core/Ros.js index 559db26ce..5d120dec8 100644 --- a/src/core/Ros.js +++ b/src/core/Ros.js @@ -9,6 +9,7 @@ var socketAdapter = require('./SocketAdapter.js'); var Service = require('./Service'); var ServiceRequest = require('./ServiceRequest'); +var ServiceResponse = require('./ServiceResponse'); var assign = require('object-assign'); const Topic = require('./Topic'); @@ -199,6 +200,7 @@ class Ros extends EventEmitter2 { * @param {getActionServersFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getActionServers(callback, failedCallback) { + /** @satisfies {Service} */ var getActionServers = new Service({ ros: this, name: '/rosapi/action_servers', @@ -426,8 +428,7 @@ class Ros extends EventEmitter2 { } /** * @callback getServiceResponseDetailsCallback - * @param {Object} result - The result object with the following params: - * @param {string[]} result.typedefs - An array containing the details of the service response. + * @param {ServiceResponse<{typedefs: string[]}>} result - The result object with the following params: */ /** * @callback getServiceResponseDetailsFailedCallback @@ -441,6 +442,7 @@ class Ros extends EventEmitter2 { * @param {getServiceResponseDetailsFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ getServiceResponseDetails(type, callback, failedCallback) { + /** @satisfies {Service<{},{typedefs: string[]}>} */ var serviceTypeClient = new Service({ ros: this, name: '/rosapi/service_response_details', diff --git a/src/core/Service.js b/src/core/Service.js index 6a840f6b5..c4affcced 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -10,6 +10,7 @@ var Ros = require('../core/Ros'); /** * A ROS service client. + * @template T, U */ class Service extends EventEmitter2 { /** @@ -29,7 +30,7 @@ class Service extends EventEmitter2 { } /** * @callback callServiceCallback - * @param {Object} response - The response from the service request. + * @param {U} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -39,7 +40,7 @@ class Service extends EventEmitter2 { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {ServiceRequest} request - The ROSLIB.ServiceRequest to send. + * @param {T} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ @@ -58,6 +59,7 @@ class Service extends EventEmitter2 { failedCallback(message.values); } } else if (typeof callback === 'function') { + // @ts-expect-error -- can't figure out how to get ServiceResponse to play nice in typescript here callback(new ServiceResponse(message.values)); } }); @@ -74,7 +76,7 @@ class Service extends EventEmitter2 { } /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. diff --git a/src/core/ServiceRequest.js b/src/core/ServiceRequest.js index ff9e64d48..e15e3f255 100644 --- a/src/core/ServiceRequest.js +++ b/src/core/ServiceRequest.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * A ServiceRequest is passed into the service call. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .srv definition file. - */ -function ServiceRequest(values) { - assign(this, values || {}); + * @template T +*/ +class ServiceRequest { + /** + * @param {T} [values={}] - Object matching the fields defined in the .srv definition file. + */ + constructor(values) { + assign(this, values || {}); + } } module.exports = ServiceRequest; diff --git a/src/core/ServiceResponse.js b/src/core/ServiceResponse.js index 1c891b987..c1082392b 100644 --- a/src/core/ServiceResponse.js +++ b/src/core/ServiceResponse.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * A ServiceResponse is returned from the service call. * * @constructor - * @param {Object} values - Object matching the fields defined in the .srv definition file. - */ -function ServiceResponse(values) { - assign(this, values); + * @template T +*/ +class ServiceResponse { + /** + * @param {T} values - Object matching the fields defined in the .srv definition file. + */ + constructor(values) { + assign(this, values); + } } module.exports = ServiceResponse; diff --git a/src/core/Topic.js b/src/core/Topic.js index 70448f1ec..d245797a6 100644 --- a/src/core/Topic.js +++ b/src/core/Topic.js @@ -13,6 +13,7 @@ var Ros = require('../core/Ros'); * Emits the following events: * * 'warning' - If there are any warning during the Topic creation. * * 'message' - The message data from rosbridge. + * @template T */ class Topic extends EventEmitter2 { /** @@ -94,7 +95,7 @@ class Topic extends EventEmitter2 { } /** * @callback subscribeCallback - * @param {Object} message - The published message. + * @param {T} message - The published message. */ /** * Every time a message is published for the given topic, the callback @@ -204,7 +205,7 @@ class Topic extends EventEmitter2 { /** * Publish the message. * - * @param {Message} message - A ROSLIB.Message object. + * @param {T} message - A ROSLIB.Message object. */ publish(message) { if (!this.isAdvertised) { From 532c31b6829e9747a376125df40accc2633530fa Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Tue, 28 Nov 2023 08:57:19 -0700 Subject: [PATCH 40/66] simplify build --- Gruntfile.js | 10 +--- package-lock.json | 148 ---------------------------------------------- package.json | 1 - tsconfig.json | 2 +- 4 files changed, 2 insertions(+), 159 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 938edd584..40cb75ac5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,14 +15,6 @@ module.exports = function(grunt) { command: 'tsc -p .' } }, - copy: { - main: { - expand: true, - cwd: 'tsbuild', - src: ['**/*.d.ts'], - dest: 'build/' - } - }, browserify: { dist: { src: ['./tsbuild/RosLibBrowser.js'], @@ -119,7 +111,7 @@ module.exports = function(grunt) { grunt.registerTask('test-examples', ['mochaTest:examples', 'karma:examples']); grunt.registerTask('test-tcp', ['mochaTest:tcp']); grunt.registerTask('test-workersocket', ['karma:workersocket']); - grunt.registerTask('build', ['shell', 'copy', 'browserify', 'uglify']); + grunt.registerTask('build', ['shell', 'browserify', 'uglify']); grunt.registerTask('build_and_watch', ['watch']); grunt.registerTask('doc', ['clean', 'jsdoc']); }; diff --git a/package-lock.json b/package-lock.json index 586af29ed..14f6f8bf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "grunt-browserify": "^6.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^2.0.0", - "grunt-contrib-copy": "^1.0.0", "grunt-contrib-jshint": "^3.0.0", "grunt-contrib-uglify": "^5.0.0", "grunt-contrib-watch": "^1.0.0", @@ -2399,12 +2398,6 @@ "node": ">=0.8.0" } }, - "node_modules/file-sync-cmp": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", - "integrity": "sha512-0k45oWBokCqh2MOexeYKpyqmGKG+8mQ2Wd8iawx+uWd/weWJQAZ6SoPybagdCI4xFisag8iAR77WPm4h3pTfxA==", - "dev": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2957,83 +2950,6 @@ "rimraf": "bin.js" } }, - "node_modules/grunt-contrib-copy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", - "integrity": "sha512-gFRFUB0ZbLcjKb67Magz1yOHGBkyU6uL29hiEW1tdQ9gQt72NuMKIy/kS6dsCbV0cZ0maNCb0s6y+uT1FKU7jA==", - "dev": true, - "dependencies": { - "chalk": "^1.1.1", - "file-sync-cmp": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", - "dev": true, - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dev": true, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/grunt-contrib-copy/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/grunt-contrib-jshint": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-3.2.0.tgz", @@ -9603,12 +9519,6 @@ } } }, - "file-sync-cmp": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", - "integrity": "sha512-0k45oWBokCqh2MOexeYKpyqmGKG+8mQ2Wd8iawx+uWd/weWJQAZ6SoPybagdCI4xFisag8iAR77WPm4h3pTfxA==", - "dev": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -10082,64 +9992,6 @@ } } }, - "grunt-contrib-copy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", - "integrity": "sha512-gFRFUB0ZbLcjKb67Magz1yOHGBkyU6uL29hiEW1tdQ9gQt72NuMKIy/kS6dsCbV0cZ0maNCb0s6y+uT1FKU7jA==", - "dev": true, - "requires": { - "chalk": "^1.1.1", - "file-sync-cmp": "^0.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", - "dev": true - } - } - }, "grunt-contrib-jshint": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-3.2.0.tgz", diff --git a/package.json b/package.json index a16307585..5714af55e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "grunt-browserify": "^6.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^2.0.0", - "grunt-contrib-copy": "^1.0.0", "grunt-contrib-jshint": "^3.0.0", "grunt-contrib-uglify": "^5.0.0", "grunt-contrib-watch": "^1.0.0", diff --git a/tsconfig.json b/tsconfig.json index 24318a917..e5939c36c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -70,7 +70,7 @@ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + "declarationDir": "./build" /* Specify the output directory for generated declaration files. */, // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ /* Interop Constraints */ From 6d372e76e843df59a9549bd9a68c86dd8287241d Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:37:58 -0500 Subject: [PATCH 41/66] Add action client support --- build/core/Action.d.ts | 44 ++ build/core/ActionFeedback.d.ts | 2 + build/core/ActionGoal.d.ts | 17 + build/core/ActionResult.d.ts | 17 + build/core/index.d.ts | 4 + build/roslib.js | 538 ++++++++++++++++++ build/roslib.min.js | 6 +- .../{fibonacci.html => fibonacci_client.html} | 38 +- examples/simple.html | 47 +- src/core/Action.js | 75 +++ src/core/ActionFeedback.js | 18 + src/core/ActionGoal.js | 18 + src/core/ActionResult.js | 18 + src/core/SocketAdapter.js | 6 + src/core/index.js | 4 + 15 files changed, 789 insertions(+), 63 deletions(-) create mode 100644 build/core/Action.d.ts create mode 100644 build/core/ActionFeedback.d.ts create mode 100644 build/core/ActionGoal.d.ts create mode 100644 build/core/ActionResult.d.ts rename examples/{fibonacci.html => fibonacci_client.html} (72%) create mode 100644 src/core/Action.js create mode 100644 src/core/ActionFeedback.js create mode 100644 src/core/ActionGoal.js create mode 100644 src/core/ActionResult.js diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts new file mode 100644 index 000000000..a49c9eb49 --- /dev/null +++ b/build/core/Action.d.ts @@ -0,0 +1,44 @@ +export = Action; +/** + * A ROS action client. + * + * @constructor + * @params options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the service name, like '/fibonacci' + * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' + */ +declare function Action(options: any): void; +declare class Action { + /** + * A ROS action client. + * + * @constructor + * @params options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the service name, like '/fibonacci' + * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' + */ + constructor(options: any); + ros: any; + name: any; + actionType: any; + isAdvertised: boolean; + _serviceCallback: any; + __proto__: EventEmitter2; + /** + * Calls the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param request - the ROSLIB.ServiceRequest to send + * @param resultCallback - function with params: + * * result - the result from the action + * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: + * * feedback - the feedback from the action + * @param failedCallback - the callback function when the action failed (optional). Params: + * * error - the error message reported by ROS + */ + sendGoal(request: any, resultCallback: any, feedbackCallback: any, failedCallback: any): void; +} +import EventEmitter2_1 = require("eventemitter2"); +import EventEmitter2 = EventEmitter2_1.EventEmitter2; diff --git a/build/core/ActionFeedback.d.ts b/build/core/ActionFeedback.d.ts new file mode 100644 index 000000000..1cce63507 --- /dev/null +++ b/build/core/ActionFeedback.d.ts @@ -0,0 +1,2 @@ +declare const _exports: any; +export = _exports; diff --git a/build/core/ActionGoal.d.ts b/build/core/ActionGoal.d.ts new file mode 100644 index 000000000..431c3de06 --- /dev/null +++ b/build/core/ActionGoal.d.ts @@ -0,0 +1,17 @@ +export = ActionGoal; +/** + * An ActionGoal is passed into an action goal request. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +declare function ActionGoal(values: any): void; +declare class ActionGoal { + /** + * An ActionGoal is passed into an action goal request. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ + constructor(values: any); +} diff --git a/build/core/ActionResult.d.ts b/build/core/ActionResult.d.ts new file mode 100644 index 000000000..a6f96530d --- /dev/null +++ b/build/core/ActionResult.d.ts @@ -0,0 +1,17 @@ +export = ActionResult; +/** + * An ActionResult is returned from sending an action goal. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +declare function ActionResult(values: any): void; +declare class ActionResult { + /** + * An ActionResult is returned from sending an action goal. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ + constructor(values: any); +} diff --git a/build/core/index.d.ts b/build/core/index.d.ts index 6b984016c..ab5aad122 100644 --- a/build/core/index.d.ts +++ b/build/core/index.d.ts @@ -5,3 +5,7 @@ export const Param: typeof import("./Param"); export const Service: typeof import("./Service"); export const ServiceRequest: typeof import("./ServiceRequest"); export const ServiceResponse: typeof import("./ServiceResponse"); +export const Action: typeof import("./Action"); +export const ActionGoal: typeof import("./ActionGoal"); +export const ActionFeedback: any; +export const ActionResult: typeof import("./ActionResult"); diff --git a/build/roslib.js b/build/roslib.js index 2140e836a..c44213a5c 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19350,7 +19350,13 @@ assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); +<<<<<<< HEAD },{"./actionlib":78,"./core":87,"./math":92,"./tf":94,"./urdf":106,"object-assign":31}],73:[function(require,module,exports){ +======= +module.exports = ROSLIB; + +},{"./actionlib":14,"./core":26,"./math":31,"./tf":34,"./urdf":46,"object-assign":3}],9:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); @@ -19514,8 +19520,12 @@ var ActionClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionClient; +<<<<<<< HEAD },{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],75:[function(require,module,exports){ "use strict"; +======= +},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],11:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Justin Young - justin@oodar.com.au @@ -19608,8 +19618,12 @@ var ActionListener = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionListener; +<<<<<<< HEAD },{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],76:[function(require,module,exports){ "use strict"; +======= +},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],12:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu @@ -19711,9 +19725,13 @@ var Goal = /** @class */ (function (_super) { return Goal; }(EventEmitter2)); module.exports = Goal; +<<<<<<< HEAD },{"../core/Message":79,"./ActionClient":74,"eventemitter2":16}],77:[function(require,module,exports){ "use strict"; +======= +},{"../core/Message":18,"eventemitter2":2}],13:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Laura Lindzey - lindzey@gmail.com @@ -19955,6 +19973,12 @@ var SimpleActionServer = /** @class */ (function (_super) { return SimpleActionServer; }(EventEmitter2)); module.exports = SimpleActionServer; +<<<<<<< HEAD +======= +},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],14:[function(require,module,exports){ +var Ros = require('../core/Ros'); +var mixin = require('../mixin'); +>>>>>>> 22a24aa (Add action client support) },{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],78:[function(require,module,exports){ "use strict"; @@ -19965,8 +19989,128 @@ exports.ActionListener = require('./ActionListener'); exports.Goal = require('./Goal'); exports.SimpleActionServer = require('./SimpleActionServer'); +<<<<<<< HEAD },{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ "use strict"; +======= +mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); + +},{"../core/Ros":20,"../mixin":32,"./ActionClient":10,"./ActionListener":11,"./Goal":12,"./SimpleActionServer":13}],15:[function(require,module,exports){ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var ActionGoal = require('./ActionGoal'); +var ActionResult = require('./ActionResult'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; + +/** + * A ROS action client. + * + * @constructor + * @params options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the service name, like '/fibonacci' + * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' + */ +function Action(options) { + options = options || {}; + this.ros = options.ros; + this.name = options.name; + this.actionType = options.actionType; + this.isAdvertised = false; + + this._serviceCallback = null; +} +Action.prototype.__proto__ = EventEmitter2.prototype; + +/** + * Calls the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param request - the ROSLIB.ServiceRequest to send + * @param callback - function with params: + * * response - the response from the service request + * @param failedCallback - the callback function when the service call failed (optional). Params: + * * error - the error message reported by ROS + */ +Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback) { + if (this.isAdvertised) { + return; + } + + var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); + + if (resultCallback || failedCallback) { + this.ros.on(actionGoalId, function(message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } + } else if (message.op === "action_feedback" && typeof feedbackCallback === 'function') { + feedbackCallback(new ActionResult(message.values)); + } else if (message.op === "action_result" && typeof resultCallback === 'function') { + resultCallback(new ActionResult(message.values)); + } + }); + } + + var call = { + op : 'send_action_goal', + id : actionGoalId, + action : this.name, + action_type: this.actionType, + args : request, + feedback : true, + }; + this.ros.callOnConnection(call); +}; + +module.exports = Action; + +},{"./ActionGoal":16,"./ActionResult":17,"eventemitter2":2}],16:[function(require,module,exports){ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var assign = require('object-assign'); + +/** + * An ActionGoal is passed into the an action goal request. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionGoal(values) { + assign(this, values); +} + +module.exports = ActionGoal; + +},{"object-assign":3}],17:[function(require,module,exports){ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var assign = require('object-assign'); + +/** + * An ActionResult is returned from sending an action goal. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionResult(values) { + assign(this, values); +} + +module.exports = ActionResult; + +},{"object-assign":3}],18:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -19988,9 +20132,13 @@ var Message = /** @class */ (function () { return Message; }()); module.exports = Message; +<<<<<<< HEAD },{"object-assign":31}],80:[function(require,module,exports){ "use strict"; +======= +},{"object-assign":3}],19:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -20079,9 +20227,13 @@ var Param = /** @class */ (function () { return Param; }()); module.exports = Param; +<<<<<<< HEAD },{"../core/Ros":81,"./Service":82,"./ServiceRequest":83}],81:[function(require,module,exports){ "use strict"; +======= +},{"./Service":21,"./ServiceRequest":22}],20:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -20894,8 +21046,12 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; +<<<<<<< HEAD },{"../actionlib":78,"../tf":94,"../util/workerSocket":109,"./Param":80,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./SocketAdapter.js":85,"./Topic":86,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ "use strict"; +======= +},{"../util/workerSocket":52,"./Service":21,"./ServiceRequest":22,"./SocketAdapter.js":24,"eventemitter2":2,"object-assign":3,"ws":49}],21:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -21039,8 +21195,12 @@ var Service = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Service; +<<<<<<< HEAD },{"../core/Ros":81,"./ServiceRequest":83,"./ServiceResponse":84,"eventemitter2":16}],83:[function(require,module,exports){ "use strict"; +======= +},{"./ServiceRequest":22,"./ServiceResponse":23,"eventemitter2":2}],22:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com @@ -21062,9 +21222,13 @@ var ServiceRequest = /** @class */ (function () { return ServiceRequest; }()); module.exports = ServiceRequest; +<<<<<<< HEAD },{"object-assign":31}],84:[function(require,module,exports){ "use strict"; +======= +},{"object-assign":3}],23:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com @@ -21086,8 +21250,12 @@ var ServiceResponse = /** @class */ (function () { return ServiceResponse; }()); module.exports = ServiceResponse; +<<<<<<< HEAD },{"object-assign":31}],85:[function(require,module,exports){ +======= +},{"object-assign":3}],24:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -21115,9 +21283,37 @@ if (typeof bson !== 'undefined') { * @private */ function SocketAdapter(client) { +<<<<<<< HEAD var decoder = null; if (client.transportOptions.decoder) { decoder = client.transportOptions.decoder; +======= + + var decoder = null; + if (client.transportOptions.decoder) { + decoder = client.transportOptions.decoder; + } + + function handleMessage(message) { + if (message.op === 'publish') { + client.emit(message.topic, message.msg); + } else if (message.op === 'service_response') { + client.emit(message.id, message); + } else if (message.op === 'call_service') { + client.emit(message.service, message); + } else if (message.op === 'send_action_goal') { + client.emit(message.action, message); + } else if (message.op === 'action_feedback') { + client.emit(message.id, message); + } else if (message.op === 'action_result') { + client.emit(message.id, message); + } else if(message.op === 'status'){ + if(message.id){ + client.emit('status:'+message.id, message); + } else { + client.emit('status', message); + } +>>>>>>> 22a24aa (Add action client support) } function handleMessage(message) { if (message.op === 'publish') { @@ -21220,8 +21416,12 @@ function SocketAdapter(client) { } module.exports = SocketAdapter; +<<<<<<< HEAD },{"../util/cborTypedArrayTags":107,"../util/decompressPng":108,"cbor-js":14}],86:[function(require,module,exports){ "use strict"; +======= +},{"../util/cborTypedArrayTags":47,"../util/decompressPng":51,"cbor-js":1}],25:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -21452,6 +21652,7 @@ var Topic = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Topic; +<<<<<<< HEAD },{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -21466,6 +21667,27 @@ exports.ServiceResponse = require('./ServiceResponse'); },{"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ "use strict"; +======= +},{"./Message":18,"eventemitter2":2}],26:[function(require,module,exports){ +var mixin = require('../mixin'); + +var core = module.exports = { + Ros: require('./Ros'), + Topic: require('./Topic'), + Message: require('./Message'), + Param: require('./Param'), + Service: require('./Service'), + ServiceRequest: require('./ServiceRequest'), + ServiceResponse: require('./ServiceResponse'), + Action: require('./Action'), + ActionGoal: require('./ActionGoal'), + ActionResult: require('./ActionResult'), +}; + +mixin(core.Ros, ['Param', 'Service', 'Topic', 'Action'], core); + +},{"../mixin":32,"./Action":15,"./ActionGoal":16,"./ActionResult":17,"./Message":18,"./Param":19,"./Ros":20,"./Service":21,"./ServiceRequest":22,"./ServiceResponse":23,"./Topic":25}],27:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21539,9 +21761,13 @@ var Pose = /** @class */ (function () { return Pose; }()); module.exports = Pose; +<<<<<<< HEAD },{"./Quaternion":89,"./Transform":90,"./Vector3":91}],89:[function(require,module,exports){ "use strict"; +======= +},{"./Quaternion":28,"./Vector3":30}],28:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21631,8 +21857,12 @@ var Quaternion = /** @class */ (function () { }()); module.exports = Quaternion; +<<<<<<< HEAD },{}],90:[function(require,module,exports){ "use strict"; +======= +},{}],29:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21664,9 +21894,13 @@ var Transform = /** @class */ (function () { return Transform; }()); module.exports = Transform; +<<<<<<< HEAD },{"./Quaternion":89,"./Vector3":91}],91:[function(require,module,exports){ "use strict"; +======= +},{"./Quaternion":28,"./Vector3":30}],30:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21733,6 +21967,7 @@ var Vector3 = /** @class */ (function () { return Vector3; }()); module.exports = Vector3; +<<<<<<< HEAD },{"./Quaternion":89}],92:[function(require,module,exports){ "use strict"; @@ -21745,6 +21980,36 @@ exports.Vector3 = require('./Vector3'); },{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ "use strict"; +======= +},{}],31:[function(require,module,exports){ +module.exports = { + Pose: require('./Pose'), + Quaternion: require('./Quaternion'), + Transform: require('./Transform'), + Vector3: require('./Vector3') +}; + +},{"./Pose":27,"./Quaternion":28,"./Transform":29,"./Vector3":30}],32:[function(require,module,exports){ +/** + * Mixin a feature to the core/Ros prototype. + * For example, mixin(Ros, ['Topic'], {Topic: }) + * will add a topic bound to any Ros instances so a user + * can call `var topic = ros.Topic({name: '/foo'});` + * + * @author Graeme Yeates - github.com/megawac + */ +module.exports = function(Ros, classes, features) { + classes.forEach(function(className) { + var Class = features[className]; + Ros.prototype[className] = function(options) { + options.ros = this; + return new Class(options); + }; + }); +}; + +},{}],33:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21982,6 +22247,7 @@ var TFClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = TFClient; +<<<<<<< HEAD },{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],94:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -21990,6 +22256,96 @@ exports.TFClient = require('./TFClient'); },{"./TFClient":93}],95:[function(require,module,exports){ "use strict"; +======= +},{"../actionlib/ActionClient":10,"../actionlib/Goal":12,"../core/Service.js":21,"../core/ServiceRequest.js":22,"../core/Topic.js":25,"../math/Transform":29}],34:[function(require,module,exports){ +var Ros = require('../core/Ros'); +var mixin = require('../mixin'); + +var tf = module.exports = { + TFClient: require('./TFClient') +}; + +mixin(Ros, ['TFClient'], tf); +},{"../core/Ros":20,"../mixin":32,"./TFClient":33}],35:[function(require,module,exports){ +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ + +var Vector3 = require('../math/Vector3'); +var UrdfTypes = require('./UrdfTypes'); + +/** + * A Box element in a URDF. + * + * @constructor + * @param options - object with following keys: + * * xml - the XML element to parse + */ +function UrdfBox(options) { + this.dimension = null; + this.type = UrdfTypes.URDF_BOX; + + // Parse the xml string + var xyz = options.xml.getAttribute('size').split(' '); + this.dimension = new Vector3({ + x : parseFloat(xyz[0]), + y : parseFloat(xyz[1]), + z : parseFloat(xyz[2]) + }); +} + +module.exports = UrdfBox; +},{"../math/Vector3":30,"./UrdfTypes":44}],36:[function(require,module,exports){ +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ + +/** + * A Color element in a URDF. + * + * @constructor + * @param options - object with following keys: + * * xml - the XML element to parse + */ +function UrdfColor(options) { + // Parse the xml string + var rgba = options.xml.getAttribute('rgba').split(' '); + this.r = parseFloat(rgba[0]); + this.g = parseFloat(rgba[1]); + this.b = parseFloat(rgba[2]); + this.a = parseFloat(rgba[3]); +} + +module.exports = UrdfColor; +},{}],37:[function(require,module,exports){ +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ + +var UrdfTypes = require('./UrdfTypes'); + +/** + * A Cylinder element in a URDF. + * + * @constructor + * @param options - object with following keys: + * * xml - the XML element to parse + */ +function UrdfCylinder(options) { + this.type = UrdfTypes.URDF_CYLINDER; + this.length = parseFloat(options.xml.getAttribute('length')); + this.radius = parseFloat(options.xml.getAttribute('radius')); +} + +module.exports = UrdfCylinder; +},{"./UrdfTypes":44}],38:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22165,8 +22521,128 @@ var UrdfJoint = /** @class */ (function () { }()); module.exports = UrdfJoint; +<<<<<<< HEAD },{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91}],99:[function(require,module,exports){ "use strict"; +======= +},{"../math/Pose":27,"../math/Quaternion":28,"../math/Vector3":30}],39:[function(require,module,exports){ +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ + +var UrdfVisual = require('./UrdfVisual'); + +/** + * A Link element in a URDF. + * + * @constructor + * @param options - object with following keys: + * * xml - the XML element to parse + */ +function UrdfLink(options) { + this.name = options.xml.getAttribute('name'); + this.visuals = []; + var visuals = options.xml.getElementsByTagName('visual'); + + for( var i=0; i 0) { + this.textureFilename = textures[0].getAttribute('filename'); + } + + // Color + var colors = options.xml.getElementsByTagName('color'); + if (colors.length > 0) { + // Parse the RBGA string + this.color = new UrdfColor({ + xml : colors[0] + }); + } +} + +UrdfMaterial.prototype.isLink = function() { + return this.color === null && this.textureFilename === null; +}; + +var assign = require('object-assign'); + +UrdfMaterial.prototype.assign = function(obj) { + return assign(this, obj); +}; + +module.exports = UrdfMaterial; + +},{"./UrdfColor":36,"object-assign":3}],41:[function(require,module,exports){ +/** + * @fileOverview + * @author Benjamin Pitzer - ben.pitzer@gmail.com + * @author Russell Toris - rctoris@wpi.edu + */ + +var Vector3 = require('../math/Vector3'); +var UrdfTypes = require('./UrdfTypes'); + +/** + * A Mesh element in a URDF. + * + * @constructor + * @param options - object with following keys: + * * xml - the XML element to parse + */ +function UrdfMesh(options) { + this.scale = null; + + this.type = UrdfTypes.URDF_MESH; + this.filename = options.xml.getAttribute('filename'); + + // Check for a scale + var scale = options.xml.getAttribute('scale'); + if (scale) { + // Get the XYZ + var xyz = scale.split(' '); + this.scale = new Vector3({ + x : parseFloat(xyz[0]), + y : parseFloat(xyz[1]), + z : parseFloat(xyz[2]) + }); + } +} + +module.exports = UrdfMesh; +},{"../math/Vector3":30,"./UrdfTypes":44}],42:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22378,8 +22854,12 @@ var UrdfModel = /** @class */ (function () { }()); module.exports = UrdfModel; +<<<<<<< HEAD },{"./UrdfJoint":98,"./UrdfLink":99,"./UrdfMaterial":100,"@xmldom/xmldom":70}],103:[function(require,module,exports){ "use strict"; +======= +},{"./UrdfJoint":38,"./UrdfLink":39,"./UrdfMaterial":40,"@xmldom/xmldom":48}],43:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22401,6 +22881,7 @@ var UrdfSphere = /** @class */ (function () { return UrdfSphere; }()); module.exports = UrdfSphere; +<<<<<<< HEAD },{"./UrdfTypes":104}],104:[function(require,module,exports){ "use strict"; @@ -22413,6 +22894,17 @@ exports.URDF_MESH = 3; },{}],105:[function(require,module,exports){ "use strict"; +======= +},{"./UrdfTypes":44}],44:[function(require,module,exports){ +module.exports = { + URDF_SPHERE : 0, + URDF_BOX : 1, + URDF_CYLINDER : 2, + URDF_MESH : 3 +}; + +},{}],45:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22545,6 +23037,7 @@ var UrdfVisual = /** @class */ (function () { return UrdfVisual; }()); module.exports = UrdfVisual; +<<<<<<< HEAD },{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":95,"./UrdfCylinder":97,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfSphere":103}],106:[function(require,module,exports){ "use strict"; @@ -22576,6 +23069,22 @@ exports.UrdfVisual = require('./UrdfVisual'); __exportStar(require("./UrdfTypes"), exports); },{"./UrdfBox":95,"./UrdfColor":96,"./UrdfCylinder":97,"./UrdfLink":99,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfModel":102,"./UrdfSphere":103,"./UrdfTypes":104,"./UrdfVisual":105}],107:[function(require,module,exports){ +======= +},{"../math/Pose":27,"../math/Quaternion":28,"../math/Vector3":30,"./UrdfBox":35,"./UrdfCylinder":37,"./UrdfMaterial":40,"./UrdfMesh":41,"./UrdfSphere":43}],46:[function(require,module,exports){ +module.exports = require('object-assign')({ + UrdfBox: require('./UrdfBox'), + UrdfColor: require('./UrdfColor'), + UrdfCylinder: require('./UrdfCylinder'), + UrdfLink: require('./UrdfLink'), + UrdfMaterial: require('./UrdfMaterial'), + UrdfMesh: require('./UrdfMesh'), + UrdfModel: require('./UrdfModel'), + UrdfSphere: require('./UrdfSphere'), + UrdfVisual: require('./UrdfVisual') +}, require('./UrdfTypes')); + +},{"./UrdfBox":35,"./UrdfColor":36,"./UrdfCylinder":37,"./UrdfLink":39,"./UrdfMaterial":40,"./UrdfMesh":41,"./UrdfModel":42,"./UrdfSphere":43,"./UrdfTypes":44,"./UrdfVisual":45,"object-assign":3}],47:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) 'use strict'; var UPPER32 = Math.pow(2, 32); var warnedPrecision = false; @@ -22679,8 +23188,25 @@ if (typeof module !== 'undefined' && module.exports) { module.exports = cborTypedArrayTagger; } +<<<<<<< HEAD },{}],108:[function(require,module,exports){ (function (Buffer){(function (){ +======= +},{}],48:[function(require,module,exports){ +exports.DOMImplementation = window.DOMImplementation; +exports.XMLSerializer = window.XMLSerializer; +exports.DOMParser = window.DOMParser; + +},{}],49:[function(require,module,exports){ +module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; + +},{}],50:[function(require,module,exports){ +/* global document */ +module.exports = function Canvas() { + return document.createElement('canvas'); +}; +},{}],51:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Ramon Wijnands - rayman747@hotmail.com @@ -22714,9 +23240,13 @@ function decompressPng(data, callback) { } module.exports = decompressPng; +<<<<<<< HEAD }).call(this)}).call(this,require("buffer").Buffer) },{"buffer":11,"pngparse":43}],109:[function(require,module,exports){ "use strict"; +======= +},{"canvas":50}],52:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now var work = require('webworkify'); @@ -22774,8 +23304,12 @@ var WorkerSocket = /** @class */ (function () { }()); module.exports = WorkerSocket; +<<<<<<< HEAD },{"./workerSocketImpl":110,"webworkify":68,"webworkify-webpack":67}],110:[function(require,module,exports){ "use strict"; +======= +},{"./workerSocketImpl":53,"webworkify":7,"webworkify-webpack":6}],53:[function(require,module,exports){ +>>>>>>> 22a24aa (Add action client support) var WebSocket = WebSocket || require('ws'); module.exports = function (self) { var socket = null; @@ -22821,4 +23355,8 @@ module.exports = function (self) { }); }; +<<<<<<< HEAD },{"ws":71}]},{},[73]); +======= +},{"ws":49}]},{},[9]); +>>>>>>> 22a24aa (Add action client support) diff --git a/build/roslib.min.js b/build/roslib.min.js index f28ac832b..98e9cc8f4 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1,5 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>2),s=0;s>6):(s<55296?n.push(224|s>>12):(s=65536+((s=(1023&s)<<10)|1023&t.charCodeAt(++r)),n.push(240|s>>18),n.push(128|s>>12&63)),n.push(128|s>>6&63)),n.push(128|63&s))}return m(3,n.length),p(n);default:if(Array.isArray(t))for(m(4,o=t.length),r=0;r>5!==e)throw"Invalid indefinite length element";return i}function A(e,t){for(var i=0;i>10),e.push(56320|1023&n))}}"function"!=typeof d&&(d=function(e){return e}),"function"!=typeof y&&(y=function(){return M});var e=function e(){var t,i,n=x(),r=n>>5,n=31&n;if(7==r)switch(n){case 25:var s=new ArrayBuffer(4),s=new DataView(s),o=T(),a=31744&o,c=1023&o;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=c)return c*U;return s.setUint32(0,(32768&o)<<16|a<<13|c<<13),s.getFloat32(0);case 26:return w(g.getFloat32(b),4);case 27:return w(g.getFloat64(b),8)}if((t=S(n))<0&&(r<2||6this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,c))):l._listeners=t,!0;return!0}.call(this,e,t,i):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),i?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=t,r},r.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var i=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;o=this._events[e],i.push({_listeners:o})}for(var r=0;rt.secs)&&(e.secs>>>>>> 22a24aa (Add action client support) diff --git a/examples/fibonacci.html b/examples/fibonacci_client.html similarity index 72% rename from examples/fibonacci.html rename to examples/fibonacci_client.html index 463acc4b0..7d937b29f 100644 --- a/examples/fibonacci.html +++ b/examples/fibonacci_client.html @@ -39,30 +39,25 @@ // The ActionClient // ---------------- - var fibonacciClient = new ROSLIB.ActionClient({ + var fibonacciClient = new ROSLIB.Action({ ros : ros, - serverName : '/fibonacci', - actionName : 'actionlib_tutorials/FibonacciAction' + name : '/fibonacci', + actionType : 'action_tutorials_interfaces/Fibonacci' }); - // Create a goal. - var goal = new ROSLIB.Goal({ - actionClient : fibonacciClient, - goalMessage : { - order : 7 - } + // Send an action goal + var goal = new ROSLIB.ActionGoal({ + order: 5, }); - // Print out their output into the terminal. - goal.on('feedback', function(feedback) { - console.log('Feedback: ' + feedback.sequence); - }); - goal.on('result', function(result) { - console.log('Final Result: ' + result.sequence); - }); - - // Send the goal to the action server. - goal.send(); + fibonacciClient.sendGoal(goal, + function(result) { + console.log('Result for action goal on ' + fibonacciClient.name + ': ' + result.result.sequence); + }, + function(feedback) { + console.log('Feedback for action on ' + fibonacciClient.name + ': ' + feedback.partial_sequence); + }, + ); @@ -71,9 +66,8 @@

Fibonacci ActionClient Example

Run the following commands in the terminal then refresh this page. Check the JavaScript console for the output.

    -
  1. roscore
  2. -
  3. rosrun actionlib_tutorials fibonacci_server
  4. -
  5. roslaunch rosbridge_server rosbridge_websocket.launch
  6. +
  7. ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  8. +
  9. ros2 run action_tutorials_py fibonacci_action_server

diff --git a/examples/simple.html b/examples/simple.html index 1da8cdefa..3799dbdc3 100644 --- a/examples/simple.html +++ b/examples/simple.html @@ -65,8 +65,8 @@ // And finally, publish. cmdVel.publish(twist); - //Subscribing to a Topic - //---------------------- + // Subscribing to a Topic + // ---------------------- // Like when publishing a topic, we first create a Topic object with details of the topic's name // and message type. Note that we can call publish or subscribe on the same topic object. @@ -91,7 +91,7 @@ var addTwoIntsClient = new ROSLIB.Service({ ros : ros, name : '/add_two_ints', - serviceType : 'rospy_tutorials/AddTwoInts' + serviceType : 'example_interfaces/AddTwoInts' }); // Then we create a Service Request. The object we pass in to ROSLIB.ServiceRequest matches the @@ -124,38 +124,6 @@ response['message'] = 'Set successfully'; return true; }); - - // Setting a param value - // --------------------- - - ros.getParams(function(params) { - console.log(params); - }); - - // First, we create a Param object with the name of the param. - var maxVelX = new ROSLIB.Param({ - ros : ros, - name : 'max_vel_y' - }); - - //Then we set the value of the param, which is sent to the ROS Parameter Server. - maxVelX.set(0.8); - maxVelX.get(function(value) { - console.log('MAX VAL: ' + value); - }); - - // Getting a param value - // --------------------- - - var favoriteColor = new ROSLIB.Param({ - ros : ros, - name : 'favorite_color' - }); - - favoriteColor.set('red'); - favoriteColor.get(function(value) { - console.log('My robot\'s favorite color is ' + value); - }); @@ -164,11 +132,10 @@

Simple roslib Example

Run the following commands in the terminal then refresh this page. Check the JavaScript console for the output.

    -
  1. roscore
  2. -
  3. rostopic pub /listener std_msgs/String "Hello, World"
  4. -
  5. rostopic echo /cmd_vel
  6. -
  7. rosrun rospy_tutorials add_two_ints_server
  8. -
  9. roslaunch rosbridge_server rosbridge_websocket.launch
  10. +
  11. ros2 topic pub /listener std_msgs/msg/String "{ data: 'hello world' }"
  12. +
  13. ros2 topic echo /cmd_vel
  14. +
  15. ros2 run rclpy_tutorials add_two_ints_server_py
  16. +
  17. ros2 launch rosbridge_server rosbridge_websocket_launch.xml

diff --git a/src/core/Action.js b/src/core/Action.js new file mode 100644 index 000000000..bbc3a78af --- /dev/null +++ b/src/core/Action.js @@ -0,0 +1,75 @@ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var ActionGoal = require('./ActionGoal'); +var ActionFeedback = require('./ActionFeedback'); +var ActionResult = require('./ActionResult'); +var EventEmitter2 = require('eventemitter2').EventEmitter2; + +/** + * A ROS action client. + * + * @constructor + * @params options - possible keys include: + * * ros - the ROSLIB.Ros connection handle + * * name - the service name, like '/fibonacci' + * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' + */ +function Action(options) { + options = options || {}; + this.ros = options.ros; + this.name = options.name; + this.actionType = options.actionType; + this.isAdvertised = false; + + this._serviceCallback = null; +} +Action.prototype.__proto__ = EventEmitter2.prototype; + +/** + * Calls the service. Returns the service response in the + * callback. Does nothing if this service is currently advertised. + * + * @param request - the ROSLIB.ServiceRequest to send + * @param resultCallback - function with params: + * * result - the result from the action + * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: + * * feedback - the feedback from the action + * @param failedCallback - the callback function when the action failed (optional). Params: + * * error - the error message reported by ROS + */ +Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback) { + if (this.isAdvertised) { + return; + } + + var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); + + if (resultCallback || failedCallback) { + this.ros.on(actionGoalId, function(message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } + } else if (message.op === "action_feedback" && typeof feedbackCallback === 'function') { + feedbackCallback(new ActionResult(message.values)); + } else if (message.op === "action_result" && typeof resultCallback === 'function') { + resultCallback(new ActionResult(message.values)); + } + }); + } + + var call = { + op : 'send_action_goal', + id : actionGoalId, + action : this.name, + action_type: this.actionType, + args : request, + feedback : true, + }; + this.ros.callOnConnection(call); +}; + +module.exports = Action; diff --git a/src/core/ActionFeedback.js b/src/core/ActionFeedback.js new file mode 100644 index 000000000..60be0f7c2 --- /dev/null +++ b/src/core/ActionFeedback.js @@ -0,0 +1,18 @@ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var assign = require('object-assign'); + +/** + * An ActionFeedback is periodically returned during an in-progress action + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionGoal(values) { + assign(this, values); +} + +module.exports = ActionFeedback; diff --git a/src/core/ActionGoal.js b/src/core/ActionGoal.js new file mode 100644 index 000000000..ff9b3773a --- /dev/null +++ b/src/core/ActionGoal.js @@ -0,0 +1,18 @@ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var assign = require('object-assign'); + +/** + * An ActionGoal is passed into an action goal request. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionGoal(values) { + assign(this, values); +} + +module.exports = ActionGoal; diff --git a/src/core/ActionResult.js b/src/core/ActionResult.js new file mode 100644 index 000000000..6eb002363 --- /dev/null +++ b/src/core/ActionResult.js @@ -0,0 +1,18 @@ +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ + +var assign = require('object-assign'); + +/** + * An ActionResult is returned from sending an action goal. + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionResult(values) { + assign(this, values); +} + +module.exports = ActionResult; diff --git a/src/core/SocketAdapter.js b/src/core/SocketAdapter.js index 664562fe4..4e777e830 100644 --- a/src/core/SocketAdapter.js +++ b/src/core/SocketAdapter.js @@ -39,6 +39,12 @@ function SocketAdapter(client) { client.emit(message.id, message); } else if (message.op === 'call_service') { client.emit(message.service, message); + } else if (message.op === 'send_action_goal') { + client.emit(message.action, message); + } else if (message.op === 'action_feedback') { + client.emit(message.id, message); + } else if (message.op === 'action_result') { + client.emit(message.id, message); } else if (message.op === 'status') { if (message.id) { client.emit('status:' + message.id, message); diff --git a/src/core/index.js b/src/core/index.js index 13ab113c4..08894bcf9 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -5,3 +5,7 @@ export const Param = require('./Param'); export const Service = require('./Service'); export const ServiceRequest = require('./ServiceRequest'); export const ServiceResponse = require('./ServiceResponse'); +export const Action = require('./Action'); +export const ActionGoal = require('./ActionGoal'); +export const ActionFeedback = require('./ActionFeedback'); +export const ActionResult = require('./ActionResult'); From b12ea1ad7694c633d8fe156dc105d33647109931 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Mon, 6 Nov 2023 12:14:28 -0500 Subject: [PATCH 42/66] lint --- src/core/Action.js | 4 ++-- src/core/ActionFeedback.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/Action.js b/src/core/Action.js index bbc3a78af..7430f5a8a 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -53,9 +53,9 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, if (typeof failedCallback === 'function') { failedCallback(message.values); } - } else if (message.op === "action_feedback" && typeof feedbackCallback === 'function') { + } else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { feedbackCallback(new ActionResult(message.values)); - } else if (message.op === "action_result" && typeof resultCallback === 'function') { + } else if (message.op === 'action_result' && typeof resultCallback === 'function') { resultCallback(new ActionResult(message.values)); } }); diff --git a/src/core/ActionFeedback.js b/src/core/ActionFeedback.js index 60be0f7c2..000992a83 100644 --- a/src/core/ActionFeedback.js +++ b/src/core/ActionFeedback.js @@ -11,7 +11,7 @@ var assign = require('object-assign'); * @constructor * @param values - object matching the fields defined in the .action definition file */ -function ActionGoal(values) { +function ActionFeedback(values) { assign(this, values); } From 7f438afe25a78d041966dba44763ca6916982477 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:41:21 -0500 Subject: [PATCH 43/66] Implement action server and update example --- build/core/Action.d.ts | 21 +- build/core/ActionFeedback.d.ts | 19 +- build/core/index.d.ts | 2 +- build/roslib.js | 11330 +++++++++++++++---------------- build/roslib.min.js | 6 +- examples/fibonacci_client.html | 2 +- examples/fibonacci_server.html | 57 +- src/RosLib.js | 2 - src/core/Action.js | 89 +- src/core/SocketAdapter.js | 2 + 10 files changed, 5817 insertions(+), 5713 deletions(-) diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index a49c9eb49..54d9a2204 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -24,7 +24,8 @@ declare class Action { name: any; actionType: any; isAdvertised: boolean; - _serviceCallback: any; + _actionCallback: any; + _cancelCallback: any; __proto__: EventEmitter2; /** * Calls the service. Returns the service response in the @@ -38,7 +39,23 @@ declare class Action { * @param failedCallback - the callback function when the action failed (optional). Params: * * error - the error message reported by ROS */ - sendGoal(request: any, resultCallback: any, feedbackCallback: any, failedCallback: any): void; + sendGoal(request: any, resultCallback: any, feedbackCallback: any, failedCallback: any): string | undefined; + cancelGoal(id: any): void; + /** + * Advertise the action. This turns the Action object from a client + * into a server. The callback will be called with every goal sent to this action. + * + * @param callback - This works similarly to the callback for a C++ action and should take the following params: + * * goal - the action goal + * It should return true if the action has finished successfully, + * i.e. without any fatal errors. + */ + advertise(callback: any): void; + unadvertise(): void; + _executeAction(rosbridgeRequest: any): void; + sendFeedback(id: any, feedback: any): void; + setSucceeded(id: any, result: any): void; + setFailed(id: any): void; } import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; diff --git a/build/core/ActionFeedback.d.ts b/build/core/ActionFeedback.d.ts index 1cce63507..32a3c5b16 100644 --- a/build/core/ActionFeedback.d.ts +++ b/build/core/ActionFeedback.d.ts @@ -1,2 +1,17 @@ -declare const _exports: any; -export = _exports; +export = ActionFeedback; +/** + * An ActionFeedback is periodically returned during an in-progress action + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +declare function ActionFeedback(values: any): void; +declare class ActionFeedback { + /** + * An ActionFeedback is periodically returned during an in-progress action + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ + constructor(values: any); +} diff --git a/build/core/index.d.ts b/build/core/index.d.ts index ab5aad122..dd1a94ee7 100644 --- a/build/core/index.d.ts +++ b/build/core/index.d.ts @@ -7,5 +7,5 @@ export const ServiceRequest: typeof import("./ServiceRequest"); export const ServiceResponse: typeof import("./ServiceResponse"); export const Action: typeof import("./Action"); export const ActionGoal: typeof import("./ActionGoal"); -export const ActionFeedback: any; +export const ActionFeedback: typeof import("./ActionFeedback"); export const ActionResult: typeof import("./ActionResult"); diff --git a/build/roslib.js b/build/roslib.js index c44213a5c..ab7c2e35b 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -2,7 +2,7 @@ (function (global){(function (){ 'use strict'; -var objectAssign = require('object-assign'); +var objectAssign = require('object.assign/polyfill')(); // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: @@ -508,3687 +508,3062 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":31,"util/":4}],2:[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 - } -} +},{"object.assign/polyfill":38,"util/":73}],2:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; -},{}],3:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],4:[function(require,module,exports){ -(function (process,global){(function (){ -// 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. +var possibleNames = [ + 'BigInt64Array', + 'BigUint64Array', + 'Float32Array', + 'Float64Array', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray' +]; -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } +var g = typeof globalThis === 'undefined' ? global : globalThis; - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; +module.exports = function availableTypedArrays() { + var out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + out[out.length] = possibleNames[i]; + } + } + return out; }; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],3:[function(require,module,exports){ +'use strict' -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray - if (process.noDeprecation === true) { - return fn; - } +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} - return deprecated; -}; +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 +function getLens (b64) { + var len = b64.length -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') } - return debugs[set]; -}; + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] } -exports.inspect = inspect; +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; + var curByte = 0 - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } -function stylizeNoColor(str, styleType) { - return str; -} + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } -function arrayToHash(array) { - var hash = {}; + return arr +} - array.forEach(function(val, idx) { - hash[val] = true; - }); +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} - return hash; +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + 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 parts = [] + var maxChunkLength = 16383 // must be multiple of 3 -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; + // 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))) } - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) } - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); + return parts.join('') +} - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } +},{}],4:[function(require,module,exports){ - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } +},{}],5:[function(require,module,exports){ +(function (process,Buffer){(function (){ +'use strict'; +/* eslint camelcase: "off" */ - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } +var assert = require('assert'); - var base = '', array = false, braces = ['{', '}']; +var Zstream = require('pako/lib/zlib/zstream'); +var zlib_deflate = require('pako/lib/zlib/deflate.js'); +var zlib_inflate = require('pako/lib/zlib/inflate.js'); +var constants = require('pako/lib/zlib/constants'); - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } +for (var key in constants) { + exports[key] = constants[key]; +} - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); } - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; +} - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } + this.pending_close = false; - ctx.seen.push(value); + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); } - ctx.seen.pop(); + this.mode = exports.NONE; - return reduceToSingleString(output, base, braces); -} + this.dictionary = null; +}; +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +}; -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +}; +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); + this.write_in_progress = true; -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} + assert.equal(false, flush === undefined, 'must provide flush value'); + this.write_in_progress = true; -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); } - return name + ': ' + str; -} + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; + } + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); + if (!async) { + // sync version + this._process(); - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; + if (this._checkError()) { + return this._afterSync(); + } + return; } - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} + // async version + var self = this; + process.nextTick(function () { + self._process(); + self._after(); + }); + return this; +}; -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; + this.write_in_progress = false; -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; + return [avail_in, avail_out]; +}; -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; +Zlib.prototype._process = function () { + var next_expected_header_byte = null; -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush -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 = require('./support/isBuffer'); + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. -function objectToString(o) { - return Object.prototype.toString.call(o); -} + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} + return true; +}; +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} + this.write_in_progress = false; + // call the write() cb + this.callback(avail_in, avail_out); -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); + if (this.pending_close) { + this.close(); + } }; +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; + } + this.onerror(message, this.err -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); } - return origin; }; -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":3,"_process":44,"inherits":2}],5:[function(require,module,exports){ -(function (global){(function (){ -'use strict'; + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); -var possibleNames = [ - 'BigInt64Array', - 'BigUint64Array', - 'Float32Array', - 'Float64Array', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray' -]; + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); -var g = typeof globalThis === 'undefined' ? global : globalThis; + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); -module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - return out; + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); }; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],6:[function(require,module,exports){ -'use strict' +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} + this.flush = exports.Z_NO_FLUSH; -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 + this.err = exports.Z_OK; -function getLens (b64) { - var len = b64.length + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') + if (this.mode === exports.UNZIP) { + this.windowBits += 32; } - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) + this.strm = new Zstream(); - return [validLen, placeHoldersLen] -} + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); + } -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + if (this.err !== exports.Z_OK) { + this._error('Init error'); + } -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + this.dictionary = dictionary; -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen + this.write_in_progress = false; + this.init_done = true; +}; - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; } - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } + this.err = exports.Z_OK; - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; } - 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) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); } - 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 parts = [] - var maxChunkLength = 16383 // must be multiple of 3 +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; - // 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))) + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; } - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); } +}; - return parts.join('') -} - -},{}],7:[function(require,module,exports){ - -},{}],8:[function(require,module,exports){ -(function (process,Buffer){(function (){ +exports.Zlib = Zlib; +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":51,"assert":1,"buffer":8,"pako/lib/zlib/constants":41,"pako/lib/zlib/deflate.js":43,"pako/lib/zlib/inflate.js":45,"pako/lib/zlib/zstream":49}],6:[function(require,module,exports){ +(function (process){(function (){ 'use strict'; -/* eslint camelcase: "off" */ -var assert = require('assert'); +var Buffer = require('buffer').Buffer; +var Transform = require('stream').Transform; +var binding = require('./binding'); +var util = require('util'); +var assert = require('assert').ok; +var kMaxLength = require('buffer').kMaxLength; +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; -var Zstream = require('pako/lib/zlib/zstream'); -var zlib_deflate = require('pako/lib/zlib/deflate.js'); -var zlib_inflate = require('pako/lib/zlib/inflate.js'); -var constants = require('pako/lib/zlib/constants'); +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; -for (var key in constants) { - exports[key] = constants[key]; -} +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; -// zlib modes -exports.NONE = 0; -exports.DEFLATE = 1; -exports.INFLATE = 2; -exports.GZIP = 3; -exports.GUNZIP = 4; -exports.DEFLATERAW = 5; -exports.INFLATERAW = 6; -exports.UNZIP = 7; +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; -var GZIP_HEADER_ID1 = 0x1f; -var GZIP_HEADER_ID2 = 0x8b; +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; -/** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ -function Zlib(mode) { - if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { - throw new TypeError('Bad argument'); +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); } - - this.dictionary = null; - this.err = 0; - this.flush = 0; - this.init_done = false; - this.level = 0; - this.memLevel = 0; - this.mode = mode; - this.strategy = 0; - this.windowBits = 0; - this.write_in_progress = false; - this.pending_close = false; - this.gzip_id_bytes_read = 0; } -Zlib.prototype.close = function () { - if (this.write_in_progress) { - this.pending_close = true; - return; - } +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; - this.pending_close = false; +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} - assert(this.init_done, 'close before init'); - assert(this.mode <= exports.UNZIP); +Object.defineProperty(exports, 'codes', { + enumerable: true, value: Object.freeze(codes), writable: false +}); - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { - zlib_inflate.inflateEnd(this.strm); - } +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; - this.mode = exports.NONE; +exports.createDeflate = function (o) { + return new Deflate(o); +}; - this.dictionary = null; +exports.createInflate = function (o) { + return new Inflate(o); }; -Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); }; -Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +exports.createInflateRaw = function (o) { + return new InflateRaw(o); }; -Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { - assert.equal(arguments.length, 8); +exports.createGzip = function (o) { + return new Gzip(o); +}; - assert(this.init_done, 'write before init'); - assert(this.mode !== exports.NONE, 'already finalized'); - assert.equal(false, this.write_in_progress, 'write already in progress'); - assert.equal(false, this.pending_close, 'close is pending'); +exports.createGunzip = function (o) { + return new Gunzip(o); +}; - this.write_in_progress = true; +exports.createUnzip = function (o) { + return new Unzip(o); +}; - assert.equal(false, flush === undefined, 'must provide flush value'); +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; - this.write_in_progress = true; +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; - if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { - throw new Error('Invalid flush value'); +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; - if (input == null) { - input = Buffer.alloc(0); - in_len = 0; - in_off = 0; - } +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; - this.strm.avail_in = in_len; - this.strm.input = input; - this.strm.next_in = in_off; - this.strm.avail_out = out_len; - this.strm.output = out; - this.strm.next_out = out_off; - this.flush = flush; +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; - if (!async) { - // sync version - this._process(); +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; - if (this._checkError()) { - return this._afterSync(); - } - return; +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; - // async version - var self = this; - process.nextTick(function () { - self._process(); - self._after(); - }); - - return this; +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); }; -Zlib.prototype._afterSync = function () { - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; - this.write_in_progress = false; +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; - return [avail_in, avail_out]; +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); }; -Zlib.prototype._process = function () { - var next_expected_header_byte = null; +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; - // If the avail_out is left at 0, then it means that it ran out - // of room. If there was avail_out left over, then it means - // that all of the input was consumed. - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflate(this.strm, this.flush); - break; - case exports.UNZIP: - if (this.strm.avail_in > 0) { - next_expected_header_byte = this.strm.next_in; - } +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; - switch (this.gzip_id_bytes_read) { - case 0: - if (next_expected_header_byte === null) { - break; - } +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { - this.gzip_id_bytes_read = 1; - next_expected_header_byte++; +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; - if (this.strm.avail_in === 1) { - // The only available byte was already read. - break; - } - } else { - this.mode = exports.INFLATE; - break; - } + engine.on('error', onError); + engine.on('end', onEnd); - // fallthrough - case 1: - if (next_expected_header_byte === null) { - break; - } + engine.end(buffer); + flow(); - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { - this.gzip_id_bytes_read = 2; - this.mode = exports.GUNZIP; - } else { - // There is no actual difference between INFLATE and INFLATERAW - // (after initialization). - this.mode = exports.INFLATE; - } + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } - break; - default: - throw new Error('invalid number of gzip magic number bytes read'); - } + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } - // fallthrough - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - this.err = zlib_inflate.inflate(this.strm, this.flush + function onEnd() { + var buf; + var err = null; - // If data was encoded with dictionary - );if (this.err === exports.Z_NEED_DICT && this.dictionary) { - // Load it - this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); - if (this.err === exports.Z_OK) { - // And try to decode again - this.err = zlib_inflate.inflate(this.strm, this.flush); - } else if (this.err === exports.Z_DATA_ERROR) { - // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. - // Make it possible for After() to tell a bad dictionary from bad - // input. - this.err = exports.Z_NEED_DICT; - } - } - while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { - // Bytes remain in input buffer. Perhaps this is another compressed - // member in the same archive, or just trailing garbage. - // Trailing zero bytes are okay, though, since they are frequently - // used for padding. + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } - this.reset(); - this.err = zlib_inflate.inflate(this.strm, this.flush); - } - break; - default: - throw new Error('Unknown mode ' + this.mode); + buffers = []; + engine.close(); + callback(err, buf); } -}; +} -Zlib.prototype._checkError = function () { - // Acceptable error states depend on the type of zlib stream. - switch (this.err) { - case exports.Z_OK: - case exports.Z_BUF_ERROR: - if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { - this._error('unexpected end of file'); - return false; - } - break; - case exports.Z_STREAM_END: - // normal statuses, not fatal - break; - case exports.Z_NEED_DICT: - if (this.dictionary == null) { - this._error('Missing dictionary'); - } else { - this._error('Bad dictionary'); - } - return false; - default: - // something else. - this._error('Zlib error'); - return false; - } +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); - return true; -}; + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); -Zlib.prototype._after = function () { - if (!this._checkError()) { - return; - } - - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; + var flushFlag = engine._finishFlushFlag; - this.write_in_progress = false; + return engine._processChunk(buffer, flushFlag); +} - // call the write() cb - this.callback(avail_in, avail_out); +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} - if (this.pending_close) { - this.close(); - } -}; +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} -Zlib.prototype._error = function (message) { - if (this.strm.msg) { - message = this.strm.msg; - } - this.onerror(message, this.err +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} - // no hope of rescue. - );this.write_in_progress = false; - if (this.pending_close) { - this.close(); - } -}; +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} -Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { - assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} - assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); - assert(level >= -1 && level <= 9, 'invalid compression level'); +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} - assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} - assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} - this._init(level, windowBits, memLevel, strategy, dictionary); - this._setDictionary(); -}; +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. -Zlib.prototype.params = function () { - throw new Error('deflateParams Not supported'); -}; +function Zlib(opts, mode) { + var _this = this; -Zlib.prototype.reset = function () { - this._reset(); - this._setDictionary(); -}; + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; -Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { - this.level = level; - this.windowBits = windowBits; - this.memLevel = memLevel; - this.strategy = strategy; + Transform.call(this, opts); - this.flush = exports.Z_NO_FLUSH; + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); + } - this.err = exports.Z_OK; + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { - this.windowBits += 16; + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } } - if (this.mode === exports.UNZIP) { - this.windowBits += 32; + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } } - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { - this.windowBits = -1 * this.windowBits; + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } } - this.strm = new Zstream(); + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); - break; - default: - throw new Error('Unknown mode ' + this.mode); + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } } - if (this.err !== exports.Z_OK) { - this._error('Init error'); + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } } - this.dictionary = dictionary; + this._handle = new binding.Zlib(mode); - this.write_in_progress = false; - this.init_done = true; -}; + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; -Zlib.prototype._setDictionary = function () { - if (this.dictionary == null) { - return; - } + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; - this.err = exports.Z_OK; + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); - break; - default: - break; - } + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; - if (this.err !== exports.Z_OK) { - this._error('Failed to set dictionary'); - } -}; + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); -Zlib.prototype._reset = function () { - this.err = exports.Z_OK; + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - case exports.GZIP: - this.err = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - case exports.GUNZIP: - this.err = zlib_inflate.inflateReset(this.strm); - break; - default: - break; + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); } - if (this.err !== exports.Z_OK) { - this._error('Failed to reset stream'); + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + process.nextTick(callback); } }; -exports.Zlib = Zlib; -}).call(this)}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":44,"assert":1,"buffer":11,"pako/lib/zlib/constants":34,"pako/lib/zlib/deflate.js":36,"pako/lib/zlib/inflate.js":38,"pako/lib/zlib/zstream":42}],9:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; -var Buffer = require('buffer').Buffer; -var Transform = require('stream').Transform; -var binding = require('./binding'); -var util = require('util'); -var assert = require('assert').ok; -var kMaxLength = require('buffer').kMaxLength; -var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; - -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = 16 * 1024; +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; + var ws = this._writableState; -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } -// expose all the zlib constants -var bkeys = Object.keys(binding); -for (var bk = 0; bk < bkeys.length; bk++) { - var bkey = bkeys[bk]; - if (bkey.match(/^Z/)) { - Object.defineProperty(exports, bkey, { - enumerable: true, value: binding[bkey], writable: false - }); + if (ws.ended) { + if (callback) process.nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); + } + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); } -} +}; -// translation table for return codes. -var codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR +Zlib.prototype.close = function (callback) { + _close(this, callback); + process.nextTick(emitCloseNT, this); }; -var ckeys = Object.keys(codes); -for (var ck = 0; ck < ckeys.length; ck++) { - var ckey = ckeys[ck]; - codes[codes[ckey]] = ckey; -} +function _close(engine, callback) { + if (callback) process.nextTick(callback); -Object.defineProperty(exports, 'codes', { - enumerable: true, value: Object.freeze(codes), writable: false -}); + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; + engine._handle.close(); + engine._handle = null; +} -exports.createDeflate = function (o) { - return new Deflate(o); -}; +function emitCloseNT(self) { + self.emit('close'); +} -exports.createInflate = function (o) { - return new Inflate(o); -}; +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); -exports.createDeflateRaw = function (o) { - return new DeflateRaw(o); -}; + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); -exports.createInflateRaw = function (o) { - return new InflateRaw(o); -}; + if (!this._handle) return cb(new Error('zlib binding closed')); -exports.createGzip = function (o) { - return new Gzip(o); -}; + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } -exports.createGunzip = function (o) { - return new Gunzip(o); + this._processChunk(chunk, flushFlag, cb); }; -exports.createUnzip = function (o) { - return new Unzip(o); -}; +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); -}; + var self = this; -exports.deflateSync = function (buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); -}; + var async = typeof cb === 'function'; -exports.gzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); -}; + if (!async) { + var buffers = []; + var nread = 0; -exports.gzipSync = function (buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); -}; + var error; + this.on('error', function (er) { + error = er; + }); -exports.deflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); -}; + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); -exports.deflateRawSync = function (buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); -}; + if (this._hadError) { + throw error; + } -exports.unzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Unzip(opts), buffer, callback); -}; + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } -exports.unzipSync = function (buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); -}; + var buf = Buffer.concat(buffers, nread); + _close(this); -exports.inflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; + return buf; } - return zlibBuffer(new Inflate(opts), buffer, callback); -}; -exports.inflateSync = function (buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -}; + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len -exports.gunzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gunzip(opts), buffer, callback); -}; + req.buffer = chunk; + req.callback = callback; -exports.gunzipSync = function (buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); -}; + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } -exports.inflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); -}; + if (self._hadError) return; -exports.inflateRawSync = function (buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); -}; - -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); - engine.end(buffer); - flow(); + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); } - engine.once('readable', flow); - } - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; - function onEnd() { - var buf; - var err = null; + if (!async) return true; - if (nread >= kMaxLength) { - err = new RangeError(kRangeErrorMessage); - } else { - buf = Buffer.concat(buffers, nread); + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; } - buffers = []; - engine.close(); - callback(err, buf); + if (!async) return false; + + // finished with the chunk. + cb(); } -} +}; -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') buffer = Buffer.from(buffer); +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); +}).call(this)}).call(this,require('_process')) +},{"./binding":5,"_process":51,"assert":1,"buffer":8,"stream":68,"util":76}],7:[function(require,module,exports){ +arguments[4][4][0].apply(exports,arguments) +},{"dup":4}],8:[function(require,module,exports){ +(function (Buffer){(function (){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ - if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); +'use strict' - var flushFlag = engine._finishFlushFlag; +var base64 = require('base64-js') +var ieee754 = require('ieee754') - return engine._processChunk(buffer, flushFlag); -} +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} +var K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} +/** + * 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() -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); +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 Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); +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 + } } -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + buf.__proto__ = Buffer.prototype + return buf } -function isValidFlushFlag(flag) { - return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +/** + * 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 TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) } -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. +// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 +if (typeof Symbol !== 'undefined' && Symbol.species != null && + Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }) +} -function Zlib(opts, mode) { - var _this = this; +Buffer.poolSize = 8192 // not used by this implementation - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } - Transform.call(this, opts); + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) + } - if (opts.flush && !isValidFlushFlag(opts.flush)) { - throw new Error('Invalid flush flag: ' + opts.flush); + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) } - if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { - throw new Error('Invalid flush flag: ' + opts.finishFlush); + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) } - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) } - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } + var b = fromObject(value) + if (b) return b - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) } - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } +/** + * 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 of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') } +} - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } +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) +} - this._handle = new binding.Zlib(mode); +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} - var self = this; - this._hadError = false; - this._handle.onerror = function (message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - _close(self); - self._hadError = true; +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; +/** + * 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) +} - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } - this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) - this._buffer = Buffer.allocUnsafe(this._chunkSize); - this._offset = 0; - this._level = level; - this._strategy = strategy; + var actual = buf.write(string, encoding) - this.once('end', this.close); + 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) + } - Object.defineProperty(this, '_closed', { - get: function () { - return !_this._handle; - }, - configurable: true, - enumerable: true - }); + return buf } -util.inherits(Zlib, Transform); +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 +} -Zlib.prototype.params = function (level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') } - if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') } - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function () { - assert(self._handle, 'zlib binding closed'); - self._handle.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) } else { - process.nextTick(callback); + buf = new Uint8Array(array, byteOffset, length) } -}; - -Zlib.prototype.reset = function () { - assert(this._handle, 'zlib binding closed'); - return this._handle.reset(); -}; -// This is the _flush function called by the transform class, -// internally, when the last chunk has been written. -Zlib.prototype._flush = function (callback) { - this._transform(Buffer.alloc(0), '', callback); -}; + // Return an augmented `Uint8Array` instance + buf.__proto__ = Buffer.prototype + return buf +} -Zlib.prototype.flush = function (kind, callback) { - var _this2 = this; +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + var buf = createBuffer(len) - var ws = this._writableState; + if (buf.length === 0) { + return buf + } - if (typeof kind === 'function' || kind === undefined && !callback) { - callback = kind; - kind = binding.Z_FULL_FLUSH; + obj.copy(buf, 0, 0, len) + return buf } - if (ws.ended) { - if (callback) process.nextTick(callback); - } else if (ws.ending) { - if (callback) this.once('end', callback); - } else if (ws.needDrain) { - if (callback) { - this.once('drain', function () { - return _this2.flush(kind, callback); - }); + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) } - } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); + return fromArrayLike(obj) } -}; - -Zlib.prototype.close = function (callback) { - _close(this, callback); - process.nextTick(emitCloseNT, this); -}; - -function _close(engine, callback) { - if (callback) process.nextTick(callback); - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) return; - engine._handle.close(); - engine._handle = null; + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } } -function emitCloseNT(self) { - self.emit('close'); +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 } -Zlib.prototype._transform = function (chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} - if (!this._handle) return cb(new Error('zlib binding closed')); +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) flushFlag = this._finishFlushFlag;else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) } - this._processChunk(chunk, flushFlag, cb); -}; + if (a === b) return 0 -Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; + var x = a.length + var y = b.length - var self = this; + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } - var async = typeof cb === 'function'; + if (x < y) return -1 + if (y < x) return 1 + return 0 +} - if (!async) { - var buffers = []; - var nread = 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 + } +} - var error; - this.on('error', function (er) { - error = er; - }); +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); + if (list.length === 0) { + return Buffer.alloc(0) + } - if (this._hadError) { - throw error; + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length } + } - if (nread >= kMaxLength) { - _close(this); - throw new RangeError(kRangeErrorMessage); + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length } + return buffer +} - assert(this._handle, 'zlib binding closed'); - var req = this._handle.write(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } - req.buffer = chunk; - req.callback = callback; + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 - function callback(availInAfter, availOutAfter) { - // When the callback is used in an async write, the callback's - // context is the `req` object that was created. The req object - // is === this._handle, and that's why it's important to null - // out the values after they are done being used. `this._handle` - // can stay in memory longer than the callback and buffer are needed. - if (this) { - this.buffer = null; - this.callback = null; + // 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': + 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 mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true } + } +} +Buffer.byteLength = byteLength - if (self._hadError) return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } +function slowToString (encoding, start, end) { + var loweredCase = false - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += availInBefore - availInAfter; - availInBefore = availInAfter; + // 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 (!async) return true; + if (end === undefined || end > this.length) { + end = this.length + } - var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } + if (end <= 0) { + return '' + } - if (!async) return false; + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 - // finished with the chunk. - cb(); + if (end <= start) { + return '' } -}; -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); -}).call(this)}).call(this,require('_process')) -},{"./binding":8,"_process":44,"assert":1,"buffer":11,"stream":46,"util":66}],10:[function(require,module,exports){ -arguments[4][7][0].apply(exports,arguments) -},{"dup":7}],11:[function(require,module,exports){ -(function (Buffer){(function (){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ + if (!encoding) encoding = 'utf8' -'use strict' + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) -var base64 = require('base64-js') -var ieee754 = require('ieee754') + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 + case 'ascii': + return asciiSlice(this, start, end) -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) -/** - * 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() + case 'base64': + return base64Slice(this, start, end) -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.' - ) -} + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) -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 + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } } } -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) +// 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 -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') +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') } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this } -/** - * 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 TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) +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') } - return from(arg, encodingOrOffset, length) + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this } -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) +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.poolSize = 8192 // not used by this implementation +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) +} -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } +Buffer.prototype.toLocaleString = Buffer.prototype.toString - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } +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 +} - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) } - - if (typeof value === 'number') { + if (!Buffer.isBuffer(target)) { throw new TypeError( - 'The "value" argument must not be of type number. Received type number' + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) ) } - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length } - var b = fromObject(value) - if (b) return b + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 } - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 -/** - * 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) -} + if (this === target) return 0 -// 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 + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) -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) + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } } - 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) + if (x < y) return -1 + if (y < x) return 1 + return 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) -} +// 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 -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) + 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) } - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) + // 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 + } - var actual = buf.write(string, encoding) + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, 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) + // 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) } - return buf + throw new TypeError('val must be string, number or Buffer') } -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 arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') + 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 + } } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } } - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) + 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 { - buf = new Uint8Array(array, byteOffset, length) + 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 an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf + return -1 } -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} - if (buf.length === 0) { - return buf - } +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} - obj.copy(buf, 0, 0, len) - return buf - } +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) +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 } - return fromArrayLike(obj) } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) + var strLen = string.length + + 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 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 utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) } -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) } -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - 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 +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) } -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 - } +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } -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 (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') +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 } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && 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': - 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 mustMatch ? -1 : 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 + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining - if (end <= start) { - return '' + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' - while (true) { + var loweredCase = false + for (;;) { switch (encoding) { case 'hex': - return hexSlice(this, start, end) + return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': - return utf8Slice(this, start, end) + return utf8Write(this, string, offset, length) case 'ascii': - return asciiSlice(this, start, end) + return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': - return latin1Slice(this, start, end) + return latin1Write(this, string, offset, length) case 'base64': - return base64Slice(this, start, end) + // 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 utf16leSlice(this, start, end) + return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() + 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.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } } -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) +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) } - 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) +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 this + + return decodeCodePointsArray(res) } -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') +// 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() } - 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) + + // 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 this + return res } -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) +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 } -Buffer.prototype.toLocaleString = Buffer.prototype.toString +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) -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 + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret } -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} +function hexSlice (buf, start, end) { + var len = buf.length -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) } + return out +} - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') +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 +} - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 +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 (start >= end) { - return 1 + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len } - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 + if (end < start) end = start - if (this === target) return 0 + var newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + newBuf.__proto__ = Buffer.prototype + return newBuf +} - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) +/* + * 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') +} - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul } - if (x < y) return -1 - if (y < x) return 1 - return 0 + return val } -// 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) +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) } - // 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 + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul } - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } + return val +} - // 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) - } +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} - throw new TypeError('val must be string, number or Buffer') +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) } -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} - 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 - } - } +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } + 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 - 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 - } + 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 - return -1 + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val } -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 +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.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +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.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +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 } -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 - } - } +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - var strLen = string.length + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} - 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 +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]) } -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +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) } -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) +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) } -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) +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) } -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) +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 ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +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.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' - ) +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 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') + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF } - 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) + return offset + byteLength +} - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) +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) + } - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) + return offset + byteLength +} - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } +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.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } +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 } -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } +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 } -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] +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 +} - 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 +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 +} - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) - 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 - } - } - } - } + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } - 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 + 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 } - - res.push(codePoint) - i += bytesPerSequence + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } - return decodeCodePointsArray(res) + return offset + byteLength } -// 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 +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + checkInt(this, value, offset, byteLength, limit - 1, -limit) } - // 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) - ) + 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 res -} -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) + return offset + byteLength +} - 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 +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 } -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.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.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 +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 } -/* - * 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.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.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value 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 - } + 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 +} - return val +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') } -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value 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 + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } - - return val + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 } -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) } -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.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) } -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] + 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.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.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) } -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.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) } -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 -} +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + 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 -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') } - mul *= 0x80 + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') - if (val >= mul) val -= Math.pow(2, 8 * byteLength) + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } - return val -} + var len = end - start -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) -} + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } -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 + return len } -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 -} +// 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 (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) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + // 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') + } - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} + if (end <= start) { + return this + } -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} + if (!val) val = 0 -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) -} + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } -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) + return this } -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) -} +// HELPER FUNCTIONS +// ================ -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) +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // 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 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') +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) } -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) - } +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF + 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 offset + byteLength + return bytes } -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) +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 +} - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF +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 offset + byteLength + return byteArray } -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 +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) } -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 +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 offset + byteLength + return i } -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 +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) } - -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 +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare } -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 -} +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":3,"buffer":8,"ieee754":26}],9:[function(require,module,exports){ +'use strict'; -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 -} +var GetIntrinsic = require('get-intrinsic'); -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 -} +var callBind = require('./'); -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') -} +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); -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 -} +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} +},{"./":10,"get-intrinsic":18}],10:[function(require,module,exports){ +'use strict'; -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); +var setFunctionLength = require('set-function-length'); -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 -} +var $TypeError = GetIntrinsic('%TypeError%'); +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } } -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - 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('Index out of range') - 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 +module.exports = function callBind(originalFunction) { + if (typeof originalFunction !== 'function') { + throw new $TypeError('a function is required'); + } + var func = $reflectApply(bind, $call, arguments); + return setFunctionLength( + func, + 1 + $max(0, originalFunction.length - (arguments.length - 1)), + true + ); +}; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; - return len +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; } -// 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 (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) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } 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 - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - 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 takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // 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 -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -}).call(this)}).call(this,require("buffer").Buffer) -},{"base64-js":6,"buffer":11,"ieee754":26}],12:[function(require,module,exports){ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var callBind = require('./'); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; - -},{"./":13,"get-intrinsic":21}],13:[function(require,module,exports){ -'use strict'; - -var bind = require('function-bind'); -var GetIntrinsic = require('get-intrinsic'); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} - -},{"function-bind":20,"get-intrinsic":21}],14:[function(require,module,exports){ +},{"function-bind":17,"get-intrinsic":18,"set-function-length":67}],11:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -4596,24 +3971,77 @@ else if (!global.CBOR) })(this); -},{}],15:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ 'use strict'; +var hasPropertyDescriptors = require('has-property-descriptors')(); + var GetIntrinsic = require('get-intrinsic'); -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -if ($gOPD) { +var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true); +if ($defineProperty) { try { - $gOPD([], 'length'); + $defineProperty({}, 'a', { value: 1 }); } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; + // IE 8 has a broken defineProperty + $defineProperty = false; } } -module.exports = $gOPD; +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var gopd = require('gopd'); + +/** @type {(obj: Record, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } -},{"get-intrinsic":21}],16:[function(require,module,exports){ + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; + +},{"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],13:[function(require,module,exports){ (function (process,setImmediate){(function (){ /*! * EventEmitter2 @@ -4716,7 +4144,7 @@ module.exports = $gOPD; var obj = {}; var key; var len = keys.length; - var valuesCount = values ? value.length : 0; + var valuesCount = values ? values.length : 0; for (var i = 0; i < len; i++) { key = keys[i]; obj[key] = i < valuesCount ? values[i] : undefined; @@ -6246,7 +5674,7 @@ module.exports = $gOPD; }(); }).call(this)}).call(this,require('_process'),require("timers").setImmediate) -},{"_process":44,"timers":62}],17:[function(require,module,exports){ +},{"_process":51,"timers":70}],14:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6745,31 +6173,71 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { } } -},{}],18:[function(require,module,exports){ +},{}],15:[function(require,module,exports){ +'use strict'; + +var isCallable = require('is-callable'); -var hasOwn = Object.prototype.hasOwnProperty; -var toString = Object.prototype.toString; +var toStr = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; -module.exports = function forEach (obj, fn, ctx) { - if (toString.call(fn) !== '[object Function]') { - throw new TypeError('iterator must be a function'); +var forEachArray = function forEachArray(array, iterator, receiver) { + for (var i = 0, len = array.length; i < len; i++) { + if (hasOwnProperty.call(array, i)) { + if (receiver == null) { + iterator(array[i], i, array); + } else { + iterator.call(receiver, array[i], i, array); + } + } } - var l = obj.length; - if (l === +l) { - for (var i = 0; i < l; i++) { - fn.call(ctx, obj[i], i, obj); +}; + +var forEachString = function forEachString(string, iterator, receiver) { + for (var i = 0, len = string.length; i < len; i++) { + // no such thing as a sparse string. + if (receiver == null) { + iterator(string.charAt(i), i, string); + } else { + iterator.call(receiver, string.charAt(i), i, string); } - } else { - for (var k in obj) { - if (hasOwn.call(obj, k)) { - fn.call(ctx, obj[k], k, obj); + } +}; + +var forEachObject = function forEachObject(object, iterator, receiver) { + for (var k in object) { + if (hasOwnProperty.call(object, k)) { + if (receiver == null) { + iterator(object[k], k, object); + } else { + iterator.call(receiver, object[k], k, object); } } } }; +var forEach = function forEach(list, iterator, thisArg) { + if (!isCallable(iterator)) { + throw new TypeError('iterator must be a function'); + } + + var receiver; + if (arguments.length >= 3) { + receiver = thisArg; + } + + if (toStr.call(list) === '[object Array]') { + forEachArray(list, iterator, receiver); + } else if (typeof list === 'string') { + forEachString(list, iterator, receiver); + } else { + forEachObject(list, iterator, receiver); + } +}; + +module.exports = forEach; -},{}],19:[function(require,module,exports){ +},{"is-callable":30}],16:[function(require,module,exports){ 'use strict'; /* eslint no-invalid-this: 1 */ @@ -6855,14 +6323,14 @@ module.exports = function bind(that) { return bound; }; -},{}],20:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); module.exports = Function.prototype.bind || implementation; -},{"./implementation":19}],21:[function(require,module,exports){ +},{"./implementation":16}],18:[function(require,module,exports){ 'use strict'; var undefined; @@ -6908,18 +6376,23 @@ var ThrowTypeError = $gOPD : throwTypeError; var hasSymbols = require('has-symbols')(); +var hasProto = require('has-proto')(); -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto +var getProto = Object.getPrototypeOf || ( + hasProto + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto + : null +); var needsEval = {}; -var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); var INTRINSICS = { '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, '%AsyncFromSyncIteratorPrototype%': undefined, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, @@ -6927,6 +6400,8 @@ var INTRINSICS = { '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, '%Date%': Date, @@ -6947,10 +6422,10 @@ var INTRINSICS = { '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, '%JSON%': typeof JSON === 'object' ? JSON : undefined, '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': Object, @@ -6963,10 +6438,10 @@ var INTRINSICS = { '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '%String%': String, - '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, '%Symbol%': hasSymbols ? Symbol : undefined, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, @@ -6982,6 +6457,16 @@ var INTRINSICS = { '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet }; +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { @@ -6997,7 +6482,7 @@ var doEval = function doEval(name) { } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); - if (gen) { + if (gen && getProto) { value = getProto(gen.prototype); } } @@ -7062,11 +6547,12 @@ var LEGACY_ALIASES = { }; var bind = require('function-bind'); -var hasOwn = require('has'); +var hasOwn = require('hasown'); var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); var $strSlice = bind.call(Function.call, String.prototype.slice); +var $exec = bind.call(Function.call, RegExp.prototype.exec); /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; @@ -7122,6 +6608,9 @@ module.exports = function GetIntrinsic(name, allowMissing) { throw new $TypeError('"allowMissing" argument must be a boolean'); } + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; @@ -7194,7 +6683,73 @@ module.exports = function GetIntrinsic(name, allowMissing) { return value; }; -},{"function-bind":20,"has":25,"has-symbols":22}],22:[function(require,module,exports){ +},{"function-bind":17,"has-proto":21,"has-symbols":22,"hasown":25}],19:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + +},{"get-intrinsic":18}],20:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + return true; + } catch (e) { + // IE 8 has a broken defineProperty + return false; + } + } + return false; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!hasPropertyDescriptors()) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; + +},{"get-intrinsic":18}],21:[function(require,module,exports){ +'use strict'; + +var test = { + foo: {} +}; + +var $Object = Object; + +module.exports = function hasProto() { + return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); +}; + +},{}],22:[function(require,module,exports){ 'use strict'; var origSymbol = typeof Symbol !== 'undefined' && Symbol; @@ -7265,11 +6820,14 @@ module.exports = function hasToStringTagShams() { },{"has-symbols/shams":23}],25:[function(require,module,exports){ 'use strict'; +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; var bind = require('function-bind'); -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); +/** @type {(o: {}, p: PropertyKey) => p is keyof o} */ +module.exports = bind.call(call, $hasOwn); -},{"function-bind":20}],26:[function(require,module,exports){ +},{"function-bind":17}],26:[function(require,module,exports){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m @@ -7357,6 +6915,31 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { } },{}],27:[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 + } +} + +},{}],28:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -7385,7 +6968,7 @@ if (typeof Object.create === 'function') { } } -},{}],28:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; var hasToStringTag = require('has-tostringtag/shams')(); @@ -7420,7 +7003,110 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; -},{"call-bind/callBound":12,"has-tostringtag/shams":24}],29:[function(require,module,exports){ +},{"call-bind/callBound":9,"has-tostringtag/shams":24}],30:[function(require,module,exports){ +'use strict'; + +var fnToStr = Function.prototype.toString; +var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; +var badArrayLike; +var isCallableMarker; +if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { + try { + badArrayLike = Object.defineProperty({}, 'length', { + get: function () { + throw isCallableMarker; + } + }); + isCallableMarker = {}; + // eslint-disable-next-line no-throw-literal + reflectApply(function () { throw 42; }, null, badArrayLike); + } catch (_) { + if (_ !== isCallableMarker) { + reflectApply = null; + } + } +} else { + reflectApply = null; +} + +var constructorRegex = /^\s*class\b/; +var isES6ClassFn = function isES6ClassFunction(value) { + try { + var fnStr = fnToStr.call(value); + return constructorRegex.test(fnStr); + } catch (e) { + return false; // not a function + } +}; + +var tryFunctionObject = function tryFunctionToStr(value) { + try { + if (isES6ClassFn(value)) { return false; } + fnToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var objectClass = '[object Object]'; +var fnClass = '[object Function]'; +var genClass = '[object GeneratorFunction]'; +var ddaClass = '[object HTMLAllCollection]'; // IE 11 +var ddaClass2 = '[object HTML document.all class]'; +var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 +var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` + +var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing + +var isDDA = function isDocumentDotAll() { return false; }; +if (typeof document === 'object') { + // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly + var all = document.all; + if (toStr.call(all) === toStr.call(document.all)) { + isDDA = function isDocumentDotAll(value) { + /* globals document: false */ + // in IE 6-8, typeof document.all is "object" and it's truthy + if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { + try { + var str = toStr.call(value); + return ( + str === ddaClass + || str === ddaClass2 + || str === ddaClass3 // opera 12.16 + || str === objectClass // IE 6-8 + ) && value('') == null; // eslint-disable-line eqeqeq + } catch (e) { /**/ } + } + return false; + }; + } +} + +module.exports = reflectApply + ? function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + try { + reflectApply(value, null, badArrayLike); + } catch (e) { + if (e !== isCallableMarker) { return false; } + } + return !isES6ClassFn(value) && tryFunctionObject(value); + } + : function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (hasToStringTag) { return tryFunctionObject(value); } + if (isES6ClassFn(value)) { return false; } + var strClass = toStr.call(value); + if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } + return tryFunctionObject(value); + }; + +},{}],31:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; @@ -7460,71 +7146,16 @@ module.exports = function isGeneratorFunction(fn) { return getProto(fn) === GeneratorFunction; }; -},{"has-tostringtag/shams":24}],30:[function(require,module,exports){ -(function (global){(function (){ +},{"has-tostringtag/shams":24}],32:[function(require,module,exports){ 'use strict'; -var forEach = require('foreach'); -var availableTypedArrays = require('available-typed-arrays'); -var callBound = require('call-bind/callBound'); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = require('has-tostringtag/shams')(); - -var g = typeof globalThis === 'undefined' ? global : globalThis; -var typedArrays = availableTypedArrays(); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function (getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { /**/ } - } - }); - return anyTrue; -}; +var whichTypedArray = require('which-typed-array'); module.exports = function isTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { return false; } - return tryTypedArrays(value); + return !!whichTypedArray(value); }; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24}],31:[function(require,module,exports){ +},{"which-typed-array":79}],33:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -7613,10 +7244,292 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { } } - return to; + return to; +}; + +},{}],34:[function(require,module,exports){ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; + +},{"./isArguments":36}],35:[function(require,module,exports){ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; + +},{"./implementation":34,"./isArguments":36}],36:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; + +},{}],37:[function(require,module,exports){ +'use strict'; + +// modified from https://github.com/es-shims/es6-shim +var objectKeys = require('object-keys'); +var hasSymbols = require('has-symbols/shams')(); +var callBound = require('call-bind/callBound'); +var toObject = Object; +var $push = callBound('Array.prototype.push'); +var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; + +// eslint-disable-next-line no-unused-vars +module.exports = function assign(target, source1) { + if (target == null) { throw new TypeError('target must be an object'); } + var to = toObject(target); // step 1 + if (arguments.length === 1) { + return to; // step 2 + } + for (var s = 1; s < arguments.length; ++s) { + var from = toObject(arguments[s]); // step 3.a.i + + // step 3.a.ii: + var keys = objectKeys(from); + var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); + if (getSymbols) { + var syms = getSymbols(from); + for (var j = 0; j < syms.length; ++j) { + var key = syms[j]; + if ($propIsEnumerable(from, key)) { + $push(keys, key); + } + } + } + + // step 3.a.iii: + for (var i = 0; i < keys.length; ++i) { + var nextKey = keys[i]; + if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2 + var propValue = from[nextKey]; // step 3.a.iii.2.a + to[nextKey] = propValue; // step 3.a.iii.2.b + } + } + } + + return to; // step 4 +}; + +},{"call-bind/callBound":9,"has-symbols/shams":23,"object-keys":35}],38:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; }; -},{}],32:[function(require,module,exports){ +},{"./implementation":37}],39:[function(require,module,exports){ 'use strict'; @@ -7723,7 +7636,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],33:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. @@ -7776,7 +7689,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],34:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -7846,7 +7759,7 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],35:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. @@ -7907,7 +7820,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],36:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -9783,7 +9696,7 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":32,"./adler32":33,"./crc32":35,"./messages":40,"./trees":41}],37:[function(require,module,exports){ +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./messages":47,"./trees":48}],44:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -10130,7 +10043,7 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],38:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11688,7 +11601,7 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":32,"./adler32":33,"./crc32":35,"./inffast":37,"./inftrees":39}],39:[function(require,module,exports){ +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./inffast":44,"./inftrees":46}],46:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -12033,7 +11946,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":32}],40:[function(require,module,exports){ +},{"../utils/common":39}],47:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -12067,7 +11980,7 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],41:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13291,7 +13204,7 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":32}],42:[function(require,module,exports){ +},{"../utils/common":39}],49:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13340,7 +13253,7 @@ function ZStream() { module.exports = ZStream; -},{}],43:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ (function (Buffer){(function (){ var fs = require("fs"), stream = require("stream"), @@ -13954,7 +13867,7 @@ exports.parseBuffer = function(buf, callback) { exports.parse = exports.parseBuffer }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":11,"fs":10,"stream":46,"zlib":9}],44:[function(require,module,exports){ +},{"buffer":8,"fs":7,"stream":68,"zlib":6}],51:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14140,205 +14053,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],45:[function(require,module,exports){ -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":11}],46:[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/lib/_stream_readable.js'); -Stream.Writable = require('readable-stream/lib/_stream_writable.js'); -Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); -Stream.Transform = require('readable-stream/lib/_stream_transform.js'); -Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); -Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') -Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.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":17,"inherits":27,"readable-stream/lib/_stream_duplex.js":48,"readable-stream/lib/_stream_passthrough.js":49,"readable-stream/lib/_stream_readable.js":50,"readable-stream/lib/_stream_transform.js":51,"readable-stream/lib/_stream_writable.js":52,"readable-stream/lib/internal/streams/end-of-stream.js":56,"readable-stream/lib/internal/streams/pipeline.js":58}],47:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } @@ -14467,7 +14182,7 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); module.exports.codes = codes; -},{}],48:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14489,60 +14204,48 @@ module.exports.codes = codes; // 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. + // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. + 'use strict'; -/**/ +/**/ var objectKeys = Object.keys || function (obj) { var keys = []; - - for (var key in obj) { - keys.push(key); - } - + for (var key in obj) keys.push(key); return keys; }; /**/ - module.exports = Duplex; - var Readable = require('./_stream_readable'); - var Writable = require('./_stream_writable'); - require('inherits')(Duplex, Readable); - { // Allow the keys array to be GC'ed. 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); this.allowHalfOpen = true; - if (options) { if (options.readable === false) this.readable = false; if (options.writable === false) this.writable = false; - if (options.allowHalfOpen === false) { this.allowHalfOpen = false; this.once('end', onend); } } } - Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14569,20 +14272,20 @@ Object.defineProperty(Duplex.prototype, 'writableLength', { get: function get() { return this._writableState.length; } -}); // the no-half-open enforcer +}); +// the no-half-open enforcer function onend() { // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. + if (this._writableState.ended) return; + // no more data can be written. + // But allow more writes to happen in this tick. process.nextTick(onEndNT, this); } - function onEndNT(self) { self.end(); } - Object.defineProperty(Duplex.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14592,7 +14295,6 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { if (this._readableState === undefined || this._writableState === undefined) { return false; } - return this._readableState.destroyed && this._writableState.destroyed; }, set: function set(value) { @@ -14600,16 +14302,16 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // has not been initialized yet if (this._readableState === undefined || this._writableState === undefined) { return; - } // backward compatibility, the user is explicitly - // managing destroyed - + } + // backward compatibility, the user is explicitly + // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; } }); }).call(this)}).call(this,require('_process')) -},{"./_stream_readable":50,"./_stream_writable":52,"_process":44,"inherits":27}],49:[function(require,module,exports){ +},{"./_stream_readable":55,"./_stream_writable":57,"_process":51,"inherits":28}],54:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -14630,26 +14332,24 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // 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. + // 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'); - require('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":51,"inherits":27}],50:[function(require,module,exports){ +},{"./_stream_transform":56,"inherits":28}],55:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14671,49 +14371,40 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. + 'use strict'; module.exports = Readable; -/**/ +/**/ var Duplex; /**/ Readable.ReadableState = ReadableState; -/**/ +/**/ var EE = require('events').EventEmitter; - var EElistenerCount = function EElistenerCount(emitter, type) { return emitter.listeners(type).length; }; /**/ /**/ - - var Stream = require('./internal/streams/stream'); /**/ - var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } - function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -/**/ - +/**/ var debugUtil = require('util'); - var debug; - if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { @@ -14721,60 +14412,57 @@ if (debugUtil && debugUtil.debuglog) { } /**/ - var BufferList = require('./internal/streams/buffer_list'); - var destroyImpl = require('./internal/streams/destroy'); - var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - + getHighWaterMark = _require.getHighWaterMark; var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. - + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; +// Lazy loaded to improve the startup performance. var StringDecoder; var createReadableStreamAsyncIterator; var from; - require('inherits')(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; 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); // This is a hack to make sure that our error handler is attached before any + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // 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 (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } - function ReadableState(options, stream, isDuplex) { Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share + options = options || {}; + + // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // 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 (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + if (isDuplex) 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" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // 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; @@ -14782,61 +14470,66 @@ function ReadableState(options, stream, isDuplex) { this.flowing = null; this.ended = false; this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted // 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 read call. + this.sync = true; - this.sync = true; // whenever we return null, then we set a flag to say + // 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; - this.paused = true; // Should close be emitted on destroy. Defaults to true. + this.paused = true; - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; // has it been destroyed + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // has it been destroyed + this.destroyed = 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'; - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + // 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); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 + if (!(this instanceof Readable)) return new Readable(options); + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy + this._readableState = new ReadableState(options, this, isDuplex); + // legacy this.readable = true; - if (options) { if (typeof options.read === 'function') this._read = options.read; if (typeof options.destroy === 'function') this._destroy = options.destroy; } - Stream.call(this); } - Object.defineProperty(Readable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14846,7 +14539,6 @@ Object.defineProperty(Readable.prototype, 'destroyed', { if (this._readableState === undefined) { return false; } - return this._readableState.destroyed; }, set: function set(value) { @@ -14854,69 +14546,60 @@ Object.defineProperty(Readable.prototype, 'destroyed', { // has not been initialized yet if (!this._readableState) { return; - } // backward compatibility, the user is explicitly - // managing destroyed - + } + // backward compatibility, the user is explicitly + // managing destroyed this._readableState.destroyed = value; } }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function (err, cb) { cb(err); -}; // Manually shove something into the read() buffer. +}; + +// 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; var skipChunkCheck; - if (!state.objectMode) { if (typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } - skipChunkCheck = true; } } else { skipChunkCheck = true; } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() - +}; +// Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, true, false); }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { debug('readableAddChunk', chunk); var state = stream._readableState; - if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else { var er; if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { errorOrDestroy(stream, er); } else if (state.objectMode || chunk && chunk.length > 0) { if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = _uint8ArrayToBuffer(chunk); } - if (addToFront) { if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); } else if (state.ended) { @@ -14925,7 +14608,6 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { return false; } else { state.reading = false; - if (state.decoder && !encoding) { chunk = state.decoder.write(chunk); if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); @@ -14937,14 +14619,13 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { state.reading = false; maybeReadMore(stream, state); } - } // We can push more data if we are below the highWaterMark. + } + + // We can push more data if we are below the highWaterMark. // 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. - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); } - function addChunk(stream, state, chunk, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { state.awaitDrain = 0; @@ -14955,50 +14636,42 @@ function addChunk(stream, state, chunk, addToFront) { if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } - maybeReadMore(stream, state); } - function chunkInvalid(state, chunk) { var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); } - return er; } - Readable.prototype.isPaused = function () { return this._readableState.flowing === false; -}; // backwards compatibility. - +}; +// backwards compatibility. Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + // Iterate over current buffer to convert already stored Buffers: var p = this._readableState.buffer.head; var content = ''; - while (p !== null) { content += decoder.write(p.data); p = p.next; } - this._readableState.buffer.clear(); - if (content !== '') this._readableState.buffer.push(content); this._readableState.length = content.length; return this; -}; // Don't raise the hwm > 1GB - +}; +// Don't raise the hwm > 1GB var MAX_HWM = 0x40000000; - function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. @@ -15014,55 +14687,54 @@ function computeNewHighWaterMark(n) { n |= n >>> 16; n++; } - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. - +} +// 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 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 (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. - +} +// 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 + 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.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || 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); - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - + // 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 + } + + // 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 @@ -15083,40 +14755,37 @@ Readable.prototype.read = function (n) { // '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. - + // 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 + 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. - + } + // 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 - + 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, + 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 = state.length <= state.highWaterMark; n = 0; @@ -15124,34 +14793,28 @@ Readable.prototype.read = function (n) { state.length -= n; state.awaitDrain = 0; } - 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 (!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 onEofChunk(stream, state) { debug('onEofChunk'); 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; - if (state.sync) { // if we are sync, wait until next tick to emit the data. // Otherwise we risk emitting data in the flow() @@ -15160,61 +14823,56 @@ function onEofChunk(stream, state) { } else { // emit 'readable' now to make sure it gets picked up. state.needReadable = false; - if (!state.emittedReadable) { state.emittedReadable = true; emitReadable_(stream); } } -} // Don't emit readable right away in sync mode, because this can trigger +} + +// 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; debug('emitReadable', state.needReadable, state.emittedReadable); state.needReadable = false; - if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; process.nextTick(emitReadable_, stream); } } - function emitReadable_(stream) { var state = stream._readableState; debug('emitReadable_', state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { stream.emit('readable'); state.emittedReadable = false; - } // The stream needs another readable event if + } + + // The stream needs another readable event if // 1. It is not flowing, as the flow mechanism will take // care of it. // 2. It is not ended. // 3. It is below the highWaterMark, so we can schedule // another readable later. - - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; flow(stream); -} // at this point, the user has presumably seen the 'readable' event, +} + +// 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; process.nextTick(maybeReadMore_, stream, state); } } - function maybeReadMore_(stream, state) { // Attempt to read more data if we should. // @@ -15243,49 +14901,42 @@ function maybeReadMore_(stream, state) { var len = state.length; debug('maybeReadMore read 0'); stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. + if (len === state.length) + // didn't get any data, stop spinning. break; } - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. +} + +// 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) { errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); }; - 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) process.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { debug('onunpipe'); - if (readable === src) { if (unpipeInfo && unpipeInfo.hasUnpiped === false) { unpipeInfo.hasUnpiped = true; @@ -15293,23 +14944,21 @@ Readable.prototype.pipe = function (dest, pipeOpts) { } } } - function onend() { debug('onend'); dest.end(); - } // when the dest drains, it reduces the awaitDrain counter + } + + // 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 - + debug('cleanup'); + // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); @@ -15318,22 +14967,20 @@ Readable.prototype.pipe = function (dest, pipeOpts) { 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 + 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(); } - src.on('data', ondata); - function ondata(chunk) { debug('ondata'); var ret = dest.write(chunk); debug('dest.write', ret); - if (ret === false) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write @@ -15343,87 +14990,84 @@ Readable.prototype.pipe = function (dest, pipeOpts) { debug('false write response, pause', state.awaitDrain); state.awaitDrain++; } - src.pause(); } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - + } + // 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) errorOrDestroy(dest, 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. + // 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. + // 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 pipeOnDrainFunctionResult() { 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; var unpipeInfo = { hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. + }; - if (state.pipesCount === 0) return this; // just one destination. most common case. + // 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. + if (!dest) dest = state.pipes; + // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; if (dest) dest.emit('unpipe', this, unpipeInfo); return this; - } // slow case. multiple pipe destinations. + } + // slow case. multiple pipe destinations. if (!dest) { // remove all. @@ -15432,17 +15076,13 @@ Readable.prototype.unpipe = function (dest) { state.pipes = null; state.pipesCount = 0; state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } - + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); return this; - } // try to find the right one. - + } + // try to find the right one. var index = indexOf(state.pipes, dest); if (index === -1) return this; state.pipes.splice(index, 1); @@ -15450,19 +15090,19 @@ Readable.prototype.unpipe = function (dest) { if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this, unpipeInfo); return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something - +}; +// 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); var state = this._readableState; - if (ev === 'data') { // update readableListening so that resume() may be a no-op // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + state.readableListening = this.listenerCount('readable') > 0; + // Try start flowing on next tick if stream isn't explicitly paused if (state.flowing !== false) this.resume(); } else if (ev === 'readable') { if (!state.endEmitted && !state.readableListening) { @@ -15470,7 +15110,6 @@ Readable.prototype.on = function (ev, fn) { state.flowing = false; state.emittedReadable = false; debug('on readable', state.length, state.reading); - if (state.length) { emitReadable(this); } else if (!state.reading) { @@ -15478,15 +15117,11 @@ Readable.prototype.on = function (ev, fn) { } } } - return res; }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function (ev, fn) { var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === 'readable') { // We need to check if there is someone still listening to // readable and reset the state. However this needs to happen @@ -15496,13 +15131,10 @@ Readable.prototype.removeListener = function (ev, fn) { // effect. process.nextTick(updateReadableListening, this); } - return res; }; - Readable.prototype.removeAllListeners = function (ev) { var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === 'readable' || ev === undefined) { // We need to check if there is someone still listening to // readable and reset the state. However this needs to happen @@ -15512,121 +15144,103 @@ Readable.prototype.removeAllListeners = function (ev) { // effect. process.nextTick(updateReadableListening, this); } - return res; }; - function updateReadableListening(self) { var state = self._readableState; state.readableListening = self.listenerCount('readable') > 0; - if (state.resumeScheduled && !state.paused) { // flowing needs to be set to true now, otherwise // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume + state.flowing = true; + + // crude way to check if we should resume } else if (self.listenerCount('data') > 0) { self.resume(); } } - 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. - +} +// 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'); // we flow only if there is no one listening + debug('resume'); + // we flow only if there is no one listening // for readable, but we still have to call // resume() - state.flowing = !state.readableListening; resume(this, state); } - state.paused = false; return this; }; - function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; process.nextTick(resume_, stream, state); } } - function resume_(stream, state) { debug('resume', state.reading); - if (!state.reading) { stream.read(0); } - state.resumeScheduled = false; 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 (this._readableState.flowing !== false) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } - this._readableState.paused = true; return this; }; - function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. +// 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 _this = this; - var state = this._readableState; var paused = false; stream.on('end', function () { debug('wrapped end'); - if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) _this.push(chunk); } - _this.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.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 = _this.push(chunk); - if (!ret) { paused = true; stream.pause(); } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. + }); + // 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 methodWrap(method) { @@ -15635,37 +15249,32 @@ Readable.prototype.wrap = function (stream) { }; }(i); } - } // proxy certain important events. - + } + // proxy certain important events. for (var n = 0; n < kProxyEvents.length; n++) { stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. - + } + // when we try to consume some more bytes, simply unpause the + // underlying stream. this._read = function (n) { debug('wrapped _read', n); - if (paused) { paused = false; stream.resume(); } }; - return this; }; - if (typeof Symbol === 'function') { Readable.prototype[Symbol.asyncIterator] = function () { if (createReadableStreamAsyncIterator === undefined) { createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); } - return createReadableStreamAsyncIterator(this); }; } - Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -15697,8 +15306,9 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', { this._readableState.flowing = state; } } -}); // exposed for testing purposes only. +}); +// exposed for testing purposes only. Readable._fromList = fromList; Object.defineProperty(Readable.prototype, 'readableLength', { // making it explicit this property is not enumerable @@ -15708,11 +15318,12 @@ Object.defineProperty(Readable.prototype, 'readableLength', { get: function get() { return this._readableState.length; } -}); // Pluck off n bytes from an array of buffers. +}); + +// 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; @@ -15727,56 +15338,48 @@ function fromList(n, state) { } return ret; } - function endReadable(stream) { var state = stream._readableState; debug('endReadable', state.endEmitted); - if (!state.endEmitted) { state.ended = true; process.nextTick(endReadableNT, state, stream); } } - function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + debug('endReadableNT', state.endEmitted, state.length); + // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); - if (state.autoDestroy) { // In case of duplex streams we need a way to detect // if the writable side is ready for autoDestroy as well var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { stream.destroy(); } } } } - if (typeof Symbol === 'function') { Readable.from = function (iterable, opts) { if (from === undefined) { from = require('./internal/streams/from'); } - return from(Readable, iterable, opts); }; } - function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } - return -1; } }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":47,"./_stream_duplex":48,"./internal/streams/async_iterator":53,"./internal/streams/buffer_list":54,"./internal/streams/destroy":55,"./internal/streams/from":57,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"events":17,"inherits":27,"string_decoder/":61,"util":7}],51:[function(require,module,exports){ +},{"../errors":52,"./_stream_duplex":53,"./internal/streams/async_iterator":58,"./internal/streams/buffer_list":59,"./internal/streams/destroy":60,"./internal/streams/from":62,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"events":14,"inherits":28,"string_decoder/":69,"util":4}],56:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -15797,6 +15400,7 @@ function indexOf(xs, x) { // 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. + // 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 @@ -15838,42 +15442,36 @@ function indexOf(xs, x) { // 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 _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; var Duplex = require('./_stream_duplex'); - require('inherits')(Transform, Duplex); - function afterTransform(er, data) { var ts = this._transformState; ts.transforming = false; var cb = ts.writecb; - if (cb === null) { return this.emit('error', new ERR_MULTIPLE_CALLBACK()); } - ts.writechunk = null; ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` + if (data != null) + // single equals check for both `null` and `undefined` this.push(data); cb(er); var rs = this._readableState; rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { this._read(rs.highWaterMark); } } - function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); @@ -15884,26 +15482,25 @@ function Transform(options) { writecb: null, writechunk: null, writeencoding: null - }; // 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 + // 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. - + } + // When the writable side finishes, then flush out anything remaining. this.on('prefinish', prefinish); } - function prefinish() { var _this = this; - if (typeof this._flush === 'function' && !this._readableState.destroyed) { this._flush(function (er, data) { done(_this, er, data); @@ -15912,11 +15509,12 @@ function prefinish() { done(this, null, null); } } - 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! +}; + +// This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // @@ -15926,33 +15524,27 @@ Transform.prototype.push = function (chunk, encoding) { // 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) { cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); }; - 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. +}; + +// 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.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 @@ -15960,25 +15552,25 @@ Transform.prototype._read = function (n) { ts.needTransform = true; } }; - Transform.prototype._destroy = function (err, cb) { Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2); }); }; - function done(stream, er, data) { if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases // if there's nothing in the write buffer, then that means // that nothing more will ever be provided - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); return stream.push(null); } -},{"../errors":47,"./_stream_duplex":48,"inherits":27}],52:[function(require,module,exports){ +},{"../errors":52,"./_stream_duplex":53,"inherits":28}],57:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -16000,29 +15592,29 @@ function done(stream, er, data) { // 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. + // 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; -/* */ +/* */ function WriteReq(chunk, encoding, cb) { this.chunk = chunk; this.encoding = encoding; this.callback = cb; this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - +} +// 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 () { onCorkedFinish(_this, state); }; @@ -16030,155 +15622,159 @@ function CorkedRequest(state) { /* */ /**/ - - var Duplex; /**/ Writable.WritableState = WritableState; -/**/ +/**/ var internalUtil = { deprecate: require('util-deprecate') }; /**/ /**/ - var Stream = require('./internal/streams/stream'); /**/ - var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } - function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } - var destroyImpl = require('./internal/streams/destroy'); - var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - + getHighWaterMark = _require.getHighWaterMark; var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; var errorOrDestroy = destroyImpl.errorOrDestroy; - require('inherits')(Writable, Stream); - function nop() {} - function WritableState(options, stream, isDuplex) { Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share + options = options || {}; + + // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream, // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // object stream flag to indicate whether or not this stream // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false + if (isDuplex) 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() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() + // if _final has been called + this.finalCalled = false; - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted + // 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; - this.finished = false; // has it been destroyed + // has it been destroyed + this.destroyed = false; - this.destroyed = false; // should we decode strings into buffers before passing to _write? + // 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 + 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'; - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement + // 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; - this.length = 0; // a flag to see when we're in the middle of a write. + // a flag to see when we're in the middle of a write. + this.writing = false; - this.writing = false; // when true all writes will be buffered until .uncork() call + // when true all writes will be buffered until .uncork() call + this.corked = 0; - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, + // 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; - this.sync = true; // a flag to know if we're processing previously buffered items, which + // 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; - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - + // 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. + // 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.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs + // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams + this.prefinished = false; - this.prefinished = false; // True if the error was already emitted and should not be thrown again + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; - this.autoDestroy = !!options.autoDestroy; // count buffered requests + // count buffered requests + this.bufferedRequestCount = 0; - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // 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', { @@ -16187,12 +15783,11 @@ WritableState.prototype.getBuffer = function getBuffer() { }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') }); } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. - +})(); +// 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, { @@ -16207,1695 +15802,2377 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot return object instanceof this; }; } - function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. + 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. + // Checking for a Stream.Duplex instance is faster here instead of inside // the WritableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. + this._writableState = new WritableState(options, this, isDuplex); + // legacy. this.writable = true; - if (options) { if (typeof options.write === 'function') this._write = options.write; if (typeof options.writev === 'function') this._writev = options.writev; if (typeof options.destroy === 'function') this._destroy = options.destroy; if (typeof options.final === 'function') this._final = options.final; } - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. - +} +// Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb errorOrDestroy(stream, er); process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular +} + +// 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 er; - if (chunk === null) { er = new ERR_STREAM_NULL_VALUES(); } else if (typeof chunk !== 'string' && !state.objectMode) { er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); } - if (er) { errorOrDestroy(stream, er); process.nextTick(cb, er); return false; } - return true; } +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(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.ending) 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 () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !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 ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// 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) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + 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 = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + 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 (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else 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) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +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; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + 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) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); +// 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 (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } +// 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; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } 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; + state.bufferedRequestCount--; + // 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; } - return ret; -}; - -Writable.prototype.cork = function () { - this._writableState.corked++; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); }; - -Writable.prototype.uncork = function () { +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--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + state.corked = 1; + this.uncork(); } -}; -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 ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); return this; }; - -Object.defineProperty(Writable.prototype, 'writableBuffer', { +Object.defineProperty(Writable.prototype, 'writableLength', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState && this._writableState.getBuffer(); + return this._writableState.length; } }); - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } } - - return chunk; } +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState.highWaterMark; - } -}); // 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) { - var newChunk = decodeChunk(state, chunk, encoding); - - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; } - } - - 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 = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":52,"./_stream_duplex":53,"./internal/streams/destroy":60,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"inherits":28,"util-deprecate":71}],58:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = require('./end-of-stream'); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); } - - 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 (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); } +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error - - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; } -} +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":61,"_process":51}],59:[function(require,module,exports){ +'use strict'; -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = require('buffer'), + Buffer = _require.Buffer; +var _require2 = require('util'), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); } - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - 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) || stream.destroyed; - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + 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; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; } - } -} - -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; - var allBuffers = true; - - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; + }, { + key: "first", + value: function first() { + return this.head.data; } - buffer.allBuffers = allBuffers; - 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); + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; } - state.bufferedRequestCount = 0; - } 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; - state.bufferedRequestCount--; // 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; + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; } + this.length -= c; + return ret; } - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; - -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) endWritable(this, state, cb); - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - - if (err) { - errorOrDestroy(stream, err); + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); } + }]); + return BufferList; +}(); +},{"buffer":8,"util":4}],60:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} - -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - - if (need) { - prefinish(stream, state); + return this; + } - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; + if (this._readableState) { + this._readableState.destroyed = true; + } - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. - return need; + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); } +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this)}).call(this,require('_process')) +},{"_process":51}],61:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); +'use strict'; - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); } - - state.ended = true; - stream.writable = false; + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; } +module.exports = eos; +},{"../../../errors":52}],62:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; +},{}],63:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. +'use strict'; +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; - state.corkedRequestsFree.next = corkReq; + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } +module.exports = pipeline; +},{"../../../errors":52,"./end-of-stream":61}],64:[function(require,module,exports){ +'use strict'; -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._writableState.destroyed = value; + return Math.floor(hwm); } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; - -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":47,"./_stream_duplex":48,"./internal/streams/destroy":55,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"inherits":27,"util-deprecate":63}],53:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; - -var _Object$setPrototypeO; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -var finished = require('./end-of-stream'); - -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); - -function createIterResult(value, done) { - return { - value: value, - done: done - }; + // Default value + return state.objectMode ? 16 : 16 * 1024; } +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":52}],65:[function(require,module,exports){ +module.exports = require('events').EventEmitter; -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' +},{"events":14}],66:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] } } - -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer } -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - - iter[kHandlePromise](resolve, reject); - }, reject); - }; +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) } -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - - next: function next() { - var _this = this; - - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - - if (error !== null) { - return Promise.reject(error); - } - - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time +SafeBuffer.prototype = Object.create(Buffer.prototype) +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) - var lastPromise = this[kLastPromise]; - var promise; +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - - promise = new Promise(this[kHandlePromise]); + buf.fill(fill) } - - this[kLastPromise] = promise; - return promise; + } else { + buf.fill(0) } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); - -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; + return buf +} - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } +},{"buffer":8}],67:[function(require,module,exports){ +'use strict'; - iterator[kError] = err; - return; - } +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); - var resolve = iterator[kLastResolve]; +var $TypeError = GetIntrinsic('%TypeError%'); +var $floor = GetIntrinsic('%Math.floor%'); - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; + var loose = arguments.length > 2 && !!arguments[2]; -module.exports = createReadableStreamAsyncIterator; -}).call(this)}).call(this,require('_process')) -},{"./end-of-stream":56,"_process":44}],54:[function(require,module,exports){ -'use strict'; + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(fn, 'length', length, true, true); + } else { + define(fn, 'length', length); + } + } + return fn; +}; -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +},{"define-data-property":12,"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],68:[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 _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +module.exports = Stream; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var EE = require('events').EventEmitter; +var inherits = require('inherits'); -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); } } +inherits(Stream, EE); +Stream.Readable = require('readable-stream/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; -var _require = require('buffer'), - Buffer = _require.Buffer; -var _require2 = require('util'), - inspect = _require2.inspect; -var custom = inspect && inspect.custom || 'inspect'; +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); +function Stream() { + EE.call(this); } -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - _classCallCheck(this, BufferList); +Stream.prototype.pipe = function(dest, options) { + var source = this; - this.head = null; - this.tail = null; - this.length = 0; + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - 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; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; + } - while (p = p.next) { - ret += s + p.data; - } + dest.on('drain', ondrain); - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; + // 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); + } - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. + dest.end(); + } - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } + function onclose() { + if (didOnEnd) return; + didOnEnd = true; - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. + if (typeof dest.destroy === 'function') dest.destroy(); + } - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; + // 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. + } + } - 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; + source.on('error', onerror); + dest.on('error', onerror); - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); - break; - } + source.removeListener('end', onend); + source.removeListener('close', onclose); - ++c; - } + source.removeListener('error', onerror); + dest.removeListener('error', onerror); - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; + dest.removeListener('close', cleanup); + } - 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; + source.on('end', cleanup); + source.on('close', cleanup); - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } + dest.on('close', cleanup); - break; - } + dest.emit('pipe', source); - ++c; - } + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. +},{"events":14,"inherits":28,"readable-stream/lib/_stream_duplex.js":53,"readable-stream/lib/_stream_passthrough.js":54,"readable-stream/lib/_stream_readable.js":55,"readable-stream/lib/_stream_transform.js":56,"readable-stream/lib/_stream_writable.js":57,"readable-stream/lib/internal/streams/end-of-stream.js":61,"readable-stream/lib/internal/streams/pipeline.js":63}],69:[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. - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - } - }]); +'use strict'; - return BufferList; -}(); -},{"buffer":11,"util":7}],55:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; // undocumented cb() API, needed for core, not for public API +/**/ -function destroy(err, cb) { - var _this = this; +var Buffer = require('safe-buffer').Buffer; +/**/ - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; +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; + } +}; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } +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; } + } +}; - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks +// 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 || ''; +}; - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well +StringDecoder.prototype.end = utf8End; +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; - if (this._writableState) { - this._writableState.destroyed = true; +// 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; +}; - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +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 byte >> 6 === 0x02 ? -1 : -2; +} + +// 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 || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) 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 +// a single UTF-8 replacement character ('\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'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); } - }); + } +} - return this; +// 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; } -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); +// 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); } -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; } -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; +// 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); +} - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; +// 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 emitErrorNT(self, err) { - self.emit('error', err); +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 errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +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; } -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy -}; -}).call(this)}).call(this,require('_process')) -},{"_process":44}],56:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} +},{"safe-buffer":66}],70:[function(require,module,exports){ +(function (setImmediate,clearImmediate){(function (){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; +// DOM APIs, for completeness - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; - callback.apply(this, args); - }; +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; } +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; -function noop() {} +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; - var writableEnded = stream._writableState && stream._writableState.finished; +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; + immediateIds[id] = true; - var readableEnded = stream._readableState && stream._readableState.endEmitted; + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; + return id; +}; - var onerror = function onerror(err) { - callback.call(stream, err); - }; +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) +},{"process/browser.js":51,"timers":70}],71:[function(require,module,exports){ +(function (global){(function (){ - var onclose = function onclose() { - var err; +/** + * Module exports. + */ - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } +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; + } - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); + 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); + } - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; + return deprecated; +} - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); +/** + * 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'; +} - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],72:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; } +},{}],73:[function(require,module,exports){ +(function (process,global){(function (){ +// 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 = eos; -},{"../../../errors":47}],57:[function(require,module,exports){ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; }; -},{}],58:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; -var eos; +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} + if (process.noDeprecation === true) { + return fn; + } -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} + return deprecated; +}; -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} -function call(fn) { - fn(); +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); } +exports.inspect = inspect; -function pipe(from, to) { - return from.pipe(to); -} -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; } +} - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); + +function stylizeNoColor(str, styleType) { + return str; } -module.exports = pipeline; -},{"../../../errors":47,"./end-of-stream":56}],59:[function(require,module,exports){ -'use strict'; -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function arrayToHash(array) { + var hash = {}; -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; } -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); } + return ret; + } - return Math.floor(hwm); - } // Default value - + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } - return state.objectMode ? 16 : 16 * 1024; -} + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); -module.exports = { - getHighWaterMark: getHighWaterMark -}; -},{"../../../errors":47}],60:[function(require,module,exports){ -module.exports = require('events').EventEmitter; + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } -},{"events":17}],61:[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. + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } -'use strict'; + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } -/**/ + var base = '', array = false, braces = ['{', '}']; -var Buffer = require('safe-buffer').Buffer; -/**/ + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } -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; + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; } -}; -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; - } + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); } -}; -// 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; -} + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } -// 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; + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); } - 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 (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; -StringDecoder.prototype.end = utf8End; + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; + ctx.seen.push(value); -// 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); + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); } - 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. If an invalid byte is detected, -2 is returned. -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 byte >> 6 === 0x02 ? -1 : -2; + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); } -// 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 || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); } - return nb; } - return 0; + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; } -// 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 -// a single UTF-8 replacement character ('\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'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); } } + + return name + ': ' + str; } -// 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); + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } -// 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); + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); } +exports.isArray = isArray; -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; +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; -// 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); +function isString(arg) { + return typeof arg === 'string'; } +exports.isString = isString; -// 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 isSymbol(arg) { + return typeof arg === 'symbol'; } +exports.isSymbol = isSymbol; -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 isUndefined(arg) { + return arg === void 0; } +exports.isUndefined = isUndefined; -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; +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; } +exports.isRegExp = isRegExp; -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); +function isObject(arg) { + return typeof arg === 'object' && arg !== null; } +exports.isObject = isObject; -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; } -},{"safe-buffer":45}],62:[function(require,module,exports){ -(function (setImmediate,clearImmediate){(function (){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; +exports.isDate = isDate; -// DOM APIs, for completeness +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; } -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; +exports.isPrimitive = isPrimitive; -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; +exports.isBuffer = require('./support/isBuffer'); -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; +function objectToString(o) { + return Object.prototype.toString.call(o); +} -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - immediateIds[id] = true; +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} - return id; -}; -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; -}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":44,"timers":62}],63:[function(require,module,exports){ -(function (global){(function (){ - -/** - * 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. + * Inherit the prototype methods from one constructor into another. * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). * - * @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 + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. */ +exports.inherits = require('inherits'); -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; - 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); + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; } + return origin; +}; - 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'; +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],64:[function(require,module,exports){ -arguments[4][3][0].apply(exports,arguments) -},{"dup":3}],65:[function(require,module,exports){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":72,"_process":51,"inherits":27}],74:[function(require,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"dup":72}],75:[function(require,module,exports){ // Currently in sync with Node.js lib/internal/util/types.js // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 @@ -18231,7 +18508,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer; }); }); -},{"is-arguments":28,"is-generator-function":29,"is-typed-array":30,"which-typed-array":69}],66:[function(require,module,exports){ +},{"is-arguments":29,"is-generator-function":31,"is-typed-array":32,"which-typed-array":79}],76:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -18645,7 +18922,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; - }).join('\n').substr(2); + }).join('\n').slice(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; @@ -18662,7 +18939,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); + name = name.slice(1, -1); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") @@ -18950,7 +19227,7 @@ function callbackify(original) { exports.callbackify = callbackify; }).call(this)}).call(this,require('_process')) -},{"./support/isBuffer":64,"./support/types":65,"_process":44,"inherits":27}],67:[function(require,module,exports){ +},{"./support/isBuffer":74,"./support/types":75,"_process":51,"inherits":28}],77:[function(require,module,exports){ function webpackBootstrapFunc (modules) { /******/ // The module cache /******/ var installedModules = {}; @@ -19154,7 +19431,7 @@ module.exports = function (moduleId, options) { return worker } -},{}],68:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -19236,13 +19513,15 @@ module.exports = function (fn, options) { return worker; }; -},{}],69:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ (function (global){(function (){ 'use strict'; -var forEach = require('foreach'); +var forEach = require('for-each'); var availableTypedArrays = require('available-typed-arrays'); +var callBind = require('call-bind'); var callBound = require('call-bind/callBound'); +var gOPD = require('gopd'); var $toString = callBound('Object.prototype.toString'); var hasToStringTag = require('has-tostringtag/shams')(); @@ -19251,59 +19530,94 @@ var g = typeof globalThis === 'undefined' ? global : globalThis; var typedArrays = availableTypedArrays(); var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var cache = { __proto__: null }; if (hasToStringTag && gOPD && getPrototypeOf) { forEach(typedArrays, function (typedArray) { - if (typeof g[typedArray] === 'function') { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); } + cache['$' + typedArray] = callBind(descriptor.get); + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + cache['$' + typedArray] = callBind(fn); } }); } var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function (getter, typedArray) { - if (!foundName) { + var found = false; + forEach(cache, function (getter, typedArray) { + if (!found) { try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; + if ('$' + getter(value) === typedArray) { + found = $slice(typedArray, 1); } - } catch (e) {} + } catch (e) { /**/ } } }); - return foundName; + return found; }; -var isTypedArray = require('is-typed-array'); +var trySlices = function tryAllSlices(value) { + var found = false; + forEach(cache, function (getter, name) { + if (!found) { + try { + getter(value); + found = $slice(name, 1); + } catch (e) { /**/ } + } + }); + return found; +}; module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + var tag = $slice($toString(value), 8, -1); + if ($indexOf(typedArrays, tag) > -1) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine return tryTypedArrays(value); }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24,"is-typed-array":30}],70:[function(require,module,exports){ +},{"available-typed-arrays":2,"call-bind":10,"call-bind/callBound":9,"for-each":15,"gopd":19,"has-tostringtag/shams":24}],80:[function(require,module,exports){ exports.DOMImplementation = window.DOMImplementation; exports.XMLSerializer = window.XMLSerializer; exports.DOMParser = window.DOMParser; -},{}],71:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; -},{}],72:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -19345,24 +19659,17 @@ var ROSLIB = this.ROSLIB || { var assign = require('object-assign'); // Add core components assign(ROSLIB, require('./core')); -assign(ROSLIB, require('./actionlib')); assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); -<<<<<<< HEAD -},{"./actionlib":78,"./core":87,"./math":92,"./tf":94,"./urdf":106,"object-assign":31}],73:[function(require,module,exports){ -======= -module.exports = ROSLIB; - -},{"./actionlib":14,"./core":26,"./math":31,"./tf":34,"./urdf":46,"object-assign":3}],9:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) +},{"./actionlib":88,"./core":101,"./math":106,"./tf":108,"./urdf":120,"object-assign":33}],83:[function(require,module,exports){ (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./RosLib":72}],74:[function(require,module,exports){ +},{"./RosLib":82}],84:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19520,12 +19827,8 @@ var ActionClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionClient; -<<<<<<< HEAD -},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],75:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],85:[function(require,module,exports){ "use strict"; -======= -},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],11:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Justin Young - justin@oodar.com.au @@ -19618,12 +19921,8 @@ var ActionListener = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionListener; -<<<<<<< HEAD -},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],76:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],86:[function(require,module,exports){ "use strict"; -======= -},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],12:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu @@ -19725,13 +20024,9 @@ var Goal = /** @class */ (function (_super) { return Goal; }(EventEmitter2)); module.exports = Goal; -<<<<<<< HEAD -},{"../core/Message":79,"./ActionClient":74,"eventemitter2":16}],77:[function(require,module,exports){ +},{"../core/Message":93,"./ActionClient":84,"eventemitter2":13}],87:[function(require,module,exports){ "use strict"; -======= -},{"../core/Message":18,"eventemitter2":2}],13:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Laura Lindzey - lindzey@gmail.com @@ -19973,14 +20268,8 @@ var SimpleActionServer = /** @class */ (function (_super) { return SimpleActionServer; }(EventEmitter2)); module.exports = SimpleActionServer; -<<<<<<< HEAD -======= -},{"../core/Message":18,"../core/Topic":25,"eventemitter2":2}],14:[function(require,module,exports){ -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); ->>>>>>> 22a24aa (Add action client support) -},{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],78:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],88:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleActionServer = exports.Goal = exports.ActionListener = exports.ActionClient = void 0; @@ -19989,22 +20278,16 @@ exports.ActionListener = require('./ActionListener'); exports.Goal = require('./Goal'); exports.SimpleActionServer = require('./SimpleActionServer'); -<<<<<<< HEAD -},{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ +},{"./ActionClient":84,"./ActionListener":85,"./Goal":86,"./SimpleActionServer":87}],89:[function(require,module,exports){ "use strict"; -======= -mixin(Ros, ['ActionClient', 'SimpleActionServer'], action); - -},{"../core/Ros":20,"../mixin":32,"./ActionClient":10,"./ActionListener":11,"./Goal":12,"./SimpleActionServer":13}],15:[function(require,module,exports){ /** * @fileoverview * @author Sebastian Castro - sebastian.castro@picknik.ai */ - var ActionGoal = require('./ActionGoal'); +var ActionFeedback = require('./ActionFeedback'); var ActionResult = require('./ActionResult'); var EventEmitter2 = require('eventemitter2').EventEmitter2; - /** * A ROS action client. * @@ -20015,88 +20298,178 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' */ function Action(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.actionType = options.actionType; - this.isAdvertised = false; - - this._serviceCallback = null; + options = options || {}; + this.ros = options.ros; + this.name = options.name; + this.actionType = options.actionType; + this.isAdvertised = false; + this._actionCallback = null; + this._cancelCallback = null; } Action.prototype.__proto__ = EventEmitter2.prototype; - /** * Calls the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * * @param request - the ROSLIB.ServiceRequest to send - * @param callback - function with params: - * * response - the response from the service request - * @param failedCallback - the callback function when the service call failed (optional). Params: + * @param resultCallback - function with params: + * * result - the result from the action + * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: + * * feedback - the feedback from the action + * @param failedCallback - the callback function when the action failed (optional). Params: * * error - the error message reported by ROS */ -Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback) { - if (this.isAdvertised) { - return; - } - - var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); - - if (resultCallback || failedCallback) { - this.ros.on(actionGoalId, function(message) { - if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === 'function') { - failedCallback(message.values); - } - } else if (message.op === "action_feedback" && typeof feedbackCallback === 'function') { - feedbackCallback(new ActionResult(message.values)); - } else if (message.op === "action_result" && typeof resultCallback === 'function') { - resultCallback(new ActionResult(message.values)); - } +Action.prototype.sendGoal = function (request, resultCallback, feedbackCallback, failedCallback) { + if (this.isAdvertised) { + return; + } + var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); + if (resultCallback || failedCallback) { + this.ros.on(actionGoalId, function (message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } + } + else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { + feedbackCallback(new ActionResult(message.values)); + } + else if (message.op === 'action_result' && typeof resultCallback === 'function') { + resultCallback(new ActionResult(message.values)); + } + }); + } + var call = { + op: 'send_action_goal', + id: actionGoalId, + action: this.name, + action_type: this.actionType, + args: request, + feedback: true, + }; + this.ros.callOnConnection(call); + return actionGoalId; +}; +Action.prototype.cancelGoal = function (id) { + var call = { + op: 'cancel_action_goal', + id: id, + action: this.name, + }; + this.ros.callOnConnection(call); +}; +/** + * Advertise the action. This turns the Action object from a client + * into a server. The callback will be called with every goal sent to this action. + * + * @param callback - This works similarly to the callback for a C++ action and should take the following params: + * * goal - the action goal + * It should return true if the action has finished successfully, + * i.e. without any fatal errors. + */ +Action.prototype.advertise = function (callback) { + if (this.isAdvertised || typeof callback !== 'function') { + return; + } + this._actionCallback = callback; + this.ros.on(this.name, this._executeAction.bind(this)); + this.ros.callOnConnection({ + op: 'advertise_action', + type: this.actionType, + action: this.name }); - } - - var call = { - op : 'send_action_goal', - id : actionGoalId, - action : this.name, - action_type: this.actionType, - args : request, - feedback : true, - }; - this.ros.callOnConnection(call); + this.isAdvertised = true; +}; +Action.prototype.unadvertise = function () { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: 'unadvertise_action', + action: this.name + }); + this.isAdvertised = false; +}; +Action.prototype._executeAction = function (rosbridgeRequest) { + var id; + if (rosbridgeRequest.id) { + id = rosbridgeRequest.id; + } + this._actionCallback(rosbridgeRequest.args, id); +}; +Action.prototype.sendFeedback = function (id, feedback) { + var call = { + op: 'action_feedback', + id: id, + action: this.name, + values: new ActionFeedback(feedback), + }; + this.ros.callOnConnection(call); +}; +Action.prototype.setSucceeded = function (id, result) { + var call = { + op: 'action_result', + id: id, + action: this.name, + values: new ActionResult(result), + result: true, + }; + this.ros.callOnConnection(call); +}; +Action.prototype.setFailed = function (id) { + var call = { + op: 'action_result', + id: id, + action: this.name, + result: false, + }; + this.ros.callOnConnection(call); }; - module.exports = Action; -},{"./ActionGoal":16,"./ActionResult":17,"eventemitter2":2}],16:[function(require,module,exports){ +},{"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"eventemitter2":13}],90:[function(require,module,exports){ +"use strict"; /** * @fileoverview * @author Sebastian Castro - sebastian.castro@picknik.ai */ - var assign = require('object-assign'); +/** + * An ActionFeedback is periodically returned during an in-progress action + * + * @constructor + * @param values - object matching the fields defined in the .action definition file + */ +function ActionFeedback(values) { + assign(this, values); +} +module.exports = ActionFeedback; +},{"object-assign":33}],91:[function(require,module,exports){ +"use strict"; +/** + * @fileoverview + * @author Sebastian Castro - sebastian.castro@picknik.ai + */ +var assign = require('object-assign'); /** - * An ActionGoal is passed into the an action goal request. + * An ActionGoal is passed into an action goal request. * * @constructor * @param values - object matching the fields defined in the .action definition file */ function ActionGoal(values) { - assign(this, values); + assign(this, values); } - module.exports = ActionGoal; -},{"object-assign":3}],17:[function(require,module,exports){ +},{"object-assign":33}],92:[function(require,module,exports){ +"use strict"; /** * @fileoverview * @author Sebastian Castro - sebastian.castro@picknik.ai */ - var assign = require('object-assign'); - /** * An ActionResult is returned from sending an action goal. * @@ -20104,13 +20477,12 @@ var assign = require('object-assign'); * @param values - object matching the fields defined in the .action definition file */ function ActionResult(values) { - assign(this, values); + assign(this, values); } - module.exports = ActionResult; -},{"object-assign":3}],18:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) +},{"object-assign":33}],93:[function(require,module,exports){ +"use strict"; /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -20132,13 +20504,9 @@ var Message = /** @class */ (function () { return Message; }()); module.exports = Message; -<<<<<<< HEAD -},{"object-assign":31}],80:[function(require,module,exports){ +},{"object-assign":33}],94:[function(require,module,exports){ "use strict"; -======= -},{"object-assign":3}],19:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -20227,13 +20595,9 @@ var Param = /** @class */ (function () { return Param; }()); module.exports = Param; -<<<<<<< HEAD -},{"../core/Ros":81,"./Service":82,"./ServiceRequest":83}],81:[function(require,module,exports){ +},{"../core/Ros":95,"./Service":96,"./ServiceRequest":97}],95:[function(require,module,exports){ "use strict"; -======= -},{"./Service":21,"./ServiceRequest":22}],20:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -21046,12 +21410,8 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; -<<<<<<< HEAD -},{"../actionlib":78,"../tf":94,"../util/workerSocket":109,"./Param":80,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./SocketAdapter.js":85,"./Topic":86,"eventemitter2":16,"object-assign":31,"ws":71}],82:[function(require,module,exports){ +},{"../actionlib":88,"../tf":108,"../util/workerSocket":123,"./Param":94,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./SocketAdapter.js":99,"./Topic":100,"eventemitter2":13,"object-assign":33,"ws":81}],96:[function(require,module,exports){ "use strict"; -======= -},{"../util/workerSocket":52,"./Service":21,"./ServiceRequest":22,"./SocketAdapter.js":24,"eventemitter2":2,"object-assign":3,"ws":49}],21:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -21195,12 +21555,8 @@ var Service = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Service; -<<<<<<< HEAD -},{"../core/Ros":81,"./ServiceRequest":83,"./ServiceResponse":84,"eventemitter2":16}],83:[function(require,module,exports){ +},{"../core/Ros":95,"./ServiceRequest":97,"./ServiceResponse":98,"eventemitter2":13}],97:[function(require,module,exports){ "use strict"; -======= -},{"./ServiceRequest":22,"./ServiceResponse":23,"eventemitter2":2}],22:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com @@ -21222,13 +21578,9 @@ var ServiceRequest = /** @class */ (function () { return ServiceRequest; }()); module.exports = ServiceRequest; -<<<<<<< HEAD -},{"object-assign":31}],84:[function(require,module,exports){ +},{"object-assign":33}],98:[function(require,module,exports){ "use strict"; -======= -},{"object-assign":3}],23:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - balexander@willowgarage.com @@ -21250,12 +21602,8 @@ var ServiceResponse = /** @class */ (function () { return ServiceResponse; }()); module.exports = ServiceResponse; -<<<<<<< HEAD -},{"object-assign":31}],85:[function(require,module,exports){ -======= -},{"object-assign":3}],24:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) +},{"object-assign":33}],99:[function(require,module,exports){ /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -21283,37 +21631,9 @@ if (typeof bson !== 'undefined') { * @private */ function SocketAdapter(client) { -<<<<<<< HEAD var decoder = null; if (client.transportOptions.decoder) { decoder = client.transportOptions.decoder; -======= - - var decoder = null; - if (client.transportOptions.decoder) { - decoder = client.transportOptions.decoder; - } - - function handleMessage(message) { - if (message.op === 'publish') { - client.emit(message.topic, message.msg); - } else if (message.op === 'service_response') { - client.emit(message.id, message); - } else if (message.op === 'call_service') { - client.emit(message.service, message); - } else if (message.op === 'send_action_goal') { - client.emit(message.action, message); - } else if (message.op === 'action_feedback') { - client.emit(message.id, message); - } else if (message.op === 'action_result') { - client.emit(message.id, message); - } else if(message.op === 'status'){ - if(message.id){ - client.emit('status:'+message.id, message); - } else { - client.emit('status', message); - } ->>>>>>> 22a24aa (Add action client support) } function handleMessage(message) { if (message.op === 'publish') { @@ -21325,6 +21645,18 @@ function SocketAdapter(client) { else if (message.op === 'call_service') { client.emit(message.service, message); } + else if (message.op === 'send_action_goal') { + client.emit(message.action, message); + } + else if (message.op === 'cancel_action_goal') { + client.emit(message.id, message); + } + else if (message.op === 'action_feedback') { + client.emit(message.id, message); + } + else if (message.op === 'action_result') { + client.emit(message.id, message); + } else if (message.op === 'status') { if (message.id) { client.emit('status:' + message.id, message); @@ -21416,12 +21748,8 @@ function SocketAdapter(client) { } module.exports = SocketAdapter; -<<<<<<< HEAD -},{"../util/cborTypedArrayTags":107,"../util/decompressPng":108,"cbor-js":14}],86:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":121,"../util/decompressPng":122,"cbor-js":11}],100:[function(require,module,exports){ "use strict"; -======= -},{"../util/cborTypedArrayTags":47,"../util/decompressPng":51,"cbor-js":1}],25:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Brandon Alexander - baalexander@gmail.com @@ -21652,11 +21980,10 @@ var Topic = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Topic; -<<<<<<< HEAD -},{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ +},{"../core/Ros":95,"./Message":93,"eventemitter2":13}],101:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ServiceResponse = exports.ServiceRequest = exports.Service = exports.Param = exports.Message = exports.Topic = exports.Ros = void 0; +exports.ActionResult = exports.ActionFeedback = exports.ActionGoal = exports.Action = exports.ServiceResponse = exports.ServiceRequest = exports.Service = exports.Param = exports.Message = exports.Topic = exports.Ros = void 0; exports.Ros = require('./Ros'); exports.Topic = require('./Topic'); exports.Message = require('./Message'); @@ -21664,30 +21991,13 @@ exports.Param = require('./Param'); exports.Service = require('./Service'); exports.ServiceRequest = require('./ServiceRequest'); exports.ServiceResponse = require('./ServiceResponse'); +exports.Action = require('./Action'); +exports.ActionGoal = require('./ActionGoal'); +exports.ActionFeedback = require('./ActionFeedback'); +exports.ActionResult = require('./ActionResult'); -},{"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ +},{"./Action":89,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"./Message":93,"./Param":94,"./Ros":95,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./Topic":100}],102:[function(require,module,exports){ "use strict"; -======= -},{"./Message":18,"eventemitter2":2}],26:[function(require,module,exports){ -var mixin = require('../mixin'); - -var core = module.exports = { - Ros: require('./Ros'), - Topic: require('./Topic'), - Message: require('./Message'), - Param: require('./Param'), - Service: require('./Service'), - ServiceRequest: require('./ServiceRequest'), - ServiceResponse: require('./ServiceResponse'), - Action: require('./Action'), - ActionGoal: require('./ActionGoal'), - ActionResult: require('./ActionResult'), -}; - -mixin(core.Ros, ['Param', 'Service', 'Topic', 'Action'], core); - -},{"../mixin":32,"./Action":15,"./ActionGoal":16,"./ActionResult":17,"./Message":18,"./Param":19,"./Ros":20,"./Service":21,"./ServiceRequest":22,"./ServiceResponse":23,"./Topic":25}],27:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21761,13 +22071,9 @@ var Pose = /** @class */ (function () { return Pose; }()); module.exports = Pose; -<<<<<<< HEAD -},{"./Quaternion":89,"./Transform":90,"./Vector3":91}],89:[function(require,module,exports){ +},{"./Quaternion":103,"./Transform":104,"./Vector3":105}],103:[function(require,module,exports){ "use strict"; -======= -},{"./Quaternion":28,"./Vector3":30}],28:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21857,12 +22163,8 @@ var Quaternion = /** @class */ (function () { }()); module.exports = Quaternion; -<<<<<<< HEAD -},{}],90:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ "use strict"; -======= -},{}],29:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21894,13 +22196,9 @@ var Transform = /** @class */ (function () { return Transform; }()); module.exports = Transform; -<<<<<<< HEAD -},{"./Quaternion":89,"./Vector3":91}],91:[function(require,module,exports){ +},{"./Quaternion":103,"./Vector3":105}],105:[function(require,module,exports){ "use strict"; -======= -},{"./Quaternion":28,"./Vector3":30}],30:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -21967,9 +22265,8 @@ var Vector3 = /** @class */ (function () { return Vector3; }()); module.exports = Vector3; -<<<<<<< HEAD -},{"./Quaternion":89}],92:[function(require,module,exports){ +},{"./Quaternion":103}],106:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Vector3 = exports.Transform = exports.Quaternion = exports.Pose = void 0; @@ -21978,38 +22275,8 @@ exports.Quaternion = require('./Quaternion'); exports.Transform = require('./Transform'); exports.Vector3 = require('./Vector3'); -},{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ +},{"./Pose":102,"./Quaternion":103,"./Transform":104,"./Vector3":105}],107:[function(require,module,exports){ "use strict"; -======= -},{}],31:[function(require,module,exports){ -module.exports = { - Pose: require('./Pose'), - Quaternion: require('./Quaternion'), - Transform: require('./Transform'), - Vector3: require('./Vector3') -}; - -},{"./Pose":27,"./Quaternion":28,"./Transform":29,"./Vector3":30}],32:[function(require,module,exports){ -/** - * Mixin a feature to the core/Ros prototype. - * For example, mixin(Ros, ['Topic'], {Topic: }) - * will add a topic bound to any Ros instances so a user - * can call `var topic = ros.Topic({name: '/foo'});` - * - * @author Graeme Yeates - github.com/megawac - */ -module.exports = function(Ros, classes, features) { - classes.forEach(function(className) { - var Class = features[className]; - Ros.prototype[className] = function(options) { - options.ros = this; - return new Class(options); - }; - }); -}; - -},{}],33:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author David Gossow - dgossow@willowgarage.com @@ -22247,105 +22514,14 @@ var TFClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = TFClient; -<<<<<<< HEAD -},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],94:[function(require,module,exports){ +},{"../actionlib/ActionClient":84,"../actionlib/Goal":86,"../core/Ros":95,"../core/Service.js":96,"../core/ServiceRequest.js":97,"../core/Topic.js":100,"../math/Transform":104,"eventemitter2":13}],108:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TFClient = void 0; exports.TFClient = require('./TFClient'); -},{"./TFClient":93}],95:[function(require,module,exports){ +},{"./TFClient":107}],109:[function(require,module,exports){ "use strict"; -======= -},{"../actionlib/ActionClient":10,"../actionlib/Goal":12,"../core/Service.js":21,"../core/ServiceRequest.js":22,"../core/Topic.js":25,"../math/Transform":29}],34:[function(require,module,exports){ -var Ros = require('../core/Ros'); -var mixin = require('../mixin'); - -var tf = module.exports = { - TFClient: require('./TFClient') -}; - -mixin(Ros, ['TFClient'], tf); -},{"../core/Ros":20,"../mixin":32,"./TFClient":33}],35:[function(require,module,exports){ -/** - * @fileOverview - * @author Benjamin Pitzer - ben.pitzer@gmail.com - * @author Russell Toris - rctoris@wpi.edu - */ - -var Vector3 = require('../math/Vector3'); -var UrdfTypes = require('./UrdfTypes'); - -/** - * A Box element in a URDF. - * - * @constructor - * @param options - object with following keys: - * * xml - the XML element to parse - */ -function UrdfBox(options) { - this.dimension = null; - this.type = UrdfTypes.URDF_BOX; - - // Parse the xml string - var xyz = options.xml.getAttribute('size').split(' '); - this.dimension = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); -} - -module.exports = UrdfBox; -},{"../math/Vector3":30,"./UrdfTypes":44}],36:[function(require,module,exports){ -/** - * @fileOverview - * @author Benjamin Pitzer - ben.pitzer@gmail.com - * @author Russell Toris - rctoris@wpi.edu - */ - -/** - * A Color element in a URDF. - * - * @constructor - * @param options - object with following keys: - * * xml - the XML element to parse - */ -function UrdfColor(options) { - // Parse the xml string - var rgba = options.xml.getAttribute('rgba').split(' '); - this.r = parseFloat(rgba[0]); - this.g = parseFloat(rgba[1]); - this.b = parseFloat(rgba[2]); - this.a = parseFloat(rgba[3]); -} - -module.exports = UrdfColor; -},{}],37:[function(require,module,exports){ -/** - * @fileOverview - * @author Benjamin Pitzer - ben.pitzer@gmail.com - * @author Russell Toris - rctoris@wpi.edu - */ - -var UrdfTypes = require('./UrdfTypes'); - -/** - * A Cylinder element in a URDF. - * - * @constructor - * @param options - object with following keys: - * * xml - the XML element to parse - */ -function UrdfCylinder(options) { - this.type = UrdfTypes.URDF_CYLINDER; - this.length = parseFloat(options.xml.getAttribute('length')); - this.radius = parseFloat(options.xml.getAttribute('radius')); -} - -module.exports = UrdfCylinder; -},{"./UrdfTypes":44}],38:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22377,7 +22553,7 @@ var UrdfBox = /** @class */ (function () { }()); module.exports = UrdfBox; -},{"../math/Vector3":91,"./UrdfTypes":104}],96:[function(require,module,exports){ +},{"../math/Vector3":105,"./UrdfTypes":118}],110:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22405,7 +22581,7 @@ var UrdfColor = /** @class */ (function () { }()); module.exports = UrdfColor; -},{}],97:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22432,7 +22608,7 @@ var UrdfCylinder = /** @class */ (function () { }()); module.exports = UrdfCylinder; -},{"./UrdfTypes":104}],98:[function(require,module,exports){ +},{"./UrdfTypes":118}],112:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22521,128 +22697,8 @@ var UrdfJoint = /** @class */ (function () { }()); module.exports = UrdfJoint; -<<<<<<< HEAD -},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91}],99:[function(require,module,exports){ +},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105}],113:[function(require,module,exports){ "use strict"; -======= -},{"../math/Pose":27,"../math/Quaternion":28,"../math/Vector3":30}],39:[function(require,module,exports){ -/** - * @fileOverview - * @author Benjamin Pitzer - ben.pitzer@gmail.com - * @author Russell Toris - rctoris@wpi.edu - */ - -var UrdfVisual = require('./UrdfVisual'); - -/** - * A Link element in a URDF. - * - * @constructor - * @param options - object with following keys: - * * xml - the XML element to parse - */ -function UrdfLink(options) { - this.name = options.xml.getAttribute('name'); - this.visuals = []; - var visuals = options.xml.getElementsByTagName('visual'); - - for( var i=0; i 0) { - this.textureFilename = textures[0].getAttribute('filename'); - } - - // Color - var colors = options.xml.getElementsByTagName('color'); - if (colors.length > 0) { - // Parse the RBGA string - this.color = new UrdfColor({ - xml : colors[0] - }); - } -} - -UrdfMaterial.prototype.isLink = function() { - return this.color === null && this.textureFilename === null; -}; - -var assign = require('object-assign'); - -UrdfMaterial.prototype.assign = function(obj) { - return assign(this, obj); -}; - -module.exports = UrdfMaterial; - -},{"./UrdfColor":36,"object-assign":3}],41:[function(require,module,exports){ -/** - * @fileOverview - * @author Benjamin Pitzer - ben.pitzer@gmail.com - * @author Russell Toris - rctoris@wpi.edu - */ - -var Vector3 = require('../math/Vector3'); -var UrdfTypes = require('./UrdfTypes'); - -/** - * A Mesh element in a URDF. - * - * @constructor - * @param options - object with following keys: - * * xml - the XML element to parse - */ -function UrdfMesh(options) { - this.scale = null; - - this.type = UrdfTypes.URDF_MESH; - this.filename = options.xml.getAttribute('filename'); - - // Check for a scale - var scale = options.xml.getAttribute('scale'); - if (scale) { - // Get the XYZ - var xyz = scale.split(' '); - this.scale = new Vector3({ - x : parseFloat(xyz[0]), - y : parseFloat(xyz[1]), - z : parseFloat(xyz[2]) - }); - } -} - -module.exports = UrdfMesh; -},{"../math/Vector3":30,"./UrdfTypes":44}],42:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22671,7 +22727,7 @@ var UrdfLink = /** @class */ (function () { }()); module.exports = UrdfLink; -},{"./UrdfVisual":105}],100:[function(require,module,exports){ +},{"./UrdfVisual":119}],114:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22716,7 +22772,7 @@ var UrdfMaterial = /** @class */ (function () { var assign = require('object-assign'); module.exports = UrdfMaterial; -},{"./UrdfColor":96,"object-assign":31}],101:[function(require,module,exports){ +},{"./UrdfColor":110,"object-assign":33}],115:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22753,7 +22809,7 @@ var UrdfMesh = /** @class */ (function () { }()); module.exports = UrdfMesh; -},{"../math/Vector3":91,"./UrdfTypes":104}],102:[function(require,module,exports){ +},{"../math/Vector3":105,"./UrdfTypes":118}],116:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22854,12 +22910,8 @@ var UrdfModel = /** @class */ (function () { }()); module.exports = UrdfModel; -<<<<<<< HEAD -},{"./UrdfJoint":98,"./UrdfLink":99,"./UrdfMaterial":100,"@xmldom/xmldom":70}],103:[function(require,module,exports){ +},{"./UrdfJoint":112,"./UrdfLink":113,"./UrdfMaterial":114,"@xmldom/xmldom":80}],117:[function(require,module,exports){ "use strict"; -======= -},{"./UrdfJoint":38,"./UrdfLink":39,"./UrdfMaterial":40,"@xmldom/xmldom":48}],43:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -22881,9 +22933,8 @@ var UrdfSphere = /** @class */ (function () { return UrdfSphere; }()); module.exports = UrdfSphere; -<<<<<<< HEAD -},{"./UrdfTypes":104}],104:[function(require,module,exports){ +},{"./UrdfTypes":118}],118:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.URDF_MESH = exports.URDF_CYLINDER = exports.URDF_BOX = exports.URDF_SPHERE = void 0; @@ -22892,19 +22943,8 @@ exports.URDF_BOX = 1; exports.URDF_CYLINDER = 2; exports.URDF_MESH = 3; -},{}],105:[function(require,module,exports){ +},{}],119:[function(require,module,exports){ "use strict"; -======= -},{"./UrdfTypes":44}],44:[function(require,module,exports){ -module.exports = { - URDF_SPHERE : 0, - URDF_BOX : 1, - URDF_CYLINDER : 2, - URDF_MESH : 3 -}; - -},{}],45:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Benjamin Pitzer - ben.pitzer@gmail.com @@ -23037,9 +23077,8 @@ var UrdfVisual = /** @class */ (function () { return UrdfVisual; }()); module.exports = UrdfVisual; -<<<<<<< HEAD -},{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":95,"./UrdfCylinder":97,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfSphere":103}],106:[function(require,module,exports){ +},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105,"./UrdfBox":109,"./UrdfCylinder":111,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfSphere":117}],120:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -23068,23 +23107,7 @@ exports.UrdfSphere = require('./UrdfSphere'); exports.UrdfVisual = require('./UrdfVisual'); __exportStar(require("./UrdfTypes"), exports); -},{"./UrdfBox":95,"./UrdfColor":96,"./UrdfCylinder":97,"./UrdfLink":99,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfModel":102,"./UrdfSphere":103,"./UrdfTypes":104,"./UrdfVisual":105}],107:[function(require,module,exports){ -======= -},{"../math/Pose":27,"../math/Quaternion":28,"../math/Vector3":30,"./UrdfBox":35,"./UrdfCylinder":37,"./UrdfMaterial":40,"./UrdfMesh":41,"./UrdfSphere":43}],46:[function(require,module,exports){ -module.exports = require('object-assign')({ - UrdfBox: require('./UrdfBox'), - UrdfColor: require('./UrdfColor'), - UrdfCylinder: require('./UrdfCylinder'), - UrdfLink: require('./UrdfLink'), - UrdfMaterial: require('./UrdfMaterial'), - UrdfMesh: require('./UrdfMesh'), - UrdfModel: require('./UrdfModel'), - UrdfSphere: require('./UrdfSphere'), - UrdfVisual: require('./UrdfVisual') -}, require('./UrdfTypes')); - -},{"./UrdfBox":35,"./UrdfColor":36,"./UrdfCylinder":37,"./UrdfLink":39,"./UrdfMaterial":40,"./UrdfMesh":41,"./UrdfModel":42,"./UrdfSphere":43,"./UrdfTypes":44,"./UrdfVisual":45,"object-assign":3}],47:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) +},{"./UrdfBox":109,"./UrdfColor":110,"./UrdfCylinder":111,"./UrdfLink":113,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfModel":116,"./UrdfSphere":117,"./UrdfTypes":118,"./UrdfVisual":119}],121:[function(require,module,exports){ 'use strict'; var UPPER32 = Math.pow(2, 32); var warnedPrecision = false; @@ -23188,25 +23211,8 @@ if (typeof module !== 'undefined' && module.exports) { module.exports = cborTypedArrayTagger; } -<<<<<<< HEAD -},{}],108:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ (function (Buffer){(function (){ -======= -},{}],48:[function(require,module,exports){ -exports.DOMImplementation = window.DOMImplementation; -exports.XMLSerializer = window.XMLSerializer; -exports.DOMParser = window.DOMParser; - -},{}],49:[function(require,module,exports){ -module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; - -},{}],50:[function(require,module,exports){ -/* global document */ -module.exports = function Canvas() { - return document.createElement('canvas'); -}; -},{}],51:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) /** * @fileOverview * @author Ramon Wijnands - rayman747@hotmail.com @@ -23240,13 +23246,9 @@ function decompressPng(data, callback) { } module.exports = decompressPng; -<<<<<<< HEAD }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":11,"pngparse":43}],109:[function(require,module,exports){ +},{"buffer":8,"pngparse":50}],123:[function(require,module,exports){ "use strict"; -======= -},{"canvas":50}],52:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now var work = require('webworkify'); @@ -23304,12 +23306,8 @@ var WorkerSocket = /** @class */ (function () { }()); module.exports = WorkerSocket; -<<<<<<< HEAD -},{"./workerSocketImpl":110,"webworkify":68,"webworkify-webpack":67}],110:[function(require,module,exports){ +},{"./workerSocketImpl":124,"webworkify":78,"webworkify-webpack":77}],124:[function(require,module,exports){ "use strict"; -======= -},{"./workerSocketImpl":53,"webworkify":7,"webworkify-webpack":6}],53:[function(require,module,exports){ ->>>>>>> 22a24aa (Add action client support) var WebSocket = WebSocket || require('ws'); module.exports = function (self) { var socket = null; @@ -23355,8 +23353,4 @@ module.exports = function (self) { }); }; -<<<<<<< HEAD -},{"ws":71}]},{},[73]); -======= -},{"ws":49}]},{},[9]); ->>>>>>> 22a24aa (Add action client support) +},{"ws":81}]},{},[83]); diff --git a/build/roslib.min.js b/build/roslib.min.js index 98e9cc8f4..30504731f 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1,5 +1 @@ -<<<<<<< HEAD -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>2),s=0;s>6):(s<55296?n.push(224|s>>12):(s=65536+((s=(1023&s)<<10)|1023&t.charCodeAt(++r)),n.push(240|s>>18),n.push(128|s>>12&63)),n.push(128|s>>6&63)),n.push(128|63&s))}return m(3,n.length),p(n);default:if(Array.isArray(t))for(m(4,o=t.length),r=0;r>5!==e)throw"Invalid indefinite length element";return i}function A(e,t){for(var i=0;i>10),e.push(56320|1023&n))}}"function"!=typeof d&&(d=function(e){return e}),"function"!=typeof y&&(y=function(){return M});var e=function e(){var t,i,n=x(),r=n>>5,n=31&n;if(7==r)switch(n){case 25:var s=new ArrayBuffer(4),s=new DataView(s),o=T(),a=31744&o,c=1023&o;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=c)return c*U;return s.setUint32(0,(32768&o)<<16|a<<13|c<<13),s.getFloat32(0);case 26:return w(g.getFloat32(b),4);case 27:return w(g.getFloat64(b),8)}if((t=S(n))<0&&(r<2||6this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,c))):l._listeners=t,!0;return!0}.call(this,e,t,i):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),i?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=t,r},r.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var i=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;o=this._events[e],i.push({_listeners:o})}for(var r=0;rt.secs)&&(e.secs>>>>>> 22a24aa (Add action client support) +!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs 47) { + console.log('Aborting. Value will exceed maximum signed integer value.'); + fibonacciServer.setFailed(id); + return; } - //send result - var result = { sequence: fibonacciSequence}; - that.fibonacciServer.setSucceeded(result); - }); + // publish feedback + for (var i = 1; i < goal.order; i++ ) { + fibonacciSequence.push( fibonacciSequence[i] + fibonacciSequence[i-1] ); + console.log('Sending feedback: ' + fibonacciSequence); + fibonacciServer.sendFeedback(id, { partial_sequence : fibonacciSequence }); + } - this.fibonacciServer.on('cancel', function(goalMessage){ - that.canceled = true; + // send result + console.log('Sending result: ' + fibonacciSequence); + fibonacciServer.setSucceeded(id, { sequence: fibonacciSequence }); }); -

Fibonacci ActionClient Example

+

Fibonacci ActionServer Example

Run the following commands in the terminal then refresh this page. Check the JavaScript console for the output.

    -
  1. roscore
  2. -
  3. roslaunch rosbridge_server rosbridge_websocket.launch
  4. +
  5. ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  6. refresh this page
  7. -
  8. rosrun actionlib_tutorials fibonacci_client
  9. +
  10. ros2 run action_tutorials_py fibonacci_action_client +
    or
    + ros2 action send_goal --feedback /fibonacci action_tutorials_interfaces/action/Fibonacci order:\ 20\ +
diff --git a/src/RosLib.js b/src/RosLib.js index 66ebdca8c..eef7f61af 100644 --- a/src/RosLib.js +++ b/src/RosLib.js @@ -27,8 +27,6 @@ var assign = require('object-assign'); // Add core components assign(ROSLIB, require('./core')); -assign(ROSLIB, require('./actionlib')); - assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); diff --git a/src/core/Action.js b/src/core/Action.js index 7430f5a8a..63c5b9288 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -24,7 +24,8 @@ function Action(options) { this.actionType = options.actionType; this.isAdvertised = false; - this._serviceCallback = null; + this._actionCallback = null; + this._cancelCallback = null; } Action.prototype.__proto__ = EventEmitter2.prototype; @@ -70,6 +71,92 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, feedback : true, }; this.ros.callOnConnection(call); + + return actionGoalId; +}; + +Action.prototype.cancelGoal = function(id) { + var call = { + op: 'cancel_action_goal', + id: id, + action: this.name, + }; + this.ros.callOnConnection(call); +}; + +/** + * Advertise the action. This turns the Action object from a client + * into a server. The callback will be called with every goal sent to this action. + * + * @param callback - This works similarly to the callback for a C++ action and should take the following params: + * * goal - the action goal + * It should return true if the action has finished successfully, + * i.e. without any fatal errors. + */ +Action.prototype.advertise = function(callback) { + if (this.isAdvertised || typeof callback !== 'function') { + return; + } + + this._actionCallback = callback; + this.ros.on(this.name, this._executeAction.bind(this)); + this.ros.callOnConnection({ + op: 'advertise_action', + type: this.actionType, + action: this.name + }); + this.isAdvertised = true; +}; + +Action.prototype.unadvertise = function() { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: 'unadvertise_action', + action: this.name + }); + this.isAdvertised = false; +}; + +Action.prototype._executeAction = function(rosbridgeRequest) { + var id; + if (rosbridgeRequest.id) { + id = rosbridgeRequest.id; + } + + this._actionCallback(rosbridgeRequest.args, id); +}; + +Action.prototype.sendFeedback = function(id, feedback) { + var call = { + op: 'action_feedback', + id: id, + action: this.name, + values: new ActionFeedback(feedback), + }; + this.ros.callOnConnection(call); +}; + +Action.prototype.setSucceeded = function(id, result) { + var call = { + op: 'action_result', + id: id, + action: this.name, + values: new ActionResult(result), + result: true, + }; + this.ros.callOnConnection(call); +}; + +Action.prototype.setFailed = function(id) { + var call = { + op: 'action_result', + id: id, + action: this.name, + result: false, + }; + this.ros.callOnConnection(call); }; module.exports = Action; diff --git a/src/core/SocketAdapter.js b/src/core/SocketAdapter.js index 4e777e830..36da7cc2f 100644 --- a/src/core/SocketAdapter.js +++ b/src/core/SocketAdapter.js @@ -41,6 +41,8 @@ function SocketAdapter(client) { client.emit(message.service, message); } else if (message.op === 'send_action_goal') { client.emit(message.action, message); + } else if (message.op === 'cancel_action_goal') { + client.emit(message.id, message); } else if (message.op === 'action_feedback') { client.emit(message.id, message); } else if (message.op === 'action_result') { From 63744b3a0fecc2b325be51dbd1a3643ce6bedc01 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 7 Nov 2023 09:37:55 -0500 Subject: [PATCH 44/66] Skip old Fibonacci test --- test/examples/fibonacci.example.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/examples/fibonacci.example.js b/test/examples/fibonacci.example.js index 16c1bce52..df9f34c45 100644 --- a/test/examples/fibonacci.example.js +++ b/test/examples/fibonacci.example.js @@ -1,7 +1,7 @@ var expect = require('chai').expect; var ROSLIB = require('../..'); -describe('Fibonacci Example', function() { +describe.skip('Fibonacci Example', function() { it('Fibonacci', function(done) { this.timeout(8000); From e08790c34cacab94896c50aa2f6a837917ee58c7 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 7 Nov 2023 09:48:47 -0500 Subject: [PATCH 45/66] Update examples --- .../{fibonacci_client.html => fibonacci_action_client.html} | 0 .../{fibonacci_server.html => fibonacci_action_server.html} | 0 examples/simple.html | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename examples/{fibonacci_client.html => fibonacci_action_client.html} (100%) rename examples/{fibonacci_server.html => fibonacci_action_server.html} (100%) diff --git a/examples/fibonacci_client.html b/examples/fibonacci_action_client.html similarity index 100% rename from examples/fibonacci_client.html rename to examples/fibonacci_action_client.html diff --git a/examples/fibonacci_server.html b/examples/fibonacci_action_server.html similarity index 100% rename from examples/fibonacci_server.html rename to examples/fibonacci_action_server.html diff --git a/examples/simple.html b/examples/simple.html index 3799dbdc3..656713330 100644 --- a/examples/simple.html +++ b/examples/simple.html @@ -134,7 +134,7 @@

Simple roslib Example

  1. ros2 topic pub /listener std_msgs/msg/String "{ data: 'hello world' }"
  2. ros2 topic echo /cmd_vel
  3. -
  4. ros2 run rclpy_tutorials add_two_ints_server_py
  5. +
  6. ros2 run demo_nodes_py add_two_ints_server
  7. ros2 launch rosbridge_server rosbridge_websocket_launch.xml
From 53c4ca41c8e2e71a389006c9ba52d331aae2dfda Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 7 Nov 2023 09:55:03 -0500 Subject: [PATCH 46/66] Remove old fibonacci test --- test/examples/fibonacci.example.js | 55 ------------------------------ 1 file changed, 55 deletions(-) delete mode 100644 test/examples/fibonacci.example.js diff --git a/test/examples/fibonacci.example.js b/test/examples/fibonacci.example.js deleted file mode 100644 index df9f34c45..000000000 --- a/test/examples/fibonacci.example.js +++ /dev/null @@ -1,55 +0,0 @@ -var expect = require('chai').expect; -var ROSLIB = require('../..'); - -describe.skip('Fibonacci Example', function() { - it('Fibonacci', function(done) { - this.timeout(8000); - - var ros = new ROSLIB.Ros({ - url: 'ws://localhost:9090' - }); - // The ActionClient - // ---------------- - - var fibonacciClient = new ROSLIB.ActionClient({ - ros: ros, - serverName: '/fibonacci', - actionName: 'actionlib_tutorials/FibonacciAction' - }); - - // Create a goal. - var goal = new ROSLIB.Goal({ - actionClient: fibonacciClient, - goalMessage: { - order: 7 - } - }); - - // Print out their output into the terminal. - var items = [ - {'sequence': [0, 1, 1]}, - {'sequence': [0, 1, 1, 2]}, - {'sequence': [0, 1, 1, 2, 3]}, - {'sequence': [0, 1, 1, 2, 3, 5]}, - {'sequence': [0, 1, 1, 2, 3, 5, 8]}, - {'sequence': [0, 1, 1, 2, 3, 5, 8, 13]}, - {'sequence': [0, 1, 1, 2, 3, 5, 8, 13, 21]} - ]; - goal.on('feedback', function(feedback) { - console.log('Feedback:', feedback); - expect(feedback).to.eql(items.shift()); - }); - goal.on('result', function(result) { - console.log('Result:', result); - expect(result).to.eql({'sequence': [0, 1, 1, 2, 3, 5, 8, 13, 21]}); - done(); - }); - - // Send the goal to the action server. - // The timeout is to allow rosbridge to properly subscribe all the - // Action topics - otherwise, the first feedback message might get lost - setTimeout(function(){ - goal.send(); - }, 100); - }); -}); \ No newline at end of file From 47e7aff80e5211780c1f2313302b71fc89904375 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:42:24 -0500 Subject: [PATCH 47/66] dDo not remove any ROS 1 functionality --- build/core/Action.d.ts | 4 +- build/core/ActionFeedback.d.ts | 4 +- build/core/ActionGoal.d.ts | 4 +- build/core/ActionResult.d.ts | 4 +- build/roslib.js | 9 +- build/roslib.min.js | 2 +- examples/action_client.html | 94 +++++++++++ examples/action_server.html | 75 +++++++++ ...on_client.html => ros2_action_client.html} | 0 ...on_server.html => ros2_action_server.html} | 0 examples/ros2_simple.html | 156 ++++++++++++++++++ examples/simple.html | 43 ++++- src/RosLib.js | 2 + src/core/Action.js | 2 +- src/core/ActionFeedback.js | 2 +- src/core/ActionGoal.js | 2 +- src/core/ActionResult.js | 2 +- test/examples/fibonacci.example.js | 55 ++++++ 18 files changed, 438 insertions(+), 22 deletions(-) create mode 100644 examples/action_client.html create mode 100644 examples/action_server.html rename examples/{fibonacci_action_client.html => ros2_action_client.html} (100%) rename examples/{fibonacci_action_server.html => ros2_action_server.html} (100%) create mode 100644 examples/ros2_simple.html create mode 100644 test/examples/fibonacci.example.js diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index 54d9a2204..7bd4dfaeb 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -1,6 +1,6 @@ export = Action; /** - * A ROS action client. + * A ROS 2 action client. * * @constructor * @params options - possible keys include: @@ -11,7 +11,7 @@ export = Action; declare function Action(options: any): void; declare class Action { /** - * A ROS action client. + * A ROS 2 action client. * * @constructor * @params options - possible keys include: diff --git a/build/core/ActionFeedback.d.ts b/build/core/ActionFeedback.d.ts index 32a3c5b16..dc0701d20 100644 --- a/build/core/ActionFeedback.d.ts +++ b/build/core/ActionFeedback.d.ts @@ -1,6 +1,6 @@ export = ActionFeedback; /** - * An ActionFeedback is periodically returned during an in-progress action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action * * @constructor * @param values - object matching the fields defined in the .action definition file @@ -8,7 +8,7 @@ export = ActionFeedback; declare function ActionFeedback(values: any): void; declare class ActionFeedback { /** - * An ActionFeedback is periodically returned during an in-progress action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/build/core/ActionGoal.d.ts b/build/core/ActionGoal.d.ts index 431c3de06..c58866f4d 100644 --- a/build/core/ActionGoal.d.ts +++ b/build/core/ActionGoal.d.ts @@ -1,6 +1,6 @@ export = ActionGoal; /** - * An ActionGoal is passed into an action goal request. + * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor * @param values - object matching the fields defined in the .action definition file @@ -8,7 +8,7 @@ export = ActionGoal; declare function ActionGoal(values: any): void; declare class ActionGoal { /** - * An ActionGoal is passed into an action goal request. + * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/build/core/ActionResult.d.ts b/build/core/ActionResult.d.ts index a6f96530d..44ee2833f 100644 --- a/build/core/ActionResult.d.ts +++ b/build/core/ActionResult.d.ts @@ -1,6 +1,6 @@ export = ActionResult; /** - * An ActionResult is returned from sending an action goal. + * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor * @param values - object matching the fields defined in the .action definition file @@ -8,7 +8,7 @@ export = ActionResult; declare function ActionResult(values: any): void; declare class ActionResult { /** - * An ActionResult is returned from sending an action goal. + * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/build/roslib.js b/build/roslib.js index ab7c2e35b..c8bb82276 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19659,6 +19659,7 @@ var ROSLIB = this.ROSLIB || { var assign = require('object-assign'); // Add core components assign(ROSLIB, require('./core')); +assign(ROSLIB, require('./actionlib')); assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); @@ -20289,7 +20290,7 @@ var ActionFeedback = require('./ActionFeedback'); var ActionResult = require('./ActionResult'); var EventEmitter2 = require('eventemitter2').EventEmitter2; /** - * A ROS action client. + * A ROS 2 action client. * * @constructor * @params options - possible keys include: @@ -20435,7 +20436,7 @@ module.exports = Action; */ var assign = require('object-assign'); /** - * An ActionFeedback is periodically returned during an in-progress action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action * * @constructor * @param values - object matching the fields defined in the .action definition file @@ -20453,7 +20454,7 @@ module.exports = ActionFeedback; */ var assign = require('object-assign'); /** - * An ActionGoal is passed into an action goal request. + * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor * @param values - object matching the fields defined in the .action definition file @@ -20471,7 +20472,7 @@ module.exports = ActionGoal; */ var assign = require('object-assign'); /** - * An ActionResult is returned from sending an action goal. + * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/build/roslib.min.js b/build/roslib.min.js index 30504731f..961e09d1f 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs + + + + + + + + + + +

Fibonacci ActionClient Example

+

Run the following commands in the terminal then refresh this page. Check the JavaScript + console for the output.

+
    +
  1. roscore
  2. +
  3. rosrun actionlib_tutorials fibonacci_server
  4. +
  5. roslaunch rosbridge_server rosbridge_websocket.launch
  6. +
+
+

+ Connecting to rosbridge... +

+ + + +
+ + diff --git a/examples/action_server.html b/examples/action_server.html new file mode 100644 index 000000000..6676b1f80 --- /dev/null +++ b/examples/action_server.html @@ -0,0 +1,75 @@ + + + + + + + + + + + +

Fibonacci ActionClient Example

+

Run the following commands in the terminal then refresh this page. Check the JavaScript + console for the output.

+
    +
  1. roscore
  2. +
  3. roslaunch rosbridge_server rosbridge_websocket.launch
  4. +
  5. refresh this page
  6. +
  7. rosrun actionlib_tutorials fibonacci_client
  8. +
+ + diff --git a/examples/fibonacci_action_client.html b/examples/ros2_action_client.html similarity index 100% rename from examples/fibonacci_action_client.html rename to examples/ros2_action_client.html diff --git a/examples/fibonacci_action_server.html b/examples/ros2_action_server.html similarity index 100% rename from examples/fibonacci_action_server.html rename to examples/ros2_action_server.html diff --git a/examples/ros2_simple.html b/examples/ros2_simple.html new file mode 100644 index 000000000..b953f32e4 --- /dev/null +++ b/examples/ros2_simple.html @@ -0,0 +1,156 @@ + + + + + + + + + + + +

Simple roslib Example

+

Run the following commands in the terminal then refresh this page. Check the JavaScript + console for the output.

+
    +
  1. ros2 topic pub /listener std_msgs/msg/String "{ data: 'hello world' }"
  2. +
  3. ros2 topic echo /cmd_vel
  4. +
  5. ros2 run demo_nodes_py add_two_ints_server
  6. +
  7. ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  8. +
+
+

+ Connecting to rosbridge... +

+ + + +
+ + diff --git a/examples/simple.html b/examples/simple.html index 656713330..16cbf6da8 100644 --- a/examples/simple.html +++ b/examples/simple.html @@ -91,7 +91,7 @@ var addTwoIntsClient = new ROSLIB.Service({ ros : ros, name : '/add_two_ints', - serviceType : 'example_interfaces/AddTwoInts' + serviceType : 'rospy_tutorials/AddTwoInts' }); // Then we create a Service Request. The object we pass in to ROSLIB.ServiceRequest matches the @@ -124,6 +124,38 @@ response['message'] = 'Set successfully'; return true; }); + + // Setting a param value + // --------------------- + + ros.getParams(function(params) { + console.log(params); + }); + + // First, we create a Param object with the name of the param. + var maxVelX = new ROSLIB.Param({ + ros : ros, + name : 'max_vel_y' + }); + + // Then we set the value of the param, which is sent to the ROS Parameter Server. + maxVelX.set(0.8); + maxVelX.get(function(value) { + console.log('MAX VAL: ' + value); + }); + + // Getting a param value + // --------------------- + + var favoriteColor = new ROSLIB.Param({ + ros : ros, + name : 'favorite_color' + }); + + favoriteColor.set('red'); + favoriteColor.get(function(value) { + console.log('My robot\'s favorite color is ' + value); + }); @@ -132,10 +164,11 @@

Simple roslib Example

Run the following commands in the terminal then refresh this page. Check the JavaScript console for the output.

    -
  1. ros2 topic pub /listener std_msgs/msg/String "{ data: 'hello world' }"
  2. -
  3. ros2 topic echo /cmd_vel
  4. -
  5. ros2 run demo_nodes_py add_two_ints_server
  6. -
  7. ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  8. +
  9. roscore
  10. +
  11. rostopic pub /listener std_msgs/String "Hello, World"
  12. +
  13. rostopic echo /cmd_vel
  14. +
  15. rosrun rospy_tutorials add_two_ints_server
  16. +
  17. roslaunch rosbridge_server rosbridge_websocket.launch

diff --git a/src/RosLib.js b/src/RosLib.js index eef7f61af..66ebdca8c 100644 --- a/src/RosLib.js +++ b/src/RosLib.js @@ -27,6 +27,8 @@ var assign = require('object-assign'); // Add core components assign(ROSLIB, require('./core')); +assign(ROSLIB, require('./actionlib')); + assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); diff --git a/src/core/Action.js b/src/core/Action.js index 63c5b9288..63a998c37 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -9,7 +9,7 @@ var ActionResult = require('./ActionResult'); var EventEmitter2 = require('eventemitter2').EventEmitter2; /** - * A ROS action client. + * A ROS 2 action client. * * @constructor * @params options - possible keys include: diff --git a/src/core/ActionFeedback.js b/src/core/ActionFeedback.js index 000992a83..8a8157a8e 100644 --- a/src/core/ActionFeedback.js +++ b/src/core/ActionFeedback.js @@ -6,7 +6,7 @@ var assign = require('object-assign'); /** - * An ActionFeedback is periodically returned during an in-progress action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/src/core/ActionGoal.js b/src/core/ActionGoal.js index ff9b3773a..0f8e27ecd 100644 --- a/src/core/ActionGoal.js +++ b/src/core/ActionGoal.js @@ -6,7 +6,7 @@ var assign = require('object-assign'); /** - * An ActionGoal is passed into an action goal request. + * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/src/core/ActionResult.js b/src/core/ActionResult.js index 6eb002363..5e6565ecc 100644 --- a/src/core/ActionResult.js +++ b/src/core/ActionResult.js @@ -6,7 +6,7 @@ var assign = require('object-assign'); /** - * An ActionResult is returned from sending an action goal. + * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor * @param values - object matching the fields defined in the .action definition file diff --git a/test/examples/fibonacci.example.js b/test/examples/fibonacci.example.js new file mode 100644 index 000000000..783fa6b6f --- /dev/null +++ b/test/examples/fibonacci.example.js @@ -0,0 +1,55 @@ +var expect = require('chai').expect; +var ROSLIB = require('../..'); + +describe('Fibonacci Example', function() { + it('Fibonacci', function(done) { + this.timeout(8000); + + var ros = new ROSLIB.Ros({ + url: 'ws://localhost:9090' + }); + // The ActionClient + // ---------------- + + var fibonacciClient = new ROSLIB.ActionClient({ + ros: ros, + serverName: '/fibonacci', + actionName: 'actionlib_tutorials/FibonacciAction' + }); + + // Create a goal. + var goal = new ROSLIB.Goal({ + actionClient: fibonacciClient, + goalMessage: { + order: 7 + } + }); + + // Print out their output into the terminal. + var items = [ + {'sequence': [0, 1, 1]}, + {'sequence': [0, 1, 1, 2]}, + {'sequence': [0, 1, 1, 2, 3]}, + {'sequence': [0, 1, 1, 2, 3, 5]}, + {'sequence': [0, 1, 1, 2, 3, 5, 8]}, + {'sequence': [0, 1, 1, 2, 3, 5, 8, 13]}, + {'sequence': [0, 1, 1, 2, 3, 5, 8, 13, 21]} + ]; + goal.on('feedback', function(feedback) { + console.log('Feedback:', feedback); + expect(feedback).to.eql(items.shift()); + }); + goal.on('result', function(result) { + console.log('Result:', result); + expect(result).to.eql({'sequence': [0, 1, 1, 2, 3, 5, 8, 13, 21]}); + done(); + }); + + // Send the goal to the action server. + // The timeout is to allow rosbridge to properly subscribe all the + // Action topics - otherwise, the first feedback message might get lost + setTimeout(function(){ + goal.send(); + }, 100); + }); +}); From 56b3d42275f68a6cfa6b9ab6e80475a6d19cec9d Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:43:07 -0500 Subject: [PATCH 48/66] Revert unneeded formatting changes --- src/actionlib/SimpleActionServer.js | 2 +- test/examples/fibonacci.example.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index 311e4ffd3..39d1370eb 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -241,4 +241,4 @@ class SimpleActionServer extends EventEmitter2 { } } -module.exports = SimpleActionServer; +module.exports = SimpleActionServer; \ No newline at end of file diff --git a/test/examples/fibonacci.example.js b/test/examples/fibonacci.example.js index 783fa6b6f..16c1bce52 100644 --- a/test/examples/fibonacci.example.js +++ b/test/examples/fibonacci.example.js @@ -52,4 +52,4 @@ describe('Fibonacci Example', function() { goal.send(); }, 100); }); -}); +}); \ No newline at end of file From 6770cba9fd440ff64f138537d15345b3397df9eb Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Tue, 28 Nov 2023 11:43:19 -0700 Subject: [PATCH 49/66] update build --- build/core/Param.d.ts | 17 ++++++++++++----- build/roslib.js | 23 +++++++++++++++-------- build/roslib.min.js | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/build/core/Param.d.ts b/build/core/Param.d.ts index 58b942907..0c7f28b0b 100644 --- a/build/core/Param.d.ts +++ b/build/core/Param.d.ts @@ -18,32 +18,39 @@ declare class Param { * @callback getCallback * @param {Object} value - The value of the param from ROS. */ + /** + * @callback getFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Fetch the value of the param. * - * @param {getCallback} callback - Function with the following params: + * @param {getCallback} callback - The callback function. + * @param {getFailedCallback} [failedCallback] - The callback function when the service call failed. */ - get(callback: (value: any) => any): void; + get(callback: (value: any) => any, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback setParamCallback * @param {Object} response - The response from the service request. */ /** * @callback setParamFailedCallback - * @param {Object} response - The response from the service request. + * @param {string} error - The error message reported by ROS. */ /** * Set the value of the param in ROS. * * @param {Object} value - The value to set param to. * @param {setParamCallback} [callback] - The callback function. + * @param {setParamFailedCallback} [failedCallback] - The callback function when the service call failed. */ - set(value: any, callback?: ((response: any) => any) | undefined): void; + set(value: any, callback?: ((response: any) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; /** * Delete this parameter on the ROS server. * * @param {setParamCallback} callback - The callback function. + * @param {setParamFailedCallback} [failedCallback] - The callback function when the service call failed. */ - delete(callback: (response: any) => any): void; + delete(callback: (response: any) => any, failedCallback?: ((error: string) => any) | undefined): void; } import Ros = require("../core/Ros"); diff --git a/build/roslib.js b/build/roslib.js index 2140e836a..258118738 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20015,12 +20015,17 @@ var Param = /** @class */ (function () { * @callback getCallback * @param {Object} value - The value of the param from ROS. */ + /** + * @callback getFailedCallback + * @param {string} error - The error message reported by ROS. + */ /** * Fetch the value of the param. * - * @param {getCallback} callback - Function with the following params: + * @param {getCallback} callback - The callback function. + * @param {getFailedCallback} [failedCallback] - The callback function when the service call failed. */ - Param.prototype.get = function (callback) { + Param.prototype.get = function (callback, failedCallback) { var paramClient = new Service({ ros: this.ros, name: '/rosapi/get_param', @@ -20032,7 +20037,7 @@ var Param = /** @class */ (function () { paramClient.callService(request, function (result) { var value = JSON.parse(result.value); callback(value); - }); + }, failedCallback); }; /** * @callback setParamCallback @@ -20040,15 +20045,16 @@ var Param = /** @class */ (function () { */ /** * @callback setParamFailedCallback - * @param {Object} response - The response from the service request. + * @param {string} error - The error message reported by ROS. */ /** * Set the value of the param in ROS. * * @param {Object} value - The value to set param to. * @param {setParamCallback} [callback] - The callback function. + * @param {setParamFailedCallback} [failedCallback] - The callback function when the service call failed. */ - Param.prototype.set = function (value, callback) { + Param.prototype.set = function (value, callback, failedCallback) { var paramClient = new Service({ ros: this.ros, name: '/rosapi/set_param', @@ -20058,14 +20064,15 @@ var Param = /** @class */ (function () { name: this.name, value: JSON.stringify(value) }); - paramClient.callService(request, callback); + paramClient.callService(request, callback, failedCallback); }; /** * Delete this parameter on the ROS server. * * @param {setParamCallback} callback - The callback function. + * @param {setParamFailedCallback} [failedCallback] - The callback function when the service call failed. */ - Param.prototype.delete = function (callback) { + Param.prototype.delete = function (callback, failedCallback) { var paramClient = new Service({ ros: this.ros, name: '/rosapi/delete_param', @@ -20074,7 +20081,7 @@ var Param = /** @class */ (function () { var request = new ServiceRequest({ name: this.name }); - paramClient.callService(request, callback); + paramClient.callService(request, callback, failedCallback); }; return Param; }()); diff --git a/build/roslib.min.js b/build/roslib.min.js index f28ac832b..16f87041e 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Tue, 14 Nov 2023 07:49:35 -0500 Subject: [PATCH 50/66] Fix typo from PR comment --- src/core/Action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Action.js b/src/core/Action.js index 63a998c37..9043d2eeb 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -55,7 +55,7 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback(message.values); } } else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { - feedbackCallback(new ActionResult(message.values)); + feedbackCallback(new ActionFeedback(message.values)); } else if (message.op === 'action_result' && typeof resultCallback === 'function') { resultCallback(new ActionResult(message.values)); } From 81ea422b5d5ac6de85a19f11e9c4df5069201f0d Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 14 Nov 2023 13:15:35 -0500 Subject: [PATCH 51/66] Fix up more comments --- src/core/Action.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/core/Action.js b/src/core/Action.js index 9043d2eeb..9833f4fe1 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -30,18 +30,19 @@ function Action(options) { Action.prototype.__proto__ = EventEmitter2.prototype; /** - * Calls the service. Returns the service response in the - * callback. Does nothing if this service is currently advertised. + * Sends an action goal. Returns the feedback in the feedback callback while the action is running + * and the result in the result callback when the action is completed. + * Does nothing if this action is currently advertised. * - * @param request - the ROSLIB.ServiceRequest to send - * @param resultCallback - function with params: + * @param goal - the ROSLIB.ActionGoal to send + * @param resultCallback - the callback function when the action is completed with params: * * result - the result from the action * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: * * feedback - the feedback from the action * @param failedCallback - the callback function when the action failed (optional). Params: * * error - the error message reported by ROS */ -Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback) { +Action.prototype.sendGoal = function(goal, resultCallback, feedbackCallback, failedCallback) { if (this.isAdvertised) { return; } @@ -67,7 +68,7 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, id : actionGoalId, action : this.name, action_type: this.actionType, - args : request, + args : goal, feedback : true, }; this.ros.callOnConnection(call); @@ -75,6 +76,11 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, return actionGoalId; }; +/** + * Cancels an action goal. + * + * @param id - the ID of the action goal to cancel. + */ Action.prototype.cancelGoal = function(id) { var call = { op: 'cancel_action_goal', @@ -108,6 +114,9 @@ Action.prototype.advertise = function(callback) { this.isAdvertised = true; }; +/** + * Unadvertise a previously advertised action. + */ Action.prototype.unadvertise = function() { if (!this.isAdvertised) { return; From 87e75be903d7151073541d4bf30d8e3b839d9511 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 14 Nov 2023 17:00:58 -0500 Subject: [PATCH 52/66] Add more docstrings for completeness --- src/core/Action.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/core/Action.js b/src/core/Action.js index 9833f4fe1..2af942fc4 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -128,6 +128,13 @@ Action.prototype.unadvertise = function() { this.isAdvertised = false; }; +/** + * Helper function that executes an action by calling the provided + * action callback with the auto-generated ID as a user-accessible input. + * Should not be called manually. + * + * @param rosbridgeRequest - The ROSLIB.ActionGoal to send + */ Action.prototype._executeAction = function(rosbridgeRequest) { var id; if (rosbridgeRequest.id) { @@ -137,6 +144,12 @@ Action.prototype._executeAction = function(rosbridgeRequest) { this._actionCallback(rosbridgeRequest.args, id); }; +/** + * Helper function to send action feedback inside an action handler. + * + * @param id - The action goal ID. + * @param feedback - The feedback to send. + */ Action.prototype.sendFeedback = function(id, feedback) { var call = { op: 'action_feedback', @@ -147,6 +160,12 @@ Action.prototype.sendFeedback = function(id, feedback) { this.ros.callOnConnection(call); }; +/** + * Helper function to set an action as succeeded. + * + * @param id - The action goal ID. + * @param result - The result to set. + */ Action.prototype.setSucceeded = function(id, result) { var call = { op: 'action_result', @@ -158,6 +177,11 @@ Action.prototype.setSucceeded = function(id, result) { this.ros.callOnConnection(call); }; +/** + * Helper function to set an action as failed. + * + * @param id - The action goal ID. + */ Action.prototype.setFailed = function(id) { var call = { op: 'action_result', From b5e943b823cc0b64953456c8d4564b020d5636c4 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:43:35 -0500 Subject: [PATCH 53/66] Add parameter ROS 2 example --- build/roslib.js | 138 ++++++++++++++++++++++++++++++++++++-- build/roslib.min.js | 6 +- examples/ros2_simple.html | 17 +++++ 3 files changed, 156 insertions(+), 5 deletions(-) diff --git a/build/roslib.js b/build/roslib.js index c8bb82276..fd26b85e4 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20309,17 +20309,19 @@ function Action(options) { } Action.prototype.__proto__ = EventEmitter2.prototype; /** - * Calls the service. Returns the service response in the - * callback. Does nothing if this service is currently advertised. + * Sends an action goal. Returns the feedback in the feedback callback while the action is running + * and the result in the result callback when the action is completed. + * Does nothing if this action is currently advertised. * - * @param request - the ROSLIB.ServiceRequest to send - * @param resultCallback - function with params: + * @param goal - the ROSLIB.ActionGoal to send + * @param resultCallback - the callback function when the action is completed with params: * * result - the result from the action * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: * * feedback - the feedback from the action * @param failedCallback - the callback function when the action failed (optional). Params: * * error - the error message reported by ROS */ +<<<<<<< HEAD Action.prototype.sendGoal = function (request, resultCallback, feedbackCallback, failedCallback) { if (this.isAdvertised) { return; @@ -20358,6 +20360,54 @@ Action.prototype.cancelGoal = function (id) { action: this.name, }; this.ros.callOnConnection(call); +======= +Action.prototype.sendGoal = function(goal, resultCallback, feedbackCallback, failedCallback) { + if (this.isAdvertised) { + return; + } + + var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); + + if (resultCallback || failedCallback) { + this.ros.on(actionGoalId, function(message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } + } else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { + feedbackCallback(new ActionFeedback(message.values)); + } else if (message.op === 'action_result' && typeof resultCallback === 'function') { + resultCallback(new ActionResult(message.values)); + } + }); + } + + var call = { + op : 'send_action_goal', + id : actionGoalId, + action : this.name, + action_type: this.actionType, + args : goal, + feedback : true, + }; + this.ros.callOnConnection(call); + + return actionGoalId; +}; + +/** + * Cancels an action goal. + * + * @param id - the ID of the action goal to cancel. + */ +Action.prototype.cancelGoal = function(id) { + var call = { + op: 'cancel_action_goal', + id: id, + action: this.name, + }; + this.ros.callOnConnection(call); +>>>>>>> 9edabb3 (Add parameter ROS 2 example) }; /** * Advertise the action. This turns the Action object from a client @@ -20381,6 +20431,7 @@ Action.prototype.advertise = function (callback) { }); this.isAdvertised = true; }; +<<<<<<< HEAD Action.prototype.unadvertise = function () { if (!this.isAdvertised) { return; @@ -20425,6 +20476,85 @@ Action.prototype.setFailed = function (id) { result: false, }; this.ros.callOnConnection(call); +======= + +/** + * Unadvertise a previously advertised action. + */ +Action.prototype.unadvertise = function() { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: 'unadvertise_action', + action: this.name + }); + this.isAdvertised = false; +}; + +/** + * Helper function that executes an action by calling the provided + * action callback with the auto-generated ID as a user-accessible input. + * Should not be called manually. + * + * @param rosbridgeRequest - The ROSLIB.ActionGoal to send + */ +Action.prototype._executeAction = function(rosbridgeRequest) { + var id; + if (rosbridgeRequest.id) { + id = rosbridgeRequest.id; + } + + this._actionCallback(rosbridgeRequest.args, id); +}; + +/** + * Helper function to send action feedback inside an action handler. + * + * @param id - The action goal ID. + * @param feedback - The feedback to send. + */ +Action.prototype.sendFeedback = function(id, feedback) { + var call = { + op: 'action_feedback', + id: id, + action: this.name, + values: new ActionFeedback(feedback), + }; + this.ros.callOnConnection(call); +}; + +/** + * Helper function to set an action as succeeded. + * + * @param id - The action goal ID. + * @param result - The result to set. + */ +Action.prototype.setSucceeded = function(id, result) { + var call = { + op: 'action_result', + id: id, + action: this.name, + values: new ActionResult(result), + result: true, + }; + this.ros.callOnConnection(call); +}; + +/** + * Helper function to set an action as failed. + * + * @param id - The action goal ID. + */ +Action.prototype.setFailed = function(id) { + var call = { + op: 'action_result', + id: id, + action: this.name, + result: false, + }; + this.ros.callOnConnection(call); +>>>>>>> 9edabb3 (Add parameter ROS 2 example) }; module.exports = Action; diff --git a/build/roslib.min.js b/build/roslib.min.js index 961e09d1f..06aeb3d90 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1,5 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>2),r=0;r>6):(r<55296?n.push(224|r>>12):(r=65536+((r=(1023&r)<<10)|1023&t.charCodeAt(++s)),n.push(240|r>>18),n.push(128|r>>12&63)),n.push(128|r>>6&63)),n.push(128|63&r))}return m(3,n.length),p(n);default:if(Array.isArray(t))for(m(4,o=t.length),s=0;s>5!==e)throw"Invalid indefinite length element";return i}function L(e,t){for(var i=0;i>10),e.push(56320|1023&n))}}"function"!=typeof v&&(v=function(e){return e}),"function"!=typeof y&&(y=function(){return M});var e=function e(){var t,i,n=x(),s=n>>5,n=31&n;if(7==s)switch(n){case 25:var r=new ArrayBuffer(4),r=new DataView(r),o=T(),a=31744&o,c=1023&o;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=c)return c*U;return r.setUint32(0,(32768&o)<<16|a<<13|c<<13),r.getFloat32(0);case 26:return w(g.getFloat32(b),4);case 27:return w(g.getFloat64(b),8)}if((t=S(n))<0&&(s<2||6this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,c))):l._listeners=t,!0;return!0}.call(this,e,t,i):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),i?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=t,s},s.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var i=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;o=this._events[e],i.push({_listeners:o})}for(var s=0;st.secs)&&(e.secs>>>>>> 9edabb3 (Add parameter ROS 2 example) diff --git a/examples/ros2_simple.html b/examples/ros2_simple.html index b953f32e4..f02432999 100644 --- a/examples/ros2_simple.html +++ b/examples/ros2_simple.html @@ -125,6 +125,23 @@ response['message'] = 'Set successfully'; return true; }); + + // Getting a param value + // --------------------- + + // In ROS 2, params are set in the format 'node_name:param_name' + var favoriteColor = new ROSLIB.Param({ + ros : ros, + name : '/add_two_ints_server:use_sim_time' + }); + + favoriteColor.get(function(value) { + console.log('The value of use_sim_time before setting is ' + value); + }); + favoriteColor.set("true"); + favoriteColor.get(function(value) { + console.log('The value of use_sim_time after setting is ' + value); + }); From 6f1043beb056131a6ba32d9adced7afddaa5df75 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 15 Nov 2023 08:24:48 -0500 Subject: [PATCH 54/66] Use a bool instead of a string for true --- examples/ros2_simple.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ros2_simple.html b/examples/ros2_simple.html index f02432999..6ebfcb213 100644 --- a/examples/ros2_simple.html +++ b/examples/ros2_simple.html @@ -138,7 +138,7 @@ favoriteColor.get(function(value) { console.log('The value of use_sim_time before setting is ' + value); }); - favoriteColor.set("true"); + favoriteColor.set(true); favoriteColor.get(function(value) { console.log('The value of use_sim_time after setting is ' + value); }); From 6629f31334013ffa7c7d4f1ba05c2fe8d8514a73 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 28 Nov 2023 13:43:55 -0500 Subject: [PATCH 55/66] Update actions to use TypeScript --- build/core/Action.d.ts | 130 ++++++--- build/core/ActionFeedback.d.ts | 12 +- build/core/ActionGoal.d.ts | 8 +- build/core/ActionResult.d.ts | 8 +- build/roslib.js | 468 ++++++++++++++------------------- build/roslib.min.js | 6 +- src/core/Action.js | 351 +++++++++++++------------ src/core/ActionFeedback.js | 8 +- src/core/ActionGoal.js | 4 +- src/core/ActionResult.js | 4 +- 10 files changed, 498 insertions(+), 501 deletions(-) diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index 7bd4dfaeb..e2a26a6bf 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -1,61 +1,107 @@ export = Action; /** * A ROS 2 action client. - * - * @constructor - * @params options - possible keys include: - * * ros - the ROSLIB.Ros connection handle - * * name - the service name, like '/fibonacci' - * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' */ -declare function Action(options: any): void; -declare class Action { +declare class Action extends EventEmitter2 { /** - * A ROS 2 action client. - * - * @constructor - * @params options - possible keys include: - * * ros - the ROSLIB.Ros connection handle - * * name - the service name, like '/fibonacci' - * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' - */ - constructor(options: any); - ros: any; - name: any; - actionType: any; + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The action name, like '/fibonacci'. + * @param {string} options.actionType - The action type, like 'action_tutorials_interfaces/Fibonacci'. + */ + constructor(options: { + ros: Ros; + name: string; + actionType: string; + }); + ros: Ros; + name: string; + actionType: string; isAdvertised: boolean; - _actionCallback: any; + _actionCallback: ((request: ActionGoal, response: any) => any) | null; _cancelCallback: any; - __proto__: EventEmitter2; /** - * Calls the service. Returns the service response in the - * callback. Does nothing if this service is currently advertised. + * @callback sendGoalResultCallback + * @param {Object} result - The result from the action. + */ + /** + * @callback sendGoalFeedbackCallback + * @param {Object} feedback - The feedback from the action. + */ + /** + * @callback sendGoalFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Sends an action goal. Returns the feedback in the feedback callback while the action is running + * and the result in the result callback when the action is completed. + * Does nothing if this action is currently advertised. + * + * @param {ActionGoal} goal - The ROSLIB.ActionGoal to send. + * @param {sendGoalResultCallback} resultCallback - The callback function when the action is completed. + * @param {sendGoalFeedbackCallback} [feedbackCallback] - The callback function when the action pulishes feedback. + * @param {sendGoalFailedCallback} [failedCallback] - The callback function when the action failed. + */ + sendGoal(goal: ActionGoal, resultCallback: (result: any) => any, feedbackCallback?: ((feedback: any) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): string | undefined; + /** + * Cancels an action goal. * - * @param request - the ROSLIB.ServiceRequest to send - * @param resultCallback - function with params: - * * result - the result from the action - * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: - * * feedback - the feedback from the action - * @param failedCallback - the callback function when the action failed (optional). Params: - * * error - the error message reported by ROS + * @param {string} id - The ID of the action goal to cancel. + */ + cancelGoal(id: string): void; + /** + * @callback advertiseCallback + * @param {ActionGoal} request - The action goal. + * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the action has finished successfully, + * i.e., without any fatal errors. */ - sendGoal(request: any, resultCallback: any, feedbackCallback: any, failedCallback: any): string | undefined; - cancelGoal(id: any): void; /** * Advertise the action. This turns the Action object from a client * into a server. The callback will be called with every goal sent to this action. * - * @param callback - This works similarly to the callback for a C++ action and should take the following params: - * * goal - the action goal - * It should return true if the action has finished successfully, - * i.e. without any fatal errors. + * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. + */ + advertise(callback: (request: ActionGoal, response: any) => any): void; + /** + * Unadvertise a previously advertised action. */ - advertise(callback: any): void; unadvertise(): void; - _executeAction(rosbridgeRequest: any): void; - sendFeedback(id: any, feedback: any): void; - setSucceeded(id: any, result: any): void; - setFailed(id: any): void; + /** + * Helper function that executes an action by calling the provided + * action callback with the auto-generated ID as a user-accessible input. + * Should not be called manually. + * + * @param {Object} rosbridgeRequest - The ROSLIB.ActionGoal to send. + * @param {string} rosbridgeRequest.id - The ID of the action goal. + */ + _executeAction(rosbridgeRequest: { + id: string; + }): void; + /** + * Helper function to send action feedback inside an action handler. + * + * @param {string} id - The action goal ID. + * @param {ActionFeedback} feedback - The feedback to send. + */ + sendFeedback(id: string, feedback: ActionFeedback): void; + /** + * Helper function to set an action as succeeded. + * + * @param {string} id - The action goal ID. + * @param {ActionResult} result - The result to set. + */ + setSucceeded(id: string, result: ActionResult): void; + /** + * Helper function to set an action as failed. + * + * @param {string} id - The action goal ID. + */ + setFailed(id: string): void; } import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; +import Ros = require("../core/Ros"); +import ActionGoal = require("./ActionGoal"); +import ActionFeedback = require("./ActionFeedback"); +import ActionResult = require("./ActionResult"); diff --git a/build/core/ActionFeedback.d.ts b/build/core/ActionFeedback.d.ts index dc0701d20..f3db423c9 100644 --- a/build/core/ActionFeedback.d.ts +++ b/build/core/ActionFeedback.d.ts @@ -1,17 +1,17 @@ export = ActionFeedback; /** - * An ActionFeedback is periodically returned during an in-progress ROS 2 action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ -declare function ActionFeedback(values: any): void; +declare function ActionFeedback(values?: any): void; declare class ActionFeedback { /** - * An ActionFeedback is periodically returned during an in-progress ROS 2 action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values: any); + constructor(values?: any); } diff --git a/build/core/ActionGoal.d.ts b/build/core/ActionGoal.d.ts index c58866f4d..6d0992604 100644 --- a/build/core/ActionGoal.d.ts +++ b/build/core/ActionGoal.d.ts @@ -3,15 +3,15 @@ export = ActionGoal; * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ -declare function ActionGoal(values: any): void; +declare function ActionGoal(values?: any): void; declare class ActionGoal { /** * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values: any); + constructor(values?: any); } diff --git a/build/core/ActionResult.d.ts b/build/core/ActionResult.d.ts index 44ee2833f..d372a06ae 100644 --- a/build/core/ActionResult.d.ts +++ b/build/core/ActionResult.d.ts @@ -3,15 +3,15 @@ export = ActionResult; * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ -declare function ActionResult(values: any): void; +declare function ActionResult(values?: any): void; declare class ActionResult { /** * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values: any); + constructor(values?: any); } diff --git a/build/roslib.js b/build/roslib.js index fd26b85e4..57b5eb6b1 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20282,297 +20282,235 @@ exports.SimpleActionServer = require('./SimpleActionServer'); },{"./ActionClient":84,"./ActionListener":85,"./Goal":86,"./SimpleActionServer":87}],89:[function(require,module,exports){ "use strict"; /** - * @fileoverview + * @fileOverview * @author Sebastian Castro - sebastian.castro@picknik.ai */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ActionGoal = require('./ActionGoal'); var ActionFeedback = require('./ActionFeedback'); var ActionResult = require('./ActionResult'); var EventEmitter2 = require('eventemitter2').EventEmitter2; +var Ros = require('../core/Ros'); /** * A ROS 2 action client. - * - * @constructor - * @params options - possible keys include: - * * ros - the ROSLIB.Ros connection handle - * * name - the service name, like '/fibonacci' - * * actionType - the action type, like 'action_tutorials_interfaces/Fibonacci' - */ -function Action(options) { - options = options || {}; - this.ros = options.ros; - this.name = options.name; - this.actionType = options.actionType; - this.isAdvertised = false; - this._actionCallback = null; - this._cancelCallback = null; -} -Action.prototype.__proto__ = EventEmitter2.prototype; -/** - * Sends an action goal. Returns the feedback in the feedback callback while the action is running - * and the result in the result callback when the action is completed. - * Does nothing if this action is currently advertised. - * - * @param goal - the ROSLIB.ActionGoal to send - * @param resultCallback - the callback function when the action is completed with params: - * * result - the result from the action - * @param feedbackCallback - the callback function when the action publishes feedback (optional). Params: - * * feedback - the feedback from the action - * @param failedCallback - the callback function when the action failed (optional). Params: - * * error - the error message reported by ROS */ -<<<<<<< HEAD -Action.prototype.sendGoal = function (request, resultCallback, feedbackCallback, failedCallback) { - if (this.isAdvertised) { - return; +var Action = /** @class */ (function (_super) { + __extends(Action, _super); + /** + * @param {Object} options + * @param {Ros} options.ros - The ROSLIB.Ros connection handle. + * @param {string} options.name - The action name, like '/fibonacci'. + * @param {string} options.actionType - The action type, like 'action_tutorials_interfaces/Fibonacci'. + */ + function Action(options) { + var _this = _super.call(this) || this; + _this.ros = options.ros; + _this.name = options.name; + _this.actionType = options.actionType; + _this.isAdvertised = false; + _this._actionCallback = null; + _this._cancelCallback = null; + return _this; } - var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); - if (resultCallback || failedCallback) { - this.ros.on(actionGoalId, function (message) { - if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === 'function') { - failedCallback(message.values); + /** + * @callback sendGoalResultCallback + * @param {Object} result - The result from the action. + */ + /** + * @callback sendGoalFeedbackCallback + * @param {Object} feedback - The feedback from the action. + */ + /** + * @callback sendGoalFailedCallback + * @param {string} error - The error message reported by ROS. + */ + /** + * Sends an action goal. Returns the feedback in the feedback callback while the action is running + * and the result in the result callback when the action is completed. + * Does nothing if this action is currently advertised. + * + * @param {ActionGoal} goal - The ROSLIB.ActionGoal to send. + * @param {sendGoalResultCallback} resultCallback - The callback function when the action is completed. + * @param {sendGoalFeedbackCallback} [feedbackCallback] - The callback function when the action pulishes feedback. + * @param {sendGoalFailedCallback} [failedCallback] - The callback function when the action failed. + */ + Action.prototype.sendGoal = function (goal, resultCallback, feedbackCallback, failedCallback) { + if (this.isAdvertised) { + return; + } + var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); + if (resultCallback || failedCallback) { + this.ros.on(actionGoalId, function (message) { + if (message.result !== undefined && message.result === false) { + if (typeof failedCallback === 'function') { + failedCallback(message.values); + } } - } - else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { - feedbackCallback(new ActionResult(message.values)); - } - else if (message.op === 'action_result' && typeof resultCallback === 'function') { - resultCallback(new ActionResult(message.values)); - } + else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { + feedbackCallback(new ActionFeedback(message.values)); + } + else if (message.op === 'action_result' && typeof resultCallback === 'function') { + resultCallback(new ActionResult(message.values)); + } + }); + } + var call = { + op: 'send_action_goal', + id: actionGoalId, + action: this.name, + action_type: this.actionType, + args: goal, + feedback: true, + }; + this.ros.callOnConnection(call); + return actionGoalId; + }; + /** + * Cancels an action goal. + * + * @param {string} id - The ID of the action goal to cancel. + */ + Action.prototype.cancelGoal = function (id) { + var call = { + op: 'cancel_action_goal', + id: id, + action: this.name, + }; + this.ros.callOnConnection(call); + }; + /** + * @callback advertiseCallback + * @param {ActionGoal} request - The action goal. + * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. + * It should return true if the action has finished successfully, + * i.e., without any fatal errors. + */ + /** + * Advertise the action. This turns the Action object from a client + * into a server. The callback will be called with every goal sent to this action. + * + * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. + */ + Action.prototype.advertise = function (callback) { + if (this.isAdvertised || typeof callback !== 'function') { + return; + } + this._actionCallback = callback; + this.ros.on(this.name, this._executeAction.bind(this)); + this.ros.callOnConnection({ + op: 'advertise_action', + type: this.actionType, + action: this.name }); - } - var call = { - op: 'send_action_goal', - id: actionGoalId, - action: this.name, - action_type: this.actionType, - args: request, - feedback: true, + this.isAdvertised = true; }; - this.ros.callOnConnection(call); - return actionGoalId; -}; -Action.prototype.cancelGoal = function (id) { - var call = { - op: 'cancel_action_goal', - id: id, - action: this.name, + /** + * Unadvertise a previously advertised action. + */ + Action.prototype.unadvertise = function () { + if (!this.isAdvertised) { + return; + } + this.ros.callOnConnection({ + op: 'unadvertise_action', + action: this.name + }); + this.isAdvertised = false; }; - this.ros.callOnConnection(call); -======= -Action.prototype.sendGoal = function(goal, resultCallback, feedbackCallback, failedCallback) { - if (this.isAdvertised) { - return; - } - - var actionGoalId = 'send_action_goal:' + this.name + ':' + (++this.ros.idCounter); - - if (resultCallback || failedCallback) { - this.ros.on(actionGoalId, function(message) { - if (message.result !== undefined && message.result === false) { - if (typeof failedCallback === 'function') { - failedCallback(message.values); + /** + * Helper function that executes an action by calling the provided + * action callback with the auto-generated ID as a user-accessible input. + * Should not be called manually. + * + * @param {Object} rosbridgeRequest - The ROSLIB.ActionGoal to send. + * @param {string} rosbridgeRequest.id - The ID of the action goal. + */ + Action.prototype._executeAction = function (rosbridgeRequest) { + var id; + if (rosbridgeRequest.id) { + id = rosbridgeRequest.id; } - } else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { - feedbackCallback(new ActionFeedback(message.values)); - } else if (message.op === 'action_result' && typeof resultCallback === 'function') { - resultCallback(new ActionResult(message.values)); - } - }); - } - - var call = { - op : 'send_action_goal', - id : actionGoalId, - action : this.name, - action_type: this.actionType, - args : goal, - feedback : true, - }; - this.ros.callOnConnection(call); - - return actionGoalId; -}; - -/** - * Cancels an action goal. - * - * @param id - the ID of the action goal to cancel. - */ -Action.prototype.cancelGoal = function(id) { - var call = { - op: 'cancel_action_goal', - id: id, - action: this.name, - }; - this.ros.callOnConnection(call); ->>>>>>> 9edabb3 (Add parameter ROS 2 example) -}; -/** - * Advertise the action. This turns the Action object from a client - * into a server. The callback will be called with every goal sent to this action. - * - * @param callback - This works similarly to the callback for a C++ action and should take the following params: - * * goal - the action goal - * It should return true if the action has finished successfully, - * i.e. without any fatal errors. - */ -Action.prototype.advertise = function (callback) { - if (this.isAdvertised || typeof callback !== 'function') { - return; - } - this._actionCallback = callback; - this.ros.on(this.name, this._executeAction.bind(this)); - this.ros.callOnConnection({ - op: 'advertise_action', - type: this.actionType, - action: this.name - }); - this.isAdvertised = true; -}; -<<<<<<< HEAD -Action.prototype.unadvertise = function () { - if (!this.isAdvertised) { - return; - } - this.ros.callOnConnection({ - op: 'unadvertise_action', - action: this.name - }); - this.isAdvertised = false; -}; -Action.prototype._executeAction = function (rosbridgeRequest) { - var id; - if (rosbridgeRequest.id) { - id = rosbridgeRequest.id; - } - this._actionCallback(rosbridgeRequest.args, id); -}; -Action.prototype.sendFeedback = function (id, feedback) { - var call = { - op: 'action_feedback', - id: id, - action: this.name, - values: new ActionFeedback(feedback), + // @ts-expect-error -- possibly null + this._actionCallback(rosbridgeRequest.args, id); }; - this.ros.callOnConnection(call); -}; -Action.prototype.setSucceeded = function (id, result) { - var call = { - op: 'action_result', - id: id, - action: this.name, - values: new ActionResult(result), - result: true, + /** + * Helper function to send action feedback inside an action handler. + * + * @param {string} id - The action goal ID. + * @param {ActionFeedback} feedback - The feedback to send. + */ + Action.prototype.sendFeedback = function (id, feedback) { + var call = { + op: 'action_feedback', + id: id, + action: this.name, + values: new ActionFeedback(feedback), + }; + this.ros.callOnConnection(call); }; - this.ros.callOnConnection(call); -}; -Action.prototype.setFailed = function (id) { - var call = { - op: 'action_result', - id: id, - action: this.name, - result: false, + /** + * Helper function to set an action as succeeded. + * + * @param {string} id - The action goal ID. + * @param {ActionResult} result - The result to set. + */ + Action.prototype.setSucceeded = function (id, result) { + var call = { + op: 'action_result', + id: id, + action: this.name, + values: new ActionResult(result), + result: true, + }; + this.ros.callOnConnection(call); }; - this.ros.callOnConnection(call); -======= - -/** - * Unadvertise a previously advertised action. - */ -Action.prototype.unadvertise = function() { - if (!this.isAdvertised) { - return; - } - this.ros.callOnConnection({ - op: 'unadvertise_action', - action: this.name - }); - this.isAdvertised = false; -}; - -/** - * Helper function that executes an action by calling the provided - * action callback with the auto-generated ID as a user-accessible input. - * Should not be called manually. - * - * @param rosbridgeRequest - The ROSLIB.ActionGoal to send - */ -Action.prototype._executeAction = function(rosbridgeRequest) { - var id; - if (rosbridgeRequest.id) { - id = rosbridgeRequest.id; - } - - this._actionCallback(rosbridgeRequest.args, id); -}; - -/** - * Helper function to send action feedback inside an action handler. - * - * @param id - The action goal ID. - * @param feedback - The feedback to send. - */ -Action.prototype.sendFeedback = function(id, feedback) { - var call = { - op: 'action_feedback', - id: id, - action: this.name, - values: new ActionFeedback(feedback), - }; - this.ros.callOnConnection(call); -}; - -/** - * Helper function to set an action as succeeded. - * - * @param id - The action goal ID. - * @param result - The result to set. - */ -Action.prototype.setSucceeded = function(id, result) { - var call = { - op: 'action_result', - id: id, - action: this.name, - values: new ActionResult(result), - result: true, - }; - this.ros.callOnConnection(call); -}; - -/** - * Helper function to set an action as failed. - * - * @param id - The action goal ID. - */ -Action.prototype.setFailed = function(id) { - var call = { - op: 'action_result', - id: id, - action: this.name, - result: false, - }; - this.ros.callOnConnection(call); ->>>>>>> 9edabb3 (Add parameter ROS 2 example) -}; + /** + * Helper function to set an action as failed. + * + * @param {string} id - The action goal ID. + */ + Action.prototype.setFailed = function (id) { + var call = { + op: 'action_result', + id: id, + action: this.name, + result: false, + }; + this.ros.callOnConnection(call); + }; + return Action; +}(EventEmitter2)); module.exports = Action; -},{"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"eventemitter2":13}],90:[function(require,module,exports){ +},{"../core/Ros":95,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"eventemitter2":13}],90:[function(require,module,exports){ "use strict"; /** - * @fileoverview + * @fileOverview * @author Sebastian Castro - sebastian.castro@picknik.ai */ var assign = require('object-assign'); /** - * An ActionFeedback is periodically returned during an in-progress ROS 2 action + * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ function ActionFeedback(values) { - assign(this, values); + assign(this, values || {}); } module.exports = ActionFeedback; @@ -20587,10 +20525,10 @@ var assign = require('object-assign'); * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ function ActionGoal(values) { - assign(this, values); + assign(this, values || {}); } module.exports = ActionGoal; @@ -20605,10 +20543,10 @@ var assign = require('object-assign'); * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param values - object matching the fields defined in the .action definition file + * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. */ function ActionResult(values) { - assign(this, values); + assign(this, values || {}); } module.exports = ActionResult; diff --git a/build/roslib.min.js b/build/roslib.min.js index 06aeb3d90..e4c365fd9 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1,5 +1 @@ -<<<<<<< HEAD -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>2),r=0;r>6):(r<55296?n.push(224|r>>12):(r=65536+((r=(1023&r)<<10)|1023&t.charCodeAt(++s)),n.push(240|r>>18),n.push(128|r>>12&63)),n.push(128|r>>6&63)),n.push(128|63&r))}return m(3,n.length),p(n);default:if(Array.isArray(t))for(m(4,o=t.length),s=0;s>5!==e)throw"Invalid indefinite length element";return i}function L(e,t){for(var i=0;i>10),e.push(56320|1023&n))}}"function"!=typeof v&&(v=function(e){return e}),"function"!=typeof y&&(y=function(){return M});var e=function e(){var t,i,n=x(),s=n>>5,n=31&n;if(7==s)switch(n){case 25:var r=new ArrayBuffer(4),r=new DataView(r),o=T(),a=31744&o,c=1023&o;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=c)return c*U;return r.setUint32(0,(32768&o)<<16|a<<13|c<<13),r.getFloat32(0);case 26:return w(g.getFloat32(b),4);case 27:return w(g.getFloat64(b),8)}if((t=S(n))<0&&(s<2||6this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,c))):l._listeners=t,!0;return!0}.call(this,e,t,i):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),i?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=t,s},s.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var i=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;o=this._events[e],i.push({_listeners:o})}for(var s=0;st.secs)&&(e.secs>>>>>> 9edabb3 (Add parameter ROS 2 example) +!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Tue, 28 Nov 2023 14:04:30 -0500 Subject: [PATCH 56/66] Update actions to latest TypeScript capabilities --- build/core/Action.d.ts | 23 +- build/core/ActionFeedback.d.ts | 12 +- build/core/ActionGoal.d.ts | 12 +- build/core/ActionResult.d.ts | 12 +- build/core/Service.d.ts | 16 +- build/roslib.js | 12457 +++++++++++++++---------------- build/roslib.min.js | 2 +- src/core/Action.js | 13 +- src/core/ActionFeedback.js | 11 +- src/core/ActionGoal.js | 11 +- src/core/ActionResult.js | 11 +- src/core/Service.js | 8 +- 12 files changed, 6151 insertions(+), 6437 deletions(-) diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index e2a26a6bf..e4958c34c 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -1,8 +1,9 @@ export = Action; /** * A ROS 2 action client. + * @template TGoal, TFeedback, TResult */ -declare class Action extends EventEmitter2 { +declare class Action extends EventEmitter2 { /** * @param {Object} options * @param {Ros} options.ros - The ROSLIB.Ros connection handle. @@ -18,15 +19,15 @@ declare class Action extends EventEmitter2 { name: string; actionType: string; isAdvertised: boolean; - _actionCallback: ((request: ActionGoal, response: any) => any) | null; + _actionCallback: ((request: ActionGoal, response: any) => any) | null; _cancelCallback: any; /** * @callback sendGoalResultCallback - * @param {Object} result - The result from the action. + * @param {TResult} result - The result from the action. */ /** * @callback sendGoalFeedbackCallback - * @param {Object} feedback - The feedback from the action. + * @param {TFeedback} feedback - The feedback from the action. */ /** * @callback sendGoalFailedCallback @@ -37,12 +38,12 @@ declare class Action extends EventEmitter2 { * and the result in the result callback when the action is completed. * Does nothing if this action is currently advertised. * - * @param {ActionGoal} goal - The ROSLIB.ActionGoal to send. + * @param {TGoal} goal - The ROSLIB.ActionGoal to send. * @param {sendGoalResultCallback} resultCallback - The callback function when the action is completed. * @param {sendGoalFeedbackCallback} [feedbackCallback] - The callback function when the action pulishes feedback. * @param {sendGoalFailedCallback} [failedCallback] - The callback function when the action failed. */ - sendGoal(goal: ActionGoal, resultCallback: (result: any) => any, feedbackCallback?: ((feedback: any) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): string | undefined; + sendGoal(goal: TGoal, resultCallback: (result: TResult) => any, feedbackCallback?: ((feedback: TFeedback) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): string | undefined; /** * Cancels an action goal. * @@ -51,7 +52,7 @@ declare class Action extends EventEmitter2 { cancelGoal(id: string): void; /** * @callback advertiseCallback - * @param {ActionGoal} request - The action goal. + * @param {ActionGoal} request - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. @@ -62,7 +63,7 @@ declare class Action extends EventEmitter2 { * * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. */ - advertise(callback: (request: ActionGoal, response: any) => any): void; + advertise(callback: (request: ActionGoal, response: any) => any): void; /** * Unadvertise a previously advertised action. */ @@ -82,16 +83,16 @@ declare class Action extends EventEmitter2 { * Helper function to send action feedback inside an action handler. * * @param {string} id - The action goal ID. - * @param {ActionFeedback} feedback - The feedback to send. + * @param {ActionFeedback} feedback - The feedback to send. */ - sendFeedback(id: string, feedback: ActionFeedback): void; + sendFeedback(id: string, feedback: ActionFeedback): void; /** * Helper function to set an action as succeeded. * * @param {string} id - The action goal ID. * @param {ActionResult} result - The result to set. */ - setSucceeded(id: string, result: ActionResult): void; + setSucceeded(id: string, result: ActionResult): void; /** * Helper function to set an action as failed. * diff --git a/build/core/ActionFeedback.d.ts b/build/core/ActionFeedback.d.ts index f3db423c9..fdeef0d8a 100644 --- a/build/core/ActionFeedback.d.ts +++ b/build/core/ActionFeedback.d.ts @@ -3,15 +3,11 @@ export = ActionFeedback; * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -declare function ActionFeedback(values?: any): void; -declare class ActionFeedback { +declare class ActionFeedback { /** - * An ActionFeedback is periodically returned during an in-progress ROS 2 action. - * - * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values?: any); + constructor(values?: T | undefined); } diff --git a/build/core/ActionGoal.d.ts b/build/core/ActionGoal.d.ts index 6d0992604..fd0a79c62 100644 --- a/build/core/ActionGoal.d.ts +++ b/build/core/ActionGoal.d.ts @@ -3,15 +3,11 @@ export = ActionGoal; * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -declare function ActionGoal(values?: any): void; -declare class ActionGoal { +declare class ActionGoal { /** - * An ActionGoal is passed into a ROS 2 action goal request. - * - * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values?: any); + constructor(values?: T | undefined); } diff --git a/build/core/ActionResult.d.ts b/build/core/ActionResult.d.ts index d372a06ae..bf92e4e06 100644 --- a/build/core/ActionResult.d.ts +++ b/build/core/ActionResult.d.ts @@ -3,15 +3,11 @@ export = ActionResult; * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -declare function ActionResult(values?: any): void; -declare class ActionResult { +declare class ActionResult { /** - * An ActionResult is returned from sending a ROS 2 action goal. - * - * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. */ - constructor(values?: any); + constructor(values?: T | undefined); } diff --git a/build/core/Service.d.ts b/build/core/Service.d.ts index 5cbb3038a..26fcdc8e1 100644 --- a/build/core/Service.d.ts +++ b/build/core/Service.d.ts @@ -1,9 +1,9 @@ export = Service; /** * A ROS service client. - * @template T, U + * @template TRequest, TResponse */ -declare class Service extends EventEmitter2 { +declare class Service extends EventEmitter2 { /** * @param {Object} options * @param {Ros} options.ros - The ROSLIB.Ros connection handle. @@ -19,10 +19,10 @@ declare class Service extends EventEmitter2 { name: string; serviceType: string; isAdvertised: boolean; - _serviceCallback: ((request: ServiceRequest, response: any) => any) | null; + _serviceCallback: ((request: ServiceRequest, response: any) => any) | null; /** * @callback callServiceCallback - * @param {U} response - The response from the service request. + * @param {TResponse} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -32,14 +32,14 @@ declare class Service extends EventEmitter2 { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {T} request - The ROSLIB.ServiceRequest to send. + * @param {TRequest} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ - callService(request: T, callback?: ((response: U) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; + callService(request: TRequest, callback?: ((response: TResponse) => any) | undefined, failedCallback?: ((error: string) => any) | undefined): void; /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. @@ -51,7 +51,7 @@ declare class Service extends EventEmitter2 { * * @param {advertiseCallback} callback - This works similarly to the callback for a C++ service and should take the following params */ - advertise(callback: (request: ServiceRequest, response: any) => any): void; + advertise(callback: (request: ServiceRequest, response: any) => any): void; unadvertise(): void; _serviceResponse(rosbridgeRequest: any): void; } diff --git a/build/roslib.js b/build/roslib.js index 57b5eb6b1..57332b5fb 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -2,7 +2,7 @@ (function (global){(function (){ 'use strict'; -var objectAssign = require('object.assign/polyfill')(); +var objectAssign = require('object-assign'); // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: @@ -508,3143 +508,3768 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object.assign/polyfill":38,"util/":73}],2:[function(require,module,exports){ -(function (global){(function (){ -'use strict'; - -var possibleNames = [ - 'BigInt64Array', - 'BigUint64Array', - 'Float32Array', - 'Float64Array', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray' -]; - -var g = typeof globalThis === 'undefined' ? global : globalThis; - -module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - return out; -}; +},{"object-assign":31,"util/":4}],2:[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 + } +} -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],3:[function(require,module,exports){ -'use strict' +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],4:[function(require,module,exports){ +(function (process,global){(function (){ +// 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. -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } -function getLens (b64) { - var len = b64.length + if (process.noDeprecation === true) { + return fn; + } - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); } - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len + return deprecated; +}; - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - return [validLen, placeHoldersLen] -} +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); } +exports.inspect = inspect; -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; - var curByte = 0 +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; } +} - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - return arr +function stylizeNoColor(str, styleType) { + return str; } -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) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; } -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - 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))) +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; } - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; } - return parts.join('') -} + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); -},{}],4:[function(require,module,exports){ + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } -},{}],5:[function(require,module,exports){ -(function (process,Buffer){(function (){ -'use strict'; -/* eslint camelcase: "off" */ + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } -var assert = require('assert'); + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } -var Zstream = require('pako/lib/zlib/zstream'); -var zlib_deflate = require('pako/lib/zlib/deflate.js'); -var zlib_inflate = require('pako/lib/zlib/inflate.js'); -var constants = require('pako/lib/zlib/constants'); + var base = '', array = false, braces = ['{', '}']; -for (var key in constants) { - exports[key] = constants[key]; -} + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } -// zlib modes -exports.NONE = 0; -exports.DEFLATE = 1; -exports.INFLATE = 2; -exports.GZIP = 3; -exports.GUNZIP = 4; -exports.DEFLATERAW = 5; -exports.INFLATERAW = 6; -exports.UNZIP = 7; + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } -var GZIP_HEADER_ID1 = 0x1f; -var GZIP_HEADER_ID2 = 0x8b; + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } -/** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ -function Zlib(mode) { - if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { - throw new TypeError('Bad argument'); + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); } - this.dictionary = null; - this.err = 0; - this.flush = 0; - this.init_done = false; - this.level = 0; - this.memLevel = 0; - this.mode = mode; - this.strategy = 0; - this.windowBits = 0; - this.write_in_progress = false; - this.pending_close = false; - this.gzip_id_bytes_read = 0; -} + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } -Zlib.prototype.close = function () { - if (this.write_in_progress) { - this.pending_close = true; - return; + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; } - this.pending_close = false; + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } - assert(this.init_done, 'close before init'); - assert(this.mode <= exports.UNZIP); + ctx.seen.push(value); - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { - zlib_inflate.inflateEnd(this.strm); + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); } - this.mode = exports.NONE; - - this.dictionary = null; -}; + ctx.seen.pop(); -Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); -}; + return reduceToSingleString(output, base, braces); +} -Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); -}; -Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { - assert.equal(arguments.length, 8); - - assert(this.init_done, 'write before init'); - assert(this.mode !== exports.NONE, 'already finalized'); - assert.equal(false, this.write_in_progress, 'write already in progress'); - assert.equal(false, this.pending_close, 'close is pending'); +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} - this.write_in_progress = true; - assert.equal(false, flush === undefined, 'must provide flush value'); +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} - this.write_in_progress = true; - if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { - throw new Error('Invalid flush value'); +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} - if (input == null) { - input = Buffer.alloc(0); - in_len = 0; - in_off = 0; + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } } - this.strm.avail_in = in_len; - this.strm.input = input; - this.strm.next_in = in_off; - this.strm.avail_out = out_len; - this.strm.output = out; - this.strm.next_out = out_off; - this.flush = flush; + return name + ': ' + str; +} - if (!async) { - // sync version - this._process(); - if (this._checkError()) { - return this._afterSync(); - } - return; - } +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); - // async version - var self = this; - process.nextTick(function () { - self._process(); - self._after(); - }); + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } - return this; -}; + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} -Zlib.prototype._afterSync = function () { - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - this.write_in_progress = false; +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; - return [avail_in, avail_out]; -}; +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; -Zlib.prototype._process = function () { - var next_expected_header_byte = null; +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - // If the avail_out is left at 0, then it means that it ran out - // of room. If there was avail_out left over, then it means - // that all of the input was consumed. - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflate(this.strm, this.flush); - break; - case exports.UNZIP: - if (this.strm.avail_in > 0) { - next_expected_header_byte = this.strm.next_in; - } +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - switch (this.gzip_id_bytes_read) { - case 0: - if (next_expected_header_byte === null) { - break; - } +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { - this.gzip_id_bytes_read = 1; - next_expected_header_byte++; +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - if (this.strm.avail_in === 1) { - // The only available byte was already read. - break; - } - } else { - this.mode = exports.INFLATE; - break; - } +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - // fallthrough - case 1: - if (next_expected_header_byte === null) { - break; - } +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { - this.gzip_id_bytes_read = 2; - this.mode = exports.GUNZIP; - } else { - // There is no actual difference between INFLATE and INFLATERAW - // (after initialization). - this.mode = exports.INFLATE; - } +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; - break; - default: - throw new Error('invalid number of gzip magic number bytes read'); - } +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - // fallthrough - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - this.err = zlib_inflate.inflate(this.strm, this.flush +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; - // If data was encoded with dictionary - );if (this.err === exports.Z_NEED_DICT && this.dictionary) { - // Load it - this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); - if (this.err === exports.Z_OK) { - // And try to decode again - this.err = zlib_inflate.inflate(this.strm, this.flush); - } else if (this.err === exports.Z_DATA_ERROR) { - // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. - // Make it possible for After() to tell a bad dictionary from bad - // input. - this.err = exports.Z_NEED_DICT; - } - } - while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { - // Bytes remain in input buffer. Perhaps this is another compressed - // member in the same archive, or just trailing garbage. - // Trailing zero bytes are okay, though, since they are frequently - // used for padding. +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; - this.reset(); - this.err = zlib_inflate.inflate(this.strm, this.flush); - } - break; - default: - throw new Error('Unknown mode ' + this.mode); - } -}; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; -Zlib.prototype._checkError = function () { - // Acceptable error states depend on the type of zlib stream. - switch (this.err) { - case exports.Z_OK: - case exports.Z_BUF_ERROR: - if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { - this._error('unexpected end of file'); - return false; - } - break; - case exports.Z_STREAM_END: - // normal statuses, not fatal - break; - case exports.Z_NEED_DICT: - if (this.dictionary == null) { - this._error('Missing dictionary'); - } else { - this._error('Bad dictionary'); - } - return false; - default: - // something else. - this._error('Zlib error'); - return false; - } +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; - return true; -}; +exports.isBuffer = require('./support/isBuffer'); -Zlib.prototype._after = function () { - if (!this._checkError()) { - return; - } +function objectToString(o) { + return Object.prototype.toString.call(o); +} - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - this.write_in_progress = false; +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} - // call the write() cb - this.callback(avail_in, avail_out); - if (this.pending_close) { - this.close(); - } +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; -Zlib.prototype._error = function (message) { - if (this.strm.msg) { - message = this.strm.msg; - } - this.onerror(message, this.err - // no hope of rescue. - );this.write_in_progress = false; - if (this.pending_close) { - this.close(); +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; } + return origin; }; -Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { - assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} - assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); - assert(level >= -1 && level <= 9, 'invalid compression level'); +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":3,"_process":44,"inherits":2}],5:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; - assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); +var possibleNames = [ + 'BigInt64Array', + 'BigUint64Array', + 'Float32Array', + 'Float64Array', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray' +]; - assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); +var g = typeof globalThis === 'undefined' ? global : globalThis; - this._init(level, windowBits, memLevel, strategy, dictionary); - this._setDictionary(); +module.exports = function availableTypedArrays() { + var out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + out[out.length] = possibleNames[i]; + } + } + return out; }; -Zlib.prototype.params = function () { - throw new Error('deflateParams Not supported'); -}; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],6:[function(require,module,exports){ +'use strict' -Zlib.prototype.reset = function () { - this._reset(); - this._setDictionary(); -}; +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray -Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { - this.level = level; - this.windowBits = windowBits; - this.memLevel = memLevel; - this.strategy = strategy; +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - this.flush = exports.Z_NO_FLUSH; +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} - this.err = exports.Z_OK; +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { - this.windowBits += 16; - } +function getLens (b64) { + var len = b64.length - if (this.mode === exports.UNZIP) { - this.windowBits += 32; + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') } - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { - this.windowBits = -1 * this.windowBits; - } + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len - this.strm = new Zstream(); + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); - break; - default: - throw new Error('Unknown mode ' + this.mode); - } + return [validLen, placeHoldersLen] +} - if (this.err !== exports.Z_OK) { - this._error('Init error'); - } +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} - this.dictionary = dictionary; +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} - this.write_in_progress = false; - this.init_done = true; -}; +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] -Zlib.prototype._setDictionary = function () { - if (this.dictionary == null) { - return; + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF } - this.err = exports.Z_OK; + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); - break; - default: - break; + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF } - if (this.err !== exports.Z_OK) { - this._error('Failed to set dictionary'); + 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) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) } -}; + return output.join('') +} -Zlib.prototype._reset = function () { - this.err = exports.Z_OK; +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - case exports.GZIP: - this.err = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - case exports.GUNZIP: - this.err = zlib_inflate.inflateReset(this.strm); - break; - default: - break; + // 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))) } - if (this.err !== exports.Z_OK) { - this._error('Failed to reset stream'); + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) } -}; -exports.Zlib = Zlib; -}).call(this)}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":51,"assert":1,"buffer":8,"pako/lib/zlib/constants":41,"pako/lib/zlib/deflate.js":43,"pako/lib/zlib/inflate.js":45,"pako/lib/zlib/zstream":49}],6:[function(require,module,exports){ -(function (process){(function (){ + return parts.join('') +} + +},{}],7:[function(require,module,exports){ + +},{}],8:[function(require,module,exports){ +(function (process,Buffer){(function (){ 'use strict'; +/* eslint camelcase: "off" */ -var Buffer = require('buffer').Buffer; -var Transform = require('stream').Transform; -var binding = require('./binding'); -var util = require('util'); -var assert = require('assert').ok; -var kMaxLength = require('buffer').kMaxLength; -var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; +var assert = require('assert'); -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; +var Zstream = require('pako/lib/zlib/zstream'); +var zlib_deflate = require('pako/lib/zlib/deflate.js'); +var zlib_inflate = require('pako/lib/zlib/inflate.js'); +var constants = require('pako/lib/zlib/constants'); -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = 16 * 1024; +for (var key in constants) { + exports[key] = constants[key]; +} -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; -// expose all the zlib constants -var bkeys = Object.keys(binding); -for (var bk = 0; bk < bkeys.length; bk++) { - var bkey = bkeys[bk]; - if (bkey.match(/^Z/)) { - Object.defineProperty(exports, bkey, { - enumerable: true, value: binding[bkey], writable: false - }); +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); } -} - -// translation table for return codes. -var codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR -}; -var ckeys = Object.keys(codes); -for (var ck = 0; ck < ckeys.length; ck++) { - var ckey = ckeys[ck]; - codes[codes[ckey]] = ckey; + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; } -Object.defineProperty(exports, 'codes', { - enumerable: true, value: Object.freeze(codes), writable: false -}); +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; + } -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; + this.pending_close = false; -exports.createDeflate = function (o) { - return new Deflate(o); -}; + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); -exports.createInflate = function (o) { - return new Inflate(o); -}; + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); + } -exports.createDeflateRaw = function (o) { - return new DeflateRaw(o); + this.mode = exports.NONE; + + this.dictionary = null; }; -exports.createInflateRaw = function (o) { - return new InflateRaw(o); +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); }; -exports.createGzip = function (o) { - return new Gzip(o); +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); }; -exports.createGunzip = function (o) { - return new Gunzip(o); -}; - -exports.createUnzip = function (o) { - return new Unzip(o); -}; +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); -}; + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); -exports.deflateSync = function (buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); -}; + this.write_in_progress = true; -exports.gzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); -}; + assert.equal(false, flush === undefined, 'must provide flush value'); -exports.gzipSync = function (buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); -}; + this.write_in_progress = true; -exports.deflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); -}; - -exports.deflateRawSync = function (buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); -}; -exports.unzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; } - return zlibBuffer(new Unzip(opts), buffer, callback); -}; - -exports.unzipSync = function (buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); -}; -exports.inflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Inflate(opts), buffer, callback); -}; + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; -exports.inflateSync = function (buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -}; + if (!async) { + // sync version + this._process(); -exports.gunzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; + if (this._checkError()) { + return this._afterSync(); + } + return; } - return zlibBuffer(new Gunzip(opts), buffer, callback); -}; - -exports.gunzipSync = function (buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); -}; -exports.inflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); -}; + // async version + var self = this; + process.nextTick(function () { + self._process(); + self._after(); + }); -exports.inflateRawSync = function (buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); + return this; }; -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; - engine.end(buffer); - flow(); + this.write_in_progress = false; - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; - } - engine.once('readable', flow); - } + return [avail_in, avail_out]; +}; - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } +Zlib.prototype._process = function () { + var next_expected_header_byte = null; - function onEnd() { - var buf; - var err = null; + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } - if (nread >= kMaxLength) { - err = new RangeError(kRangeErrorMessage); - } else { - buf = Buffer.concat(buffers, nread); - } + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } - buffers = []; - engine.close(); - callback(err, buf); - } -} + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') buffer = Buffer.from(buffer); + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } - if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } - var flushFlag = engine._finishFlushFlag; + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } - return engine._processChunk(buffer, flushFlag); -} + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); -} + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; -function Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); -} - -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} - -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} - -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); -} +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } -function isValidFlushFlag(flag) { - return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; -} + return true; +}; -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } -function Zlib(opts, mode) { - var _this = this; + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; + this.write_in_progress = false; - Transform.call(this, opts); + // call the write() cb + this.callback(avail_in, avail_out); - if (opts.flush && !isValidFlushFlag(opts.flush)) { - throw new Error('Invalid flush flag: ' + opts.flush); - } - if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { - throw new Error('Invalid flush flag: ' + opts.finishFlush); + if (this.pending_close) { + this.close(); } +}; - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; - - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; } + this.onerror(message, this.err - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); } +}; - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } - } +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } - } + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } - } + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); - this._handle = new binding.Zlib(mode); + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); +}; - var self = this; - this._hadError = false; - this._handle.onerror = function (message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - _close(self); - self._hadError = true; +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; + this.flush = exports.Z_NO_FLUSH; - this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + this.err = exports.Z_OK; - this._buffer = Buffer.allocUnsafe(this._chunkSize); - this._offset = 0; - this._level = level; - this._strategy = strategy; + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } - this.once('end', this.close); + if (this.mode === exports.UNZIP) { + this.windowBits += 32; + } - Object.defineProperty(this, '_closed', { - get: function () { - return !_this._handle; - }, - configurable: true, - enumerable: true - }); -} + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } -util.inherits(Zlib, Transform); + this.strm = new Zstream(); -Zlib.prototype.params = function (level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); - } - if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); } - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function () { - assert(self._handle, 'zlib binding closed'); - self._handle.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); - } else { - process.nextTick(callback); + if (this.err !== exports.Z_OK) { + this._error('Init error'); } -}; -Zlib.prototype.reset = function () { - assert(this._handle, 'zlib binding closed'); - return this._handle.reset(); -}; + this.dictionary = dictionary; -// This is the _flush function called by the transform class, -// internally, when the last chunk has been written. -Zlib.prototype._flush = function (callback) { - this._transform(Buffer.alloc(0), '', callback); + this.write_in_progress = false; + this.init_done = true; }; -Zlib.prototype.flush = function (kind, callback) { - var _this2 = this; +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; + } - var ws = this._writableState; + this.err = exports.Z_OK; - if (typeof kind === 'function' || kind === undefined && !callback) { - callback = kind; - kind = binding.Z_FULL_FLUSH; + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; } - if (ws.ended) { - if (callback) process.nextTick(callback); - } else if (ws.ending) { - if (callback) this.once('end', callback); - } else if (ws.needDrain) { - if (callback) { - this.once('drain', function () { - return _this2.flush(kind, callback); - }); - } - } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); } }; -Zlib.prototype.close = function (callback) { - _close(this, callback); - process.nextTick(emitCloseNT, this); -}; +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; -function _close(engine, callback) { - if (callback) process.nextTick(callback); + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; + } - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) return; + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); + } +}; - engine._handle.close(); - engine._handle = null; -} +exports.Zlib = Zlib; +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":44,"assert":1,"buffer":11,"pako/lib/zlib/constants":34,"pako/lib/zlib/deflate.js":36,"pako/lib/zlib/inflate.js":38,"pako/lib/zlib/zstream":42}],9:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; -function emitCloseNT(self) { - self.emit('close'); -} +var Buffer = require('buffer').Buffer; +var Transform = require('stream').Transform; +var binding = require('./binding'); +var util = require('util'); +var assert = require('assert').ok; +var kMaxLength = require('buffer').kMaxLength; +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; -Zlib.prototype._transform = function (chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; - if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; - if (!this._handle) return cb(new Error('zlib binding closed')); +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) flushFlag = this._finishFlushFlag;else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); } +} - this._processChunk(chunk, flushFlag, cb); +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR }; -Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} - var self = this; +Object.defineProperty(exports, 'codes', { + enumerable: true, value: Object.freeze(codes), writable: false +}); - var async = typeof cb === 'function'; +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; - if (!async) { - var buffers = []; - var nread = 0; +exports.createDeflate = function (o) { + return new Deflate(o); +}; - var error; - this.on('error', function (er) { - error = er; - }); +exports.createInflate = function (o) { + return new Inflate(o); +}; - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); +}; - if (this._hadError) { - throw error; - } +exports.createInflateRaw = function (o) { + return new InflateRaw(o); +}; - if (nread >= kMaxLength) { - _close(this); - throw new RangeError(kRangeErrorMessage); - } +exports.createGzip = function (o) { + return new Gzip(o); +}; - var buf = Buffer.concat(buffers, nread); - _close(this); +exports.createGunzip = function (o) { + return new Gunzip(o); +}; - return buf; - } +exports.createUnzip = function (o) { + return new Unzip(o); +}; - assert(this._handle, 'zlib binding closed'); - var req = this._handle.write(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; - req.buffer = chunk; - req.callback = callback; +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; - function callback(availInAfter, availOutAfter) { - // When the callback is used in an async write, the callback's - // context is the `req` object that was created. The req object - // is === this._handle, and that's why it's important to null - // out the values after they are done being used. `this._handle` - // can stay in memory longer than the callback and buffer are needed. - if (this) { - this.buffer = null; - this.callback = null; - } +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; - if (self._hadError) return; +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += availInBefore - availInAfter; - availInBefore = availInAfter; - - if (!async) return true; +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); +}; - var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; - if (!async) return false; +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; - // finished with the chunk. - cb(); +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; } + return zlibBuffer(new Gunzip(opts), buffer, callback); }; -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); -}).call(this)}).call(this,require('_process')) -},{"./binding":5,"_process":51,"assert":1,"buffer":8,"stream":68,"util":76}],7:[function(require,module,exports){ -arguments[4][4][0].apply(exports,arguments) -},{"dup":4}],8:[function(require,module,exports){ -(function (Buffer){(function (){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; -var base64 = require('base64-js') -var ieee754 = require('ieee754') +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; -/** - * 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() + engine.on('error', onError); + engine.on('end', onEnd); -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.' - ) -} + engine.end(buffer); + flow(); -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 flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); } -}) -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) + function onEnd() { + var buf; + var err = null; -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } + + buffers = []; + engine.close(); + callback(err, buf); } - // 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 zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) + var flushFlag = engine._finishFlushFlag; + + return engine._processChunk(buffer, flushFlag); } -Buffer.poolSize = 8192 // not used by this implementation +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} - var b = fromObject(value) - if (b) return b +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} +function Zlib(opts, mode) { + var _this = this; -/** - * 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) -} + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; -// 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 + Transform.call(this, opts); -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); } - 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) + + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } } - return createBuffer(size) -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } + } -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } + } -/** - * 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) -} + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } } - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } } - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) + this._handle = new binding.Zlib(mode); - var actual = buf.write(string, encoding) + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; - 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) - } + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; - return buf -} + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; -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 + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; + + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); } -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } +util.inherits(Zlib, Transform); - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); } - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); } else { - buf = new Uint8Array(array, byteOffset, length) + process.nextTick(callback); } +}; - // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf -} +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; - if (buf.length === 0) { - return buf - } +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; - obj.copy(buf, 0, 0, len) - return buf + var ws = this._writableState; + + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) + if (ws.ended) { + if (callback) process.nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); } - return fromArrayLike(obj) + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); } +}; - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} +Zlib.prototype.close = function (callback) { + _close(this, callback); + process.nextTick(emitCloseNT, this); +}; -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 _close(engine, callback) { + if (callback) process.nextTick(callback); -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; + + engine._handle.close(); + engine._handle = null; } -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +function emitCloseNT(self) { + self.emit('close'); } -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); - if (a === b) return 0 + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); - var x = a.length - var y = b.length + if (!this._handle) return cb(new Error('zlib binding closed')); - 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 it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; } } - 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 - } -} + this._processChunk(chunk, flushFlag, cb); +}; -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; - if (list.length === 0) { - return Buffer.alloc(0) - } + var self = this; - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } + var async = typeof cb === 'function'; - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} + if (!async) { + var buffers = []; + var nread = 0; -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } + var error; + this.on('error', function (er) { + error = er; + }); - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); - // 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': - 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 mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true + if (this._hadError) { + throw error; } - } -} -Buffer.byteLength = byteLength -function slowToString (encoding, start, end) { - var loweredCase = false + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. + var buf = Buffer.concat(buffers, nread); + _close(this); - // 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 '' + return buf; } - if (end === undefined || end > this.length) { - end = this.length - } + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len - if (end <= 0) { - return '' - } + req.buffer = chunk; + req.callback = callback; - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } - if (end <= start) { - return '' - } + if (self._hadError) return; - if (!encoding) encoding = 'utf8' + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } - case 'ascii': - return asciiSlice(this, start, end) + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) + if (!async) return true; - case 'base64': - return base64Slice(this, start, end) + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; + } - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) + if (!async) return false; - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } + // finished with the chunk. + cb(); } -} +}; -// 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 +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); +}).call(this)}).call(this,require('_process')) +},{"./binding":8,"_process":44,"assert":1,"buffer":11,"stream":46,"util":66}],10:[function(require,module,exports){ +arguments[4][7][0].apply(exports,arguments) +},{"dup":7}],11:[function(require,module,exports){ +(function (Buffer){(function (){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} +'use strict' -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 +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.' + ) } -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) +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 } - 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') +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer } - 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) +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset } - 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) +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + buf.__proto__ = Buffer.prototype + return buf } -Buffer.prototype.toLocaleString = Buffer.prototype.toString +/** + * 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. + */ -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 +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) } -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' +// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 +if (typeof Symbol !== 'undefined' && Symbol.species != null && + Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }) } -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } +Buffer.poolSize = 8192 // not used by this implementation - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) } - if (thisStart >= thisEnd && start >= end) { - return 0 + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) } - if (thisStart >= thisEnd) { - return -1 + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) } - if (start >= end) { - return 1 + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) } - 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 valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) + var b = fromObject(value) + if (b) return b - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) } - if (x < y) return -1 - if (y < x) return 1 - return 0 + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) } -// 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 +/** + * 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) +} - // 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) - } +// 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 - // 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 +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') } +} - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) } - - // 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) + 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) +} - throw new TypeError('val must be string, number or Buffer') +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) } -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} - 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 - } +/** + * 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' } - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) } - 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 - } + 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 -1 + return buf } -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 +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 } -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) } else { - length = Number(length) - if (length > remaining) { - length = remaining - } + buf = new Uint8Array(array, byteOffset, length) } - var strLen = string.length + // Return an augmented `Uint8Array` instance + buf.__proto__ = Buffer.prototype + return buf +} - 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 +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.length !== undefined) { + 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) } - return i } -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +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 asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) } -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false } -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + 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 } -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +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.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 +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 } - } 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 + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) + } + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) } - if (!encoding) encoding = 'utf8' + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && 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': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 case 'hex': - return hexWrite(this, string, offset, length) + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : 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 utf8Write(this, string, offset, length) + return utf8Slice(this, start, end) case 'ascii': - return asciiWrite(this, string, offset, length) + return asciiSlice(this, start, end) case 'latin1': case 'binary': - return latin1Write(this, string, offset, length) + return latin1Slice(this, start, end) case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) + return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': - return ucs2Write(this, string, offset, length) + return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() + 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 - } - } - } - } +// 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 - 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 - } +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} - res.push(codePoint) - i += bytesPerSequence +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') } - - return decodeCodePointsArray(res) + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this } -// 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() +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') } - - // 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) - ) + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) } - return res + return this } -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) +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') } - return ret + 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 } -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 +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) } -function hexSlice (buf, start, end) { - var len = buf.length +Buffer.prototype.toLocaleString = Buffer.prototype.toString - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len +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 +} - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' } -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)) +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) } - return res -} -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end + 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) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') } - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 } - if (end < start) end = start + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype - return newBuf -} + if (this === target) return 0 -/* - * 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') -} + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } } - return val + if (x < y) return -1 + if (y < x) return 1 + return 0 } -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) +// 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) } - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul + // 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 } - return val -} + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} + // 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) + } -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) + throw new TypeError('val must be string, number or Buffer') } -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.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 + } + } - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + 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 (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) + return -1 } -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) +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} - return val +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul +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 + } } - mul *= 0x80 - if (val >= mul) val -= Math.pow(2, 8 * byteLength) + var strLen = string.length - return val + 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 } -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) +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } -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 +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) } -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 +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) } -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) +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) } -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]) +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } -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.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' + ) + } -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) -} + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining -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) -} + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } -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') -} + if (!encoding) encoding = 'utf8' -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 loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) - return offset + byteLength -} + case 'ascii': + return asciiWrite(this, string, offset, length) -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) - } + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) - return offset + byteLength -} + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) -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 + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } } -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.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } } -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 +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } } -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 -} +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] -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 -} + 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 -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } + 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 + } + } + } + } - 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 + 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 } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + + res.push(codePoint) + i += bytesPerSequence } - return offset + byteLength + return decodeCodePointsArray(res) } -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) - } +// 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 - 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 +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } - return offset + byteLength + // 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 } -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 -} +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) -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 + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret } -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 -} +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) -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 + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret } -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 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 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 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 } -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) +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 } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 + + 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 } -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) +/* + * 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.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) +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 } -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 + byteLength = byteLength >>> 0 if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + checkOffset(offset, byteLength, this.length) } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val } -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] } -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) } -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - 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 +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - var len = end - start + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) +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 - return len -} + if (val >= mul) val -= Math.pow(2, 8 * byteLength) -// 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 (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) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } + return val +} - // 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') - } +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) - if (end <= start) { - return this + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul } + mul *= 0x80 - 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 - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } + if (val >= mul) val -= Math.pow(2, 8 * byteLength) - return this + return val } -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // 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 +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) } -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) +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 } -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) +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 +} - // 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 - } +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - // valid lead - leadSurrogate = codePoint + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} - continue - } +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} - // 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) - } +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) +} - leadSurrogate = null +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) +} - // 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') - } - } +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) +} - return bytes +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 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 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') } -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break +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) + } - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF } - return byteArray + return offset + byteLength } -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} +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) + } -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] + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF } - return i + + return offset + byteLength } -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) +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 } -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare + +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 } -}).call(this)}).call(this,require("buffer").Buffer) -},{"base64-js":3,"buffer":8,"ieee754":26}],9:[function(require,module,exports){ -'use strict'; +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 +} -var GetIntrinsic = require('get-intrinsic'); +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 +} -var callBind = require('./'); +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 +} -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } -},{"./":10,"get-intrinsic":18}],10:[function(require,module,exports){ -'use strict'; + 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 + } -var bind = require('function-bind'); -var GetIntrinsic = require('get-intrinsic'); -var setFunctionLength = require('set-function-length'); + return offset + byteLength +} -var $TypeError = GetIntrinsic('%TypeError%'); -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } + 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 } -module.exports = function callBind(originalFunction) { - if (typeof originalFunction !== 'function') { - throw new $TypeError('a function is required'); - } - var func = $reflectApply(bind, $call, arguments); - return setFunctionLength( - func, - 1 + $max(0, originalFunction.length - (arguments.length - 1)), - true - ); -}; +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 +} -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; +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 +} -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; +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 } -},{"function-bind":17,"get-intrinsic":18,"set-function-length":67}],11:[function(require,module,exports){ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014 Patrick Gansterer - * - * 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(global, undefined) { "use strict"; -var POW_2_24 = Math.pow(2, -24), - POW_2_32 = Math.pow(2, 32), - POW_2_53 = Math.pow(2, 53); - -function encode(value) { - var data = new ArrayBuffer(256); - var dataView = new DataView(data); - var lastLength; - var offset = 0; - - function ensureSpace(length) { - var newByteLength = data.byteLength; - var requiredLength = offset + length; - while (newByteLength < requiredLength) - newByteLength *= 2; - if (newByteLength !== data.byteLength) { - var oldDataView = dataView; - data = new ArrayBuffer(newByteLength); - dataView = new DataView(data); - var uint32count = (offset + 3) >> 2; - for (var i = 0; i < uint32count; ++i) - dataView.setUint32(i * 4, oldDataView.getUint32(i * 4)); - } - - lastLength = length; - return dataView; - } - function write() { - offset += lastLength; - } - function writeFloat64(value) { - write(ensureSpace(8).setFloat64(offset, value)); - } - function writeUint8(value) { - write(ensureSpace(1).setUint8(offset, value)); - } - function writeUint8Array(value) { - var dataView = ensureSpace(value.length); - for (var i = 0; i < value.length; ++i) - dataView.setUint8(offset + i, value[i]); - write(); - } - function writeUint16(value) { - write(ensureSpace(2).setUint16(offset, value)); - } - function writeUint32(value) { - write(ensureSpace(4).setUint32(offset, value)); - } - function writeUint64(value) { - var low = value % POW_2_32; - var high = (value - low) / POW_2_32; - var dataView = ensureSpace(8); - dataView.setUint32(offset, high); - dataView.setUint32(offset + 4, low); - write(); - } +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 (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + 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('Index out of range') + 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 + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + 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 (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) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } 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 + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + 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 takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // 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 +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":6,"buffer":11,"ieee754":26}],12:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; + +},{"./":13,"get-intrinsic":21}],13:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); + +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); + +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } +} + +module.exports = function callBind(originalFunction) { + var func = $reflectApply(bind, $call, arguments); + if ($gOPD && $defineProperty) { + var desc = $gOPD(func, 'length'); + if (desc.configurable) { + // original length, plus the receiver, minus any additional arguments (after the receiver) + $defineProperty( + func, + 'length', + { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } + ); + } + } + return func; +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + +},{"function-bind":20,"get-intrinsic":21}],14:[function(require,module,exports){ +/* + * The MIT License (MIT) + * + * Copyright (c) 2014 Patrick Gansterer + * + * 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(global, undefined) { "use strict"; +var POW_2_24 = Math.pow(2, -24), + POW_2_32 = Math.pow(2, 32), + POW_2_53 = Math.pow(2, 53); + +function encode(value) { + var data = new ArrayBuffer(256); + var dataView = new DataView(data); + var lastLength; + var offset = 0; + + function ensureSpace(length) { + var newByteLength = data.byteLength; + var requiredLength = offset + length; + while (newByteLength < requiredLength) + newByteLength *= 2; + if (newByteLength !== data.byteLength) { + var oldDataView = dataView; + data = new ArrayBuffer(newByteLength); + dataView = new DataView(data); + var uint32count = (offset + 3) >> 2; + for (var i = 0; i < uint32count; ++i) + dataView.setUint32(i * 4, oldDataView.getUint32(i * 4)); + } + + lastLength = length; + return dataView; + } + function write() { + offset += lastLength; + } + function writeFloat64(value) { + write(ensureSpace(8).setFloat64(offset, value)); + } + function writeUint8(value) { + write(ensureSpace(1).setUint8(offset, value)); + } + function writeUint8Array(value) { + var dataView = ensureSpace(value.length); + for (var i = 0; i < value.length; ++i) + dataView.setUint8(offset + i, value[i]); + write(); + } + function writeUint16(value) { + write(ensureSpace(2).setUint16(offset, value)); + } + function writeUint32(value) { + write(ensureSpace(4).setUint32(offset, value)); + } + function writeUint64(value) { + var low = value % POW_2_32; + var high = (value - low) / POW_2_32; + var dataView = ensureSpace(8); + dataView.setUint32(offset, high); + dataView.setUint32(offset + 4, low); + write(); + } function writeTypeAndLength(type, length) { if (length < 24) { writeUint8(type << 5 | length); @@ -3971,77 +4596,24 @@ else if (!global.CBOR) })(this); -},{}],12:[function(require,module,exports){ +},{}],15:[function(require,module,exports){ 'use strict'; -var hasPropertyDescriptors = require('has-property-descriptors')(); - var GetIntrinsic = require('get-intrinsic'); -var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true); -if ($defineProperty) { +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +if ($gOPD) { try { - $defineProperty({}, 'a', { value: 1 }); + $gOPD([], 'length'); } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = false; + // IE 8 has a broken gOPD + $gOPD = null; } } -var $SyntaxError = GetIntrinsic('%SyntaxError%'); -var $TypeError = GetIntrinsic('%TypeError%'); - -var gopd = require('gopd'); - -/** @type {(obj: Record, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */ -module.exports = function defineDataProperty( - obj, - property, - value -) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new $TypeError('`obj` must be an object or a function`'); - } - if (typeof property !== 'string' && typeof property !== 'symbol') { - throw new $TypeError('`property` must be a string or a symbol`'); - } - if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { - throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); - } - if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { - throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); - } - if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { - throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); - } - if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { - throw new $TypeError('`loose`, if provided, must be a boolean'); - } - - var nonEnumerable = arguments.length > 3 ? arguments[3] : null; - var nonWritable = arguments.length > 4 ? arguments[4] : null; - var nonConfigurable = arguments.length > 5 ? arguments[5] : null; - var loose = arguments.length > 6 ? arguments[6] : false; - - /* @type {false | TypedPropertyDescriptor} */ - var desc = !!gopd && gopd(obj, property); - - if ($defineProperty) { - $defineProperty(obj, property, { - configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, - enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, - value: value, - writable: nonWritable === null && desc ? desc.writable : !nonWritable - }); - } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { - // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable - obj[property] = value; // eslint-disable-line no-param-reassign - } else { - throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); - } -}; +module.exports = $gOPD; -},{"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],13:[function(require,module,exports){ +},{"get-intrinsic":21}],16:[function(require,module,exports){ (function (process,setImmediate){(function (){ /*! * EventEmitter2 @@ -4144,7 +4716,7 @@ module.exports = function defineDataProperty( var obj = {}; var key; var len = keys.length; - var valuesCount = values ? values.length : 0; + var valuesCount = values ? value.length : 0; for (var i = 0; i < len; i++) { key = keys[i]; obj[key] = i < valuesCount ? values[i] : undefined; @@ -5674,7 +6246,7 @@ module.exports = function defineDataProperty( }(); }).call(this)}).call(this,require('_process'),require("timers").setImmediate) -},{"_process":51,"timers":70}],14:[function(require,module,exports){ +},{"_process":44,"timers":62}],17:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6171,73 +6743,33 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { } else { throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); } -} - -},{}],15:[function(require,module,exports){ -'use strict'; - -var isCallable = require('is-callable'); - -var toStr = Object.prototype.toString; -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var forEachArray = function forEachArray(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } -}; - -var forEachString = function forEachString(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - // no such thing as a sparse string. - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } -}; +} -var forEachObject = function forEachObject(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } -}; +},{}],18:[function(require,module,exports){ -var forEach = function forEach(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError('iterator must be a function'); - } +var hasOwn = Object.prototype.hasOwnProperty; +var toString = Object.prototype.toString; - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; +module.exports = function forEach (obj, fn, ctx) { + if (toString.call(fn) !== '[object Function]') { + throw new TypeError('iterator must be a function'); } - - if (toStr.call(list) === '[object Array]') { - forEachArray(list, iterator, receiver); - } else if (typeof list === 'string') { - forEachString(list, iterator, receiver); + var l = obj.length; + if (l === +l) { + for (var i = 0; i < l; i++) { + fn.call(ctx, obj[i], i, obj); + } } else { - forEachObject(list, iterator, receiver); + for (var k in obj) { + if (hasOwn.call(obj, k)) { + fn.call(ctx, obj[k], k, obj); + } + } } }; -module.exports = forEach; -},{"is-callable":30}],16:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ 'use strict'; /* eslint no-invalid-this: 1 */ @@ -6323,14 +6855,14 @@ module.exports = function bind(that) { return bound; }; -},{}],17:[function(require,module,exports){ +},{}],20:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); module.exports = Function.prototype.bind || implementation; -},{"./implementation":16}],18:[function(require,module,exports){ +},{"./implementation":19}],21:[function(require,module,exports){ 'use strict'; var undefined; @@ -6376,23 +6908,18 @@ var ThrowTypeError = $gOPD : throwTypeError; var hasSymbols = require('has-symbols')(); -var hasProto = require('has-proto')(); -var getProto = Object.getPrototypeOf || ( - hasProto - ? function (x) { return x.__proto__; } // eslint-disable-line no-proto - : null -); +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto var needsEval = {}; -var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); var INTRINSICS = { '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, '%AsyncFromSyncIteratorPrototype%': undefined, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, @@ -6400,8 +6927,6 @@ var INTRINSICS = { '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, - '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, '%Date%': Date, @@ -6422,10 +6947,10 @@ var INTRINSICS = { '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, '%JSON%': typeof JSON === 'object' ? JSON : undefined, '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': Object, @@ -6438,10 +6963,10 @@ var INTRINSICS = { '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '%String%': String, - '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, '%Symbol%': hasSymbols ? Symbol : undefined, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, @@ -6457,16 +6982,6 @@ var INTRINSICS = { '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet }; -if (getProto) { - try { - null.error; // eslint-disable-line no-unused-expressions - } catch (e) { - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 - var errorProto = getProto(getProto(e)); - INTRINSICS['%Error.prototype%'] = errorProto; - } -} - var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { @@ -6482,7 +6997,7 @@ var doEval = function doEval(name) { } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); - if (gen && getProto) { + if (gen) { value = getProto(gen.prototype); } } @@ -6547,12 +7062,11 @@ var LEGACY_ALIASES = { }; var bind = require('function-bind'); -var hasOwn = require('hasown'); +var hasOwn = require('has'); var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); var $strSlice = bind.call(Function.call, String.prototype.slice); -var $exec = bind.call(Function.call, RegExp.prototype.exec); /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; @@ -6608,9 +7122,6 @@ module.exports = function GetIntrinsic(name, allowMissing) { throw new $TypeError('"allowMissing" argument must be a boolean'); } - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); - } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; @@ -6683,73 +7194,7 @@ module.exports = function GetIntrinsic(name, allowMissing) { return value; }; -},{"function-bind":17,"has-proto":21,"has-symbols":22,"hasown":25}],19:[function(require,module,exports){ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); - -if ($gOPD) { - try { - $gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; - } -} - -module.exports = $gOPD; - -},{"get-intrinsic":18}],20:[function(require,module,exports){ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); - -var hasPropertyDescriptors = function hasPropertyDescriptors() { - if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - return true; - } catch (e) { - // IE 8 has a broken defineProperty - return false; - } - } - return false; -}; - -hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - // node v0.6 has a bug where array lengths can be Set but not Defined - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], 'length', { value: 1 }).length !== 1; - } catch (e) { - // In Firefox 4-22, defining length on an array throws an exception. - return true; - } -}; - -module.exports = hasPropertyDescriptors; - -},{"get-intrinsic":18}],21:[function(require,module,exports){ -'use strict'; - -var test = { - foo: {} -}; - -var $Object = Object; - -module.exports = function hasProto() { - return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); -}; - -},{}],22:[function(require,module,exports){ +},{"function-bind":20,"has":25,"has-symbols":22}],22:[function(require,module,exports){ 'use strict'; var origSymbol = typeof Symbol !== 'undefined' && Symbol; @@ -6820,14 +7265,11 @@ module.exports = function hasToStringTagShams() { },{"has-symbols/shams":23}],25:[function(require,module,exports){ 'use strict'; -var call = Function.prototype.call; -var $hasOwn = Object.prototype.hasOwnProperty; var bind = require('function-bind'); -/** @type {(o: {}, p: PropertyKey) => p is keyof o} */ -module.exports = bind.call(call, $hasOwn); +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); -},{"function-bind":17}],26:[function(require,module,exports){ +},{"function-bind":20}],26:[function(require,module,exports){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m @@ -6915,31 +7357,6 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { } },{}],27:[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 - } -} - -},{}],28:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -6968,7 +7385,7 @@ if (typeof Object.create === 'function') { } } -},{}],29:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ 'use strict'; var hasToStringTag = require('has-tostringtag/shams')(); @@ -7003,110 +7420,7 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; -},{"call-bind/callBound":9,"has-tostringtag/shams":24}],30:[function(require,module,exports){ -'use strict'; - -var fnToStr = Function.prototype.toString; -var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; -var badArrayLike; -var isCallableMarker; -if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { - try { - badArrayLike = Object.defineProperty({}, 'length', { - get: function () { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - // eslint-disable-next-line no-throw-literal - reflectApply(function () { throw 42; }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } -} else { - reflectApply = null; -} - -var constructorRegex = /^\s*class\b/; -var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; // not a function - } -}; - -var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { return false; } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } -}; -var toStr = Object.prototype.toString; -var objectClass = '[object Object]'; -var fnClass = '[object Function]'; -var genClass = '[object GeneratorFunction]'; -var ddaClass = '[object HTMLAllCollection]'; // IE 11 -var ddaClass2 = '[object HTML document.all class]'; -var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` - -var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing - -var isDDA = function isDocumentDotAll() { return false; }; -if (typeof document === 'object') { - // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly - var all = document.all; - if (toStr.call(all) === toStr.call(document.all)) { - isDDA = function isDocumentDotAll(value) { - /* globals document: false */ - // in IE 6-8, typeof document.all is "object" and it's truthy - if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { - try { - var str = toStr.call(value); - return ( - str === ddaClass - || str === ddaClass2 - || str === ddaClass3 // opera 12.16 - || str === objectClass // IE 6-8 - ) && value('') == null; // eslint-disable-line eqeqeq - } catch (e) { /**/ } - } - return false; - }; - } -} - -module.exports = reflectApply - ? function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { return false; } - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } - : function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - if (hasToStringTag) { return tryFunctionObject(value); } - if (isES6ClassFn(value)) { return false; } - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } - return tryFunctionObject(value); - }; - -},{}],31:[function(require,module,exports){ +},{"call-bind/callBound":12,"has-tostringtag/shams":24}],29:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; @@ -7146,16 +7460,71 @@ module.exports = function isGeneratorFunction(fn) { return getProto(fn) === GeneratorFunction; }; -},{"has-tostringtag/shams":24}],32:[function(require,module,exports){ +},{"has-tostringtag/shams":24}],30:[function(require,module,exports){ +(function (global){(function (){ 'use strict'; -var whichTypedArray = require('which-typed-array'); +var forEach = require('foreach'); +var availableTypedArrays = require('available-typed-arrays'); +var callBound = require('call-bind/callBound'); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var g = typeof globalThis === 'undefined' ? global : globalThis; +var typedArrays = availableTypedArrays(); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + } + }); +} + +var tryTypedArrays = function tryAllTypedArrays(value) { + var anyTrue = false; + forEach(toStrTags, function (getter, typedArray) { + if (!anyTrue) { + try { + anyTrue = getter.call(value) === typedArray; + } catch (e) { /**/ } + } + }); + return anyTrue; +}; module.exports = function isTypedArray(value) { - return !!whichTypedArray(value); + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag || !(Symbol.toStringTag in value)) { + var tag = $slice($toString(value), 8, -1); + return $indexOf(typedArrays, tag) > -1; + } + if (!gOPD) { return false; } + return tryTypedArrays(value); }; -},{"which-typed-array":79}],33:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24}],31:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -7247,289 +7616,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],34:[function(require,module,exports){ -'use strict'; - -var keysShim; -if (!Object.keys) { - // modified from https://github.com/es-shims/es5-shim - var has = Object.prototype.hasOwnProperty; - var toStr = Object.prototype.toString; - var isArgs = require('./isArguments'); // eslint-disable-line global-require - var isEnumerable = Object.prototype.propertyIsEnumerable; - var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); - var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); - var dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ]; - var equalsConstructorPrototype = function (o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - var excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - var hasAutomationEqualityBug = (function () { - /* global window */ - if (typeof window === 'undefined') { return false; } - for (var k in window) { - try { - if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }()); - var equalsConstructorPrototypeIfNotBuggy = function (o) { - /* global window */ - if (typeof window === 'undefined' || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } - }; - - keysShim = function keys(object) { - var isObject = object !== null && typeof object === 'object'; - var isFunction = toStr.call(object) === '[object Function]'; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === '[object String]'; - var theKeys = []; - - if (!isObject && !isFunction && !isArguments) { - throw new TypeError('Object.keys called on a non-object'); - } - - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === 'prototype') && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; - }; -} -module.exports = keysShim; - -},{"./isArguments":36}],35:[function(require,module,exports){ -'use strict'; - -var slice = Array.prototype.slice; -var isArgs = require('./isArguments'); - -var origKeys = Object.keys; -var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); - -var originalKeys = Object.keys; - -keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = (function () { - // Safari 5.0 bug - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2)); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { // eslint-disable-line func-name-matching - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; - } - } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; -}; - -module.exports = keysShim; - -},{"./implementation":34,"./isArguments":36}],36:[function(require,module,exports){ -'use strict'; - -var toStr = Object.prototype.toString; - -module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === '[object Arguments]'; - if (!isArgs) { - isArgs = str !== '[object Array]' && - value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - toStr.call(value.callee) === '[object Function]'; - } - return isArgs; -}; - -},{}],37:[function(require,module,exports){ -'use strict'; - -// modified from https://github.com/es-shims/es6-shim -var objectKeys = require('object-keys'); -var hasSymbols = require('has-symbols/shams')(); -var callBound = require('call-bind/callBound'); -var toObject = Object; -var $push = callBound('Array.prototype.push'); -var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); -var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; - -// eslint-disable-next-line no-unused-vars -module.exports = function assign(target, source1) { - if (target == null) { throw new TypeError('target must be an object'); } - var to = toObject(target); // step 1 - if (arguments.length === 1) { - return to; // step 2 - } - for (var s = 1; s < arguments.length; ++s) { - var from = toObject(arguments[s]); // step 3.a.i - - // step 3.a.ii: - var keys = objectKeys(from); - var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); - if (getSymbols) { - var syms = getSymbols(from); - for (var j = 0; j < syms.length; ++j) { - var key = syms[j]; - if ($propIsEnumerable(from, key)) { - $push(keys, key); - } - } - } - - // step 3.a.iii: - for (var i = 0; i < keys.length; ++i) { - var nextKey = keys[i]; - if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2 - var propValue = from[nextKey]; // step 3.a.iii.2.a - to[nextKey] = propValue; // step 3.a.iii.2.b - } - } - } - - return to; // step 4 -}; - -},{"call-bind/callBound":9,"has-symbols/shams":23,"object-keys":35}],38:[function(require,module,exports){ -'use strict'; - -var implementation = require('./implementation'); - -var lacksProperEnumerationOrder = function () { - if (!Object.assign) { - return false; - } - /* - * v8, specifically in node 4.x, has a bug with incorrect property enumeration order - * note: this does not detect the bug unless there's 20 characters - */ - var str = 'abcdefghijklmnopqrst'; - var letters = str.split(''); - var map = {}; - for (var i = 0; i < letters.length; ++i) { - map[letters[i]] = letters[i]; - } - var obj = Object.assign({}, map); - var actual = ''; - for (var k in obj) { - actual += k; - } - return str !== actual; -}; - -var assignHasPendingExceptions = function () { - if (!Object.assign || !Object.preventExtensions) { - return false; - } - /* - * Firefox 37 still has "pending exception" logic in its Object.assign implementation, - * which is 72% slower than our shim, and Firefox 40's native implementation. - */ - var thrower = Object.preventExtensions({ 1: 2 }); - try { - Object.assign(thrower, 'xy'); - } catch (e) { - return thrower[1] === 'y'; - } - return false; -}; - -module.exports = function getPolyfill() { - if (!Object.assign) { - return implementation; - } - if (lacksProperEnumerationOrder()) { - return implementation; - } - if (assignHasPendingExceptions()) { - return implementation; - } - return Object.assign; -}; - -},{"./implementation":37}],39:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ 'use strict'; @@ -7636,7 +7723,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],40:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. @@ -7689,7 +7776,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],41:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -7759,7 +7846,7 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],42:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. @@ -7820,7 +7907,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],43:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -9696,7 +9783,7 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":39,"./adler32":40,"./crc32":42,"./messages":47,"./trees":48}],44:[function(require,module,exports){ +},{"../utils/common":32,"./adler32":33,"./crc32":35,"./messages":40,"./trees":41}],37:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -10043,7 +10130,7 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],45:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11601,7 +11688,7 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":39,"./adler32":40,"./crc32":42,"./inffast":44,"./inftrees":46}],46:[function(require,module,exports){ +},{"../utils/common":32,"./adler32":33,"./crc32":35,"./inffast":37,"./inftrees":39}],39:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11946,7 +12033,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":39}],47:[function(require,module,exports){ +},{"../utils/common":32}],40:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11980,7 +12067,7 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],48:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13204,7 +13291,7 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":39}],49:[function(require,module,exports){ +},{"../utils/common":32}],42:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13253,7 +13340,7 @@ function ZStream() { module.exports = ZStream; -},{}],50:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ (function (Buffer){(function (){ var fs = require("fs"), stream = require("stream"), @@ -13867,7 +13954,7 @@ exports.parseBuffer = function(buf, callback) { exports.parse = exports.parseBuffer }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":8,"fs":7,"stream":68,"zlib":6}],51:[function(require,module,exports){ +},{"buffer":11,"fs":10,"stream":46,"zlib":9}],44:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14053,7 +14140,205 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],52:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + +},{"buffer":11}],46:[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/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.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":17,"inherits":27,"readable-stream/lib/_stream_duplex.js":48,"readable-stream/lib/_stream_passthrough.js":49,"readable-stream/lib/_stream_readable.js":50,"readable-stream/lib/_stream_transform.js":51,"readable-stream/lib/_stream_writable.js":52,"readable-stream/lib/internal/streams/end-of-stream.js":56,"readable-stream/lib/internal/streams/pipeline.js":58}],47:[function(require,module,exports){ 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } @@ -14182,7 +14467,7 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); module.exports.codes = codes; -},{}],53:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14204,48 +14489,60 @@ module.exports.codes = codes; // 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. - // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. - 'use strict'; - /**/ + var objectKeys = Object.keys || function (obj) { var keys = []; - for (var key in obj) keys.push(key); + + for (var key in obj) { + keys.push(key); + } + return keys; }; /**/ + module.exports = Duplex; + var Readable = require('./_stream_readable'); + var Writable = require('./_stream_writable'); + require('inherits')(Duplex, Readable); + { // Allow the keys array to be GC'ed. 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); this.allowHalfOpen = true; + if (options) { if (options.readable === false) this.readable = false; if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { this.allowHalfOpen = false; this.once('end', onend); } } } + Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14272,20 +14569,20 @@ Object.defineProperty(Duplex.prototype, 'writableLength', { get: function get() { return this._writableState.length; } -}); +}); // the no-half-open enforcer -// the no-half-open enforcer function onend() { // If the writable side ended, then we're ok. - if (this._writableState.ended) return; - - // no more data can be written. + if (this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); } + function onEndNT(self) { self.end(); } + Object.defineProperty(Duplex.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14295,6 +14592,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { if (this._readableState === undefined || this._writableState === undefined) { return false; } + return this._readableState.destroyed && this._writableState.destroyed; }, set: function set(value) { @@ -14302,16 +14600,16 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // has not been initialized yet if (this._readableState === undefined || this._writableState === undefined) { return; - } - - // backward compatibility, the user is explicitly + } // backward compatibility, the user is explicitly // managing destroyed + + this._readableState.destroyed = value; this._writableState.destroyed = value; } }); }).call(this)}).call(this,require('_process')) -},{"./_stream_readable":55,"./_stream_writable":57,"_process":51,"inherits":28}],54:[function(require,module,exports){ +},{"./_stream_readable":50,"./_stream_writable":52,"_process":44,"inherits":27}],49:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -14332,24 +14630,26 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // 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. - // 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'); + require('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":56,"inherits":28}],55:[function(require,module,exports){ +},{"./_stream_transform":51,"inherits":27}],50:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14371,40 +14671,49 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. - 'use strict'; module.exports = Readable; - /**/ + var Duplex; /**/ Readable.ReadableState = ReadableState; - /**/ + var EE = require('events').EventEmitter; + var EElistenerCount = function EElistenerCount(emitter, type) { return emitter.listeners(type).length; }; /**/ /**/ + + var Stream = require('./internal/streams/stream'); /**/ + var Buffer = require('buffer').Buffer; -var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; + +var OurUint8Array = global.Uint8Array || function () {}; + function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } + function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } - /**/ + + var debugUtil = require('util'); + var debug; + if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { @@ -14412,57 +14721,60 @@ if (debugUtil && debugUtil.debuglog) { } /**/ + var BufferList = require('./internal/streams/buffer_list'); + var destroyImpl = require('./internal/streams/destroy'); + var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; + getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + -// Lazy loaded to improve the startup performance. var StringDecoder; var createReadableStreamAsyncIterator; var from; + require('inherits')(Readable, Stream); + var errorOrDestroy = destroyImpl.errorOrDestroy; 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); - - // This is a hack to make sure that our error handler is attached before any + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // 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 (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } + function ReadableState(options, stream, isDuplex) { Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; - - // Duplex streams are both readable and writable, but share + options = options || {}; // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - // object stream flag. Used to make read(n) ignore n and to + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // 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 (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - // the point at which it stops calling _read() to fill the buffer + this.objectMode = !!options.objectMode; + if (isDuplex) 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" - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); - // A linked list is used to store data chunks instead of an array because the + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // 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; @@ -14470,66 +14782,61 @@ function ReadableState(options, stream, isDuplex) { this.flowing = null; this.ended = false; this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted // 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 read call. - this.sync = true; - // whenever we return null, then we set a flag to say + 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; - this.paused = true; + this.paused = true; // Should close be emitted on destroy. Defaults to true. - // Should close be emitted on destroy. Defaults to true. - this.emitClose = options.emitClose !== false; + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') - // Should .destroy() be called after 'end' (and potentially 'finish') - this.autoDestroy = !!options.autoDestroy; + this.autoDestroy = !!options.autoDestroy; // has it been destroyed - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string + this.destroyed = 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'; - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s + + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled - // 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); - - // Checking for a Stream.Duplex instance is faster here instead of inside + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); + this._readableState = new ReadableState(options, this, isDuplex); // legacy - // legacy this.readable = true; + if (options) { if (typeof options.read === 'function') this._read = options.read; if (typeof options.destroy === 'function') this._destroy = options.destroy; } + Stream.call(this); } + Object.defineProperty(Readable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14539,6 +14846,7 @@ Object.defineProperty(Readable.prototype, 'destroyed', { if (this._readableState === undefined) { return false; } + return this._readableState.destroyed; }, set: function set(value) { @@ -14546,60 +14854,69 @@ Object.defineProperty(Readable.prototype, 'destroyed', { // has not been initialized yet if (!this._readableState) { return; - } - - // backward compatibility, the user is explicitly + } // backward compatibility, the user is explicitly // managing destroyed + + this._readableState.destroyed = value; } }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function (err, cb) { cb(err); -}; - -// Manually shove something into the read() buffer. +}; // 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; var skipChunkCheck; + if (!state.objectMode) { if (typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } + skipChunkCheck = true; } } else { skipChunkCheck = true; } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; +}; // Unshift should *always* be something directly out of read() + -// Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, true, false); }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { debug('readableAddChunk', chunk); var state = stream._readableState; + if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else { var er; if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { errorOrDestroy(stream, er); } else if (state.objectMode || chunk && chunk.length > 0) { if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = _uint8ArrayToBuffer(chunk); } + if (addToFront) { if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); } else if (state.ended) { @@ -14608,6 +14925,7 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { return false; } else { state.reading = false; + if (state.decoder && !encoding) { chunk = state.decoder.write(chunk); if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); @@ -14619,13 +14937,14 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { state.reading = false; maybeReadMore(stream, state); } - } - - // We can push more data if we are below the highWaterMark. + } // We can push more data if we are below the highWaterMark. // 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. + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); } + function addChunk(stream, state, chunk, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { state.awaitDrain = 0; @@ -14636,42 +14955,50 @@ function addChunk(stream, state, chunk, addToFront) { if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } + maybeReadMore(stream, state); } + function chunkInvalid(state, chunk) { var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); } + return er; } + Readable.prototype.isPaused = function () { return this._readableState.flowing === false; -}; +}; // backwards compatibility. + -// backwards compatibility. Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - // If setEncoding(null), decoder.encoding equals utf8 - this._readableState.encoding = this._readableState.decoder.encoding; + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: - // Iterate over current buffer to convert already stored Buffers: var p = this._readableState.buffer.head; var content = ''; + while (p !== null) { content += decoder.write(p.data); p = p.next; } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); this._readableState.length = content.length; return this; -}; +}; // Don't raise the hwm > 1GB + -// Don't raise the hwm > 1GB var MAX_HWM = 0x40000000; + function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. @@ -14687,54 +15014,55 @@ function computeNewHighWaterMark(n) { n |= n >>> 16; n++; } - return n; -} -// This function is designed to be inlinable, so please take care when making + 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 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 (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. + -// 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 + 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.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || 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. + 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 + } // 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 @@ -14755,3424 +15083,2819 @@ Readable.prototype.read = function (n) { // '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 = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - 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 onEofChunk(stream, state) { - debug('onEofChunk'); - 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; - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - 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; - debug('emitReadable', state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } -} -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - state.emittedReadable = false; - } - - // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - 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; - process.nextTick(maybeReadMore_, stream, state); - } -} -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - } - 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) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; -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) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - 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(); - } - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); - if (ret === false) { - // 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', state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } + var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - // 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) errorOrDestroy(dest, er); - } + 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. - // 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); - } + 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. - // tell the dest that it's being piped to - dest.emit('pipe', src); + if (state.length === 0) state.needReadable = true; // call internal read method - // 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 pipeOnDrainFunctionResult() { - 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; - var unpipeInfo = { - hasUnpiped: false - }; + this._read(state.highWaterMark); - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; + 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. - // 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; + if (!state.reading) n = howMuchToRead(nOrig, state); + } - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - // slow case. multiple pipe destinations. + 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 (!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, { - hasUnpiped: false - }); - return this; + if (nOrig !== n && state.ended) endReadable(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, unpipeInfo); - return this; + if (ret !== null) this.emit('data', ret); + return ret; }; -// 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); - var state = this._readableState; - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; - // Try start flowing on next tick if stream isn't explicitly paused - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } + if (state.decoder) { + var chunk = state.decoder.end(); + + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; } } - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - return res; -}; -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); + + state.ended = true; + + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } } - return res; -}; -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; +} // 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. - // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); + +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); } } -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'); - // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; -}; -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + + + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + 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; + process.nextTick(maybeReadMore_, stream, state); } } -function resume_(stream, state) { - debug('resume', state.reading); - if (!state.reading) { + +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; } - state.resumeScheduled = false; - 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 (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - this._readableState.paused = true; - return this; + + 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) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); }; -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 _this = this; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - _this.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 = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; - // 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 methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } + case 1: + state.pipes = [state.pipes, dest]; + break; - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + default: + state.pipes.push(dest); + break; } - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; -}; -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); - } - return createReadableStreamAsyncIterator(this); - }; -} -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; + 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) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } } } -}); -// exposed for testing purposes only. -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); + 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. -// 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.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); + + 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(); } -} -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); + src.on('data', ondata); + + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + + if (ret === false) { + // 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', state.awaitDrain); + state.awaitDrain++; } + + src.pause(); } - } -} -if (typeof Symbol === 'function') { - Readable.from = function (iterable, opts) { - if (from === undefined) { - from = require('./internal/streams/from'); - } - return from(Readable, iterable, opts); - }; -} -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":52,"./_stream_duplex":53,"./internal/streams/async_iterator":58,"./internal/streams/buffer_list":59,"./internal/streams/destroy":60,"./internal/streams/from":62,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"events":14,"inherits":28,"string_decoder/":69,"util":4}],56:[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. + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. -// 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'; + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. -module.exports = Transform; -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; -var Duplex = require('./_stream_duplex'); -require('inherits')(Transform, Duplex); -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - // 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; + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); } - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} -function prefinish() { - var _this = this; - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; + dest.once('close', onclose); -// 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) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; -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); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); } -}; -// 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.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; + 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; }; -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); -}; -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) - // single equals check for both `null` and `undefined` - stream.push(data); - // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} -},{"../errors":52,"./_stream_duplex":53,"inherits":28}],57:[function(require,module,exports){ -(function (process,global){(function (){ -// 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 pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + 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); + } + }; +} -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. -'use strict'; + if (state.pipesCount === 0) return this; // just one destination. most common case. -module.exports = Writable; + 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. -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. -// 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 () { - onCorkedFinish(_this, state); - }; -} -/* */ -/**/ -var Duplex; -/**/ + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; -Writable.WritableState = WritableState; + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + } -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ + return this; + } // try to find the right one. -/**/ -var Stream = require('./internal/streams/stream'); -/**/ -var Buffer = require('buffer').Buffer; -var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -var destroyImpl = require('./internal/streams/destroy'); -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; -var errorOrDestroy = destroyImpl.errorOrDestroy; -require('inherits')(Writable, Stream); -function nop() {} -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; + 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, unpipeInfo); + return this; +}; // set up data events if they are asked for +// Ensure readable listeners eventually get something - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; - // 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() - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - // if _final has been called - this.finalCalled = false; + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); - // 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; + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } - // has it been destroyed - this.destroyed = false; + return res; +}; - // 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; +Readable.prototype.addListener = Readable.prototype.on; - // 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'; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); - // 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; + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - // a flag to see when we're in the middle of a write. - this.writing = false; + return res; +}; - // when true all writes will be buffered until .uncork() call - this.corked = 0; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); - // 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; + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - // 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; + return res; +}; - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} - // the amount that is being written when _write is called. - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; +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. - // 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; +Readable.prototype.resume = function () { + var state = this._readableState; - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() - // Should close be emitted on destroy. Defaults to true. - this.emitClose = options.emitClose !== false; + state.flowing = !state.readableListening; + resume(this, state); + } - // Should .destroy() be called after 'finish' (and potentially 'end') - this.autoDestroy = !!options.autoDestroy; + state.paused = false; + return this; +}; - // count buffered requests - this.bufferedRequestCount = 0; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); +function resume_(stream, state) { + debug('resume', state.reading); + + if (!state.reading) { + stream.read(0); + } + + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); } -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); } - return out; + + this._readableState.paused = true; + return this; }; -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } 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 value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; +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 _this = this; + + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); } + + _this.push(null); }); -} else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; -} -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - // 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. + var ret = _this.push(chunk); - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); + if (!ret) { + paused = true; + stream.pause(); + } + }); // proxy all the other methods. + // important when wrapping filters and duplexes. - // legacy. - this.writable = true; - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } - Stream.call(this); -} + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } // proxy certain important events. -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); -}; -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - // TODO: defer error events consistently everywhere, not just the cb - errorOrDestroy(stream, er); - process.nextTick(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 er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; -} -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(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.ending) 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 () { - this._writableState.corked++; -}; -Writable.prototype.uncork = function () { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !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 ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. + + + this._read = function (n) { + debug('wrapped _read', n); + + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; }; -Object.defineProperty(Writable.prototype, 'writableBuffer', { + +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + + return createReadableStreamAsyncIterator(this); + }; +} + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState && this._writableState.getBuffer(); + return this._readableState.highWaterMark; } }); -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { +Object.defineProperty(Readable.prototype, 'readableBuffer', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState.highWaterMark; + return this._readableState && this._readableState.buffer; } }); - -// 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) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; } } - 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 = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; +}); // exposed for testing purposes only. + +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // 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.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + // read part of list + ret = state.buffer.consume(n, state.decoder); } return ret; } -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; + +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } } -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); + +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } } } -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; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - 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) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); + +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); } - } + + return from(Readable, iterable, opts); + }; } -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + + return -1; } +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":47,"./_stream_duplex":48,"./internal/streams/async_iterator":53,"./internal/streams/buffer_list":54,"./internal/streams/destroy":55,"./internal/streams/from":57,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"events":17,"inherits":27,"string_decoder/":61,"util":7}],51:[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. +// 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'; -// 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'); +module.exports = Transform; + +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + +var Duplex = require('./_stream_duplex'); + +require('inherits')(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + + ts.writechunk = null; + ts.writecb = null; + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); } } -// 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; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. - // 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); - } - state.bufferedRequestCount = 0; + 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.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); } 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; - state.bufferedRequestCount--; - // 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; + done(this, null, null); } - state.bufferedRequest = entry; - state.bufferProcessing = false; } -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); + +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) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); }; -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; + +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); } - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); +}; // 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. - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - // ignore unnecessary end() calls. - if (!state.ending) endWritable(this, state, cb); - return this; -}; -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && !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 needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); +}; + +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); } -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; +},{"../errors":47,"./_stream_duplex":48,"inherits":27}],52:[function(require,module,exports){ +(function (process,global){(function (){ +// 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. +// 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; +/* */ + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // 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 () { + onCorkedFinish(_this, state); + }; } -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; +/* */ + +/**/ + + +var Duplex; +/**/ + +Writable.WritableState = WritableState; +/**/ + +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ + +var Stream = require('./internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); } -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - // reuse the free corkReq. - state.corkedRequestsFree.next = corkReq; +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; +var destroyImpl = require('./internal/streams/destroy'); + +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + +var errorOrDestroy = destroyImpl.errorOrDestroy; + +require('inherits')(Writable, Stream); + +function nop() {} + +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. + + this.objectMode = !!options.objectMode; + if (isDuplex) 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() + + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called + + this.finalCalled = false; // 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; // has it been destroyed + + this.destroyed = 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; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') + + this.autoDestroy = !!options.autoDestroy; // 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; } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - cb(err); + + return out; }; -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":52,"./_stream_duplex":53,"./internal/streams/destroy":60,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"inherits":28,"util-deprecate":71}],58:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; -var _Object$setPrototypeO; -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -var finished = require('./end-of-stream'); -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - if (resolve !== null) { - var data = iter[kStream].read(); - // we defer if data is null - // we can be expecting either 'end' or - // 'error' - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } 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 value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; } - } -} -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - iter[kHandlePromise](resolve, reject); - }, reject); + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; }; } -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } - // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time - var lastPromise = this[kLastPromise]; - var promise; - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise; - return promise; +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. + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. + + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; - // reject if we are waiting for data in the Promise - // returned by next() and store the error - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve = iterator[kLastResolve]; - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; + + Stream.call(this); +} // Otherwise people can pipe Writable streams, which is just wrong. + + +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); }; -module.exports = createReadableStreamAsyncIterator; -}).call(this)}).call(this,require('_process')) -},{"./end-of-stream":61,"_process":51}],59:[function(require,module,exports){ -'use strict'; -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -var _require = require('buffer'), - Buffer = _require.Buffer; -var _require2 = require('util'), - inspect = _require2.inspect; -var custom = inspect && inspect.custom || 'inspect'; -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb + + errorOrDestroy(stream, er); + process.nextTick(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 er; + + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + + return true; } -module.exports = /*#__PURE__*/function () { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - 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; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) ret += s + p.data; - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - // Consumes a specified amount of bytes or characters from the buffered data. - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } - // Consumes a specified amount of characters from the buffered data. - }, { - key: "_getString", - value: function _getString(n) { - var p = this.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) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; - // Consumes a specified amount of bytes from the buffered data. - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.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) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } +Writable.prototype.cork = function () { + this._writableState.corked++; +}; - // Make sure the linked list only shows the minimal necessary information. - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread(_objectSpread({}, options), {}, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - } - }]); - return BufferList; -}(); -},{"buffer":8,"util":4}],60:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; +Writable.prototype.uncork = function () { + var state = this._writableState; -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !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 ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; } +}); // 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. - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); - if (this._readableState) { - this._readableState.destroyed = true; + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } } - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); + 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 = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + + if (last) { + last.next = state.lastBufferedRequest; } else { - process.nextTick(emitCloseNT, _this); + state.bufferedRequest = state.lastBufferedRequest; } - }); - return this; -} -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; + + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); } + + return ret; } -function emitErrorNT(self, err) { - self.emit('error', err); -} -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; } -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy -}; -}).call(this)}).call(this,require('_process')) -},{"_process":51}],61:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error + + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error + + finishMaybe(stream, state); + } } -function noop() {} -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; } -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - var onerror = function onerror(err) { - callback.call(stream, err); - }; - var onclose = function onclose() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + 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) || stream.destroyed; + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); + + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); } - }; - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); } - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; } -module.exports = eos; -},{"../../../errors":52}],62:[function(require,module,exports){ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') -}; -},{}],63:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). +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; + var allBuffers = true; + + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } -'use strict'; + buffer.allBuffers = allBuffers; + 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 -var eos; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; + state.pendingcb++; + state.lastBufferedRequest = null; - // request.destroy just do .end - .abort is what we want - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} -function call(fn) { - fn(); -} -function pipe(from, to) { - return from.pipe(to); -} -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); -} -module.exports = pipeline; -},{"../../../errors":52,"./end-of-stream":61}],64:[function(require,module,exports){ -'use strict'; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); + state.bufferedRequestCount = 0; + } 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; + state.bufferedRequestCount--; // 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; + } } - return Math.floor(hwm); + + if (entry === null) state.lastBufferedRequest = null; } - // Default value - return state.objectMode ? 16 : 16 * 1024; + state.bufferedRequest = entry; + state.bufferProcessing = false; } -module.exports = { - getHighWaterMark: getHighWaterMark + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); }; -},{"../../../errors":52}],65:[function(require,module,exports){ -module.exports = require('events').EventEmitter; -},{"events":14}],66:[function(require,module,exports){ -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer +Writable.prototype._writev = null; -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] +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 (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks -SafeBuffer.prototype = Object.create(Buffer.prototype) + if (state.corked) { + state.corked = 1; + this.uncork(); + } // ignore unnecessary end() calls. -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') + if (!state.ending) endWritable(this, state, cb); + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; } - return Buffer(arg, encodingOrOffset, length) +}); + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + + if (err) { + errorOrDestroy(stream, err); + } + + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} + +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); } else { - buf.fill(fill) + state.prefinished = true; + stream.emit('prefinish'); } - } else { - buf.fill(0) } - return buf } -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') +function finishMaybe(stream, state) { + var need = needFinish(state); + + if (need) { + prefinish(stream, state); + + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } } - return Buffer(size) + + return need; } -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); } - return buffer.SlowBuffer(size) + + state.ended = true; + stream.writable = false; } -},{"buffer":8}],67:[function(require,module,exports){ -'use strict'; +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; -var GetIntrinsic = require('get-intrinsic'); -var define = require('define-data-property'); -var hasDescriptors = require('has-property-descriptors')(); -var gOPD = require('gopd'); + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. -var $TypeError = GetIntrinsic('%TypeError%'); -var $floor = GetIntrinsic('%Math.floor%'); -module.exports = function setFunctionLength(fn, length) { - if (typeof fn !== 'function') { - throw new $TypeError('`fn` is not a function'); - } - if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { - throw new $TypeError('`length` must be a positive 32-bit integer'); - } + state.corkedRequestsFree.next = corkReq; +} - var loose = arguments.length > 2 && !!arguments[2]; +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } - var functionLengthIsConfigurable = true; - var functionLengthIsWritable = true; - if ('length' in fn && gOPD) { - var desc = gOPD(fn, 'length'); - if (desc && !desc.configurable) { - functionLengthIsConfigurable = false; - } - if (desc && !desc.writable) { - functionLengthIsWritable = false; - } - } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { - if (hasDescriptors) { - define(fn, 'length', length, true, true); - } else { - define(fn, 'length', length); - } - } - return fn; -}; -},{"define-data-property":12,"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],68:[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. + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; -module.exports = Stream; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":47,"./_stream_duplex":48,"./internal/streams/destroy":55,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"inherits":27,"util-deprecate":63}],53:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; -var EE = require('events').EventEmitter; -var inherits = require('inherits'); +var _Object$setPrototypeO; -inherits(Stream, EE); -Stream.Readable = require('readable-stream/lib/_stream_readable.js'); -Stream.Writable = require('readable-stream/lib/_stream_writable.js'); -Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); -Stream.Transform = require('readable-stream/lib/_stream_transform.js'); -Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); -Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') -Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; +var finished = require('./end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' -function Stream() { - EE.call(this); + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } } -Stream.prototype.pipe = function(dest, options) { - var source = this; +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; } - } - } - source.on('data', ondata); + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, - dest.on('drain', ondrain); + next: function next() { + var _this = this; - // 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); - } + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; + if (error !== null) { + return Promise.reject(error); + } - dest.end(); - } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time - function onclose() { - if (didOnEnd) return; - didOnEnd = true; + var lastPromise = this[kLastPromise]; + var promise; - if (typeof dest.destroy === 'function') dest.destroy(); - } + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); - // 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. + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + + promise = new Promise(this[kHandlePromise]); } - } - source.on('error', onerror); - dest.on('error', onerror); + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } - source.removeListener('end', onend); - source.removeListener('close', onclose); + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); - source.removeListener('error', onerror); - dest.removeListener('error', onerror); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); - dest.removeListener('close', cleanup); - } + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error - source.on('end', cleanup); - source.on('close', cleanup); + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } - dest.on('close', cleanup); + iterator[kError] = err; + return; + } - dest.emit('pipe', source); + var resolve = iterator[kLastResolve]; - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } -},{"events":14,"inherits":28,"readable-stream/lib/_stream_duplex.js":53,"readable-stream/lib/_stream_passthrough.js":54,"readable-stream/lib/_stream_readable.js":55,"readable-stream/lib/_stream_transform.js":56,"readable-stream/lib/_stream_writable.js":57,"readable-stream/lib/internal/streams/end-of-stream.js":61,"readable-stream/lib/internal/streams/pipeline.js":63}],69:[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. + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":56,"_process":44}],54:[function(require,module,exports){ 'use strict'; -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -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; - } - } -}; +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -// 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; -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// 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); -} +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); } } -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 || ''; -}; +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -StringDecoder.prototype.end = utf8End; +var _require = require('buffer'), + Buffer = _require.Buffer; -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; +var _require2 = require('util'), + inspect = _require2.inspect; -// 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; -}; +var custom = inspect && inspect.custom || 'inspect'; -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -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 byte >> 6 === 0x02 ? -1 : -2; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); } -// 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 || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + 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; } - 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 -// a single UTF-8 replacement character ('\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'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + + while (p = p.next) { + ret += s + p.data; } + + return ret; } - } -} + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; -// 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; -} + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } -// 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); -} + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; -// 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); + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); } + + return ret; } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. -// 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; -} + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; -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); -} + 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; -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; -} + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} + break; + } -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} -},{"safe-buffer":66}],70:[function(require,module,exports){ -(function (setImmediate,clearImmediate){(function (){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; + ++c; + } -// DOM APIs, for completeness + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; + 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; -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; + break; + } + + ++c; + } + + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; + return BufferList; +}(); +},{"buffer":11,"util":7}],55:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; // undocumented cb() API, needed for core, not for public API -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); +function destroy(err, cb) { + var _this = this; - immediateIds[id] = true; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); } - // Prevent ids from leaking - exports.clearImmediate(id); } - }); - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":51,"timers":70}],71:[function(require,module,exports){ -(function (global){(function (){ + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks -/** - * Module exports. - */ -module.exports = deprecate; + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well -/** - * 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; + if (this._writableState) { + this._writableState.destroyed = true; } - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); } else { - console.warn(msg); + process.nextTick(emitCloseNT, _this); } - warned = true; + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); } - return fn.apply(this, arguments); - } + }); - return deprecated; + return this; } -/** - * 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'; +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); } -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],72:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); } -},{}],73:[function(require,module,exports){ -(function (process,global){(function (){ -// 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. -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - return str; +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy }; +}).call(this)}).call(this,require('_process')) +},{"_process":44}],56:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } +function noop() {} - if (process.noDeprecation === true) { - return fn; - } +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; - return deprecated; -}; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; + var onerror = function onerror(err) { + callback.call(stream, err); + }; -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; + var onclose = function onclose() { + var err; -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); } -} - -function stylizeNoColor(str, styleType) { - return str; + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; } +module.exports = eos; +},{"../../../errors":47}],57:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; -function arrayToHash(array) { - var hash = {}; +},{}],58:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; - array.forEach(function(val, idx) { - hash[val] = true; - }); +var eos; - return hash; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; } +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } +function call(fn) { + fn(); +} - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } +function pipe(from, to) { + return from.pipe(to); +} - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} + +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; } - var base = '', array = false, braces = ['{', '}']; + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); } - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } +module.exports = pipeline; +},{"../../../errors":47,"./end-of-stream":56}],59:[function(require,module,exports){ +'use strict'; - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - } - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } + return Math.floor(hwm); + } // Default value - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); + return state.objectMode ? 16 : 16 * 1024; } +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":47}],60:[function(require,module,exports){ +module.exports = require('events').EventEmitter; -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} +},{"events":17}],61:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} +/**/ +var Buffer = require('safe-buffer').Buffer; +/**/ -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } +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; } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - +}; -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); +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; } } +}; - return name + ': ' + str; +// 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); +} -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; +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 || ''; +}; - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} +StringDecoder.prototype.end = utf8End; +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; +// 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; +}; -function isBoolean(arg) { - return typeof arg === 'boolean'; +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +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 byte >> 6 === 0x02 ? -1 : -2; } -exports.isBoolean = isBoolean; -function isNull(arg) { - return arg === null; +// 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 || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) 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; } -exports.isNull = isNull; -function isNullOrUndefined(arg) { - return arg == null; +// 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 +// a single UTF-8 replacement character ('\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'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } } -exports.isNullOrUndefined = isNullOrUndefined; -function isNumber(arg) { - return typeof arg === 'number'; +// 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; } -exports.isNumber = isNumber; -function isString(arg) { - return typeof arg === 'string'; +// 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); } -exports.isString = isString; -function isSymbol(arg) { - return typeof arg === 'symbol'; +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; } -exports.isSymbol = isSymbol; -function isUndefined(arg) { - return arg === void 0; +// 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); } -exports.isUndefined = isUndefined; -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; +// 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; } -exports.isRegExp = isRegExp; -function isObject(arg) { - return typeof arg === 'object' && arg !== null; +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); } -exports.isObject = isObject; -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; +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; } -exports.isDate = isDate; -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); } -exports.isError = isError; -function isFunction(arg) { - return typeof arg === 'function'; +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; } -exports.isFunction = isFunction; +},{"safe-buffer":45}],62:[function(require,module,exports){ +(function (setImmediate,clearImmediate){(function (){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; -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; +// DOM APIs, for completeness -exports.isBuffer = require('./support/isBuffer'); +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; -function objectToString(o) { - return Object.prototype.toString.call(o); +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; } +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + immediateIds[id] = true; -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; }; +}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) +},{"process/browser.js":44,"timers":62}],63:[function(require,module,exports){ +(function (global){(function (){ + +/** + * Module exports. + */ +module.exports = deprecate; /** - * Inherit the prototype methods from one constructor into another. + * Mark that a method should not be used. + * Returns a modified function which warns once by default. * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). + * If `localStorage.noDeprecation = true` is set, then it is a no-op. * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. + * 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 */ -exports.inherits = require('inherits'); -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + 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 origin; -}; -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); + return deprecated; } -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":72,"_process":51,"inherits":27}],74:[function(require,module,exports){ -arguments[4][72][0].apply(exports,arguments) -},{"dup":72}],75:[function(require,module,exports){ +/** + * 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)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],64:[function(require,module,exports){ +arguments[4][3][0].apply(exports,arguments) +},{"dup":3}],65:[function(require,module,exports){ // Currently in sync with Node.js lib/internal/util/types.js // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 @@ -18508,7 +18231,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer; }); }); -},{"is-arguments":29,"is-generator-function":31,"is-typed-array":32,"which-typed-array":79}],76:[function(require,module,exports){ +},{"is-arguments":28,"is-generator-function":29,"is-typed-array":30,"which-typed-array":69}],66:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -18922,7 +18645,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; - }).join('\n').slice(2); + }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; @@ -18939,7 +18662,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); + name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") @@ -19227,7 +18950,7 @@ function callbackify(original) { exports.callbackify = callbackify; }).call(this)}).call(this,require('_process')) -},{"./support/isBuffer":74,"./support/types":75,"_process":51,"inherits":28}],77:[function(require,module,exports){ +},{"./support/isBuffer":64,"./support/types":65,"_process":44,"inherits":27}],67:[function(require,module,exports){ function webpackBootstrapFunc (modules) { /******/ // The module cache /******/ var installedModules = {}; @@ -19431,7 +19154,7 @@ module.exports = function (moduleId, options) { return worker } -},{}],78:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -19513,15 +19236,13 @@ module.exports = function (fn, options) { return worker; }; -},{}],79:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ (function (global){(function (){ 'use strict'; -var forEach = require('for-each'); +var forEach = require('foreach'); var availableTypedArrays = require('available-typed-arrays'); -var callBind = require('call-bind'); var callBound = require('call-bind/callBound'); -var gOPD = require('gopd'); var $toString = callBound('Object.prototype.toString'); var hasToStringTag = require('has-tostringtag/shams')(); @@ -19530,94 +19251,59 @@ var g = typeof globalThis === 'undefined' ? global : globalThis; var typedArrays = availableTypedArrays(); var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; -var cache = { __proto__: null }; if (hasToStringTag && gOPD && getPrototypeOf) { forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); + if (typeof g[typedArray] === 'function') { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; } - cache['$' + typedArray] = callBind(descriptor.get); - } - }); -} else { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) { - cache['$' + typedArray] = callBind(fn); } }); } var tryTypedArrays = function tryAllTypedArrays(value) { - var found = false; - forEach(cache, function (getter, typedArray) { - if (!found) { + var foundName = false; + forEach(toStrTags, function (getter, typedArray) { + if (!foundName) { try { - if ('$' + getter(value) === typedArray) { - found = $slice(typedArray, 1); + var name = getter.call(value); + if (name === typedArray) { + foundName = name; } - } catch (e) { /**/ } + } catch (e) {} } }); - return found; + return foundName; }; -var trySlices = function tryAllSlices(value) { - var found = false; - forEach(cache, function (getter, name) { - if (!found) { - try { - getter(value); - found = $slice(name, 1); - } catch (e) { /**/ } - } - }); - return found; -}; +var isTypedArray = require('is-typed-array'); module.exports = function whichTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag) { - var tag = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag) > -1) { - return tag; - } - if (tag !== 'Object') { - return false; - } - // node < 0.6 hits here on real Typed Arrays - return trySlices(value); - } - if (!gOPD) { return null; } // unknown engine + if (!isTypedArray(value)) { return false; } + if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } return tryTypedArrays(value); }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"available-typed-arrays":2,"call-bind":10,"call-bind/callBound":9,"for-each":15,"gopd":19,"has-tostringtag/shams":24}],80:[function(require,module,exports){ +},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24,"is-typed-array":30}],70:[function(require,module,exports){ exports.DOMImplementation = window.DOMImplementation; exports.XMLSerializer = window.XMLSerializer; exports.DOMParser = window.DOMParser; -},{}],81:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; -},{}],82:[function(require,module,exports){ +},{}],72:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -19664,13 +19350,13 @@ assign(ROSLIB, require('./math')); assign(ROSLIB, require('./tf')); assign(ROSLIB, require('./urdf')); -},{"./actionlib":88,"./core":101,"./math":106,"./tf":108,"./urdf":120,"object-assign":33}],83:[function(require,module,exports){ +},{"./actionlib":78,"./core":91,"./math":96,"./tf":98,"./urdf":110,"object-assign":31}],73:[function(require,module,exports){ (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./RosLib":82}],84:[function(require,module,exports){ +},{"./RosLib":72}],74:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19828,7 +19514,7 @@ var ActionClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionClient; -},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],85:[function(require,module,exports){ +},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],75:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19922,7 +19608,7 @@ var ActionListener = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionListener; -},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],86:[function(require,module,exports){ +},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],76:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20026,7 +19712,7 @@ var Goal = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Goal; -},{"../core/Message":93,"./ActionClient":84,"eventemitter2":13}],87:[function(require,module,exports){ +},{"../core/Message":83,"./ActionClient":74,"eventemitter2":16}],77:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20270,7 +19956,7 @@ var SimpleActionServer = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = SimpleActionServer; -},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],88:[function(require,module,exports){ +},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],78:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleActionServer = exports.Goal = exports.ActionListener = exports.ActionClient = void 0; @@ -20279,7 +19965,7 @@ exports.ActionListener = require('./ActionListener'); exports.Goal = require('./Goal'); exports.SimpleActionServer = require('./SimpleActionServer'); -},{"./ActionClient":84,"./ActionListener":85,"./Goal":86,"./SimpleActionServer":87}],89:[function(require,module,exports){ +},{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20307,6 +19993,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Ros = require('../core/Ros'); /** * A ROS 2 action client. + * @template TGoal, TFeedback, TResult */ var Action = /** @class */ (function (_super) { __extends(Action, _super); @@ -20328,11 +20015,11 @@ var Action = /** @class */ (function (_super) { } /** * @callback sendGoalResultCallback - * @param {Object} result - The result from the action. + * @param {TResult} result - The result from the action. */ /** * @callback sendGoalFeedbackCallback - * @param {Object} feedback - The feedback from the action. + * @param {TFeedback} feedback - The feedback from the action. */ /** * @callback sendGoalFailedCallback @@ -20343,7 +20030,7 @@ var Action = /** @class */ (function (_super) { * and the result in the result callback when the action is completed. * Does nothing if this action is currently advertised. * - * @param {ActionGoal} goal - The ROSLIB.ActionGoal to send. + * @param {TGoal} goal - The ROSLIB.ActionGoal to send. * @param {sendGoalResultCallback} resultCallback - The callback function when the action is completed. * @param {sendGoalFeedbackCallback} [feedbackCallback] - The callback function when the action pulishes feedback. * @param {sendGoalFailedCallback} [failedCallback] - The callback function when the action failed. @@ -20361,9 +20048,11 @@ var Action = /** @class */ (function (_super) { } } else if (message.op === 'action_feedback' && typeof feedbackCallback === 'function') { + // @ts-expect-error -- can't figure out how to get ActionFeedback to play nice in typescript here feedbackCallback(new ActionFeedback(message.values)); } else if (message.op === 'action_result' && typeof resultCallback === 'function') { + // @ts-expect-error -- can't figure out how to get ActionResult to play nice in typescript here resultCallback(new ActionResult(message.values)); } }); @@ -20394,7 +20083,7 @@ var Action = /** @class */ (function (_super) { }; /** * @callback advertiseCallback - * @param {ActionGoal} request - The action goal. + * @param {ActionGoal} request - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. @@ -20451,7 +20140,7 @@ var Action = /** @class */ (function (_super) { * Helper function to send action feedback inside an action handler. * * @param {string} id - The action goal ID. - * @param {ActionFeedback} feedback - The feedback to send. + * @param {ActionFeedback} feedback - The feedback to send. */ Action.prototype.sendFeedback = function (id, feedback) { var call = { @@ -20496,7 +20185,7 @@ var Action = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Action; -},{"../core/Ros":95,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"eventemitter2":13}],90:[function(require,module,exports){ +},{"../core/Ros":85,"./ActionFeedback":80,"./ActionGoal":81,"./ActionResult":82,"eventemitter2":16}],80:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20507,14 +20196,20 @@ var assign = require('object-assign'); * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionFeedback(values) { - assign(this, values || {}); -} +var ActionFeedback = /** @class */ (function () { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + function ActionFeedback(values) { + assign(this, values || {}); + } + return ActionFeedback; +}()); module.exports = ActionFeedback; -},{"object-assign":33}],91:[function(require,module,exports){ +},{"object-assign":31}],81:[function(require,module,exports){ "use strict"; /** * @fileoverview @@ -20525,14 +20220,20 @@ var assign = require('object-assign'); * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionGoal(values) { - assign(this, values || {}); -} +var ActionGoal = /** @class */ (function () { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + function ActionGoal(values) { + assign(this, values || {}); + } + return ActionGoal; +}()); module.exports = ActionGoal; -},{"object-assign":33}],92:[function(require,module,exports){ +},{"object-assign":31}],82:[function(require,module,exports){ "use strict"; /** * @fileoverview @@ -20543,14 +20244,20 @@ var assign = require('object-assign'); * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionResult(values) { - assign(this, values || {}); -} +var ActionResult = /** @class */ (function () { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + function ActionResult(values) { + assign(this, values || {}); + } + return ActionResult; +}()); module.exports = ActionResult; -},{"object-assign":33}],93:[function(require,module,exports){ +},{"object-assign":31}],83:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20574,7 +20281,7 @@ var Message = /** @class */ (function () { }()); module.exports = Message; -},{"object-assign":33}],94:[function(require,module,exports){ +},{"object-assign":31}],84:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20665,7 +20372,7 @@ var Param = /** @class */ (function () { }()); module.exports = Param; -},{"../core/Ros":95,"./Service":96,"./ServiceRequest":97}],95:[function(require,module,exports){ +},{"../core/Ros":85,"./Service":86,"./ServiceRequest":87}],85:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21479,7 +21186,7 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; -},{"../actionlib":88,"../tf":108,"../util/workerSocket":123,"./Param":94,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./SocketAdapter.js":99,"./Topic":100,"eventemitter2":13,"object-assign":33,"ws":81}],96:[function(require,module,exports){ +},{"../actionlib":78,"../tf":98,"../util/workerSocket":113,"./Param":84,"./Service":86,"./ServiceRequest":87,"./ServiceResponse":88,"./SocketAdapter.js":89,"./Topic":90,"eventemitter2":16,"object-assign":31,"ws":71}],86:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21506,7 +21213,7 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2; var Ros = require('../core/Ros'); /** * A ROS service client. - * @template T, U + * @template TRequest, TResponse */ var Service = /** @class */ (function (_super) { __extends(Service, _super); @@ -21527,7 +21234,7 @@ var Service = /** @class */ (function (_super) { } /** * @callback callServiceCallback - * @param {U} response - The response from the service request. + * @param {TResponse} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -21537,7 +21244,7 @@ var Service = /** @class */ (function (_super) { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {T} request - The ROSLIB.ServiceRequest to send. + * @param {TRequest} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ @@ -21570,7 +21277,7 @@ var Service = /** @class */ (function (_super) { }; /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. @@ -21624,7 +21331,7 @@ var Service = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Service; -},{"../core/Ros":95,"./ServiceRequest":97,"./ServiceResponse":98,"eventemitter2":13}],97:[function(require,module,exports){ +},{"../core/Ros":85,"./ServiceRequest":87,"./ServiceResponse":88,"eventemitter2":16}],87:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21648,7 +21355,7 @@ var ServiceRequest = /** @class */ (function () { }()); module.exports = ServiceRequest; -},{"object-assign":33}],98:[function(require,module,exports){ +},{"object-assign":31}],88:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21672,7 +21379,7 @@ var ServiceResponse = /** @class */ (function () { }()); module.exports = ServiceResponse; -},{"object-assign":33}],99:[function(require,module,exports){ +},{"object-assign":31}],89:[function(require,module,exports){ /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -21817,7 +21524,7 @@ function SocketAdapter(client) { } module.exports = SocketAdapter; -},{"../util/cborTypedArrayTags":121,"../util/decompressPng":122,"cbor-js":11}],100:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":111,"../util/decompressPng":112,"cbor-js":14}],90:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22049,7 +21756,7 @@ var Topic = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Topic; -},{"../core/Ros":95,"./Message":93,"eventemitter2":13}],101:[function(require,module,exports){ +},{"../core/Ros":85,"./Message":83,"eventemitter2":16}],91:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActionResult = exports.ActionFeedback = exports.ActionGoal = exports.Action = exports.ServiceResponse = exports.ServiceRequest = exports.Service = exports.Param = exports.Message = exports.Topic = exports.Ros = void 0; @@ -22065,7 +21772,7 @@ exports.ActionGoal = require('./ActionGoal'); exports.ActionFeedback = require('./ActionFeedback'); exports.ActionResult = require('./ActionResult'); -},{"./Action":89,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"./Message":93,"./Param":94,"./Ros":95,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./Topic":100}],102:[function(require,module,exports){ +},{"./Action":79,"./ActionFeedback":80,"./ActionGoal":81,"./ActionResult":82,"./Message":83,"./Param":84,"./Ros":85,"./Service":86,"./ServiceRequest":87,"./ServiceResponse":88,"./Topic":90}],92:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22141,7 +21848,7 @@ var Pose = /** @class */ (function () { }()); module.exports = Pose; -},{"./Quaternion":103,"./Transform":104,"./Vector3":105}],103:[function(require,module,exports){ +},{"./Quaternion":93,"./Transform":94,"./Vector3":95}],93:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22232,7 +21939,7 @@ var Quaternion = /** @class */ (function () { }()); module.exports = Quaternion; -},{}],104:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22266,7 +21973,7 @@ var Transform = /** @class */ (function () { }()); module.exports = Transform; -},{"./Quaternion":103,"./Vector3":105}],105:[function(require,module,exports){ +},{"./Quaternion":93,"./Vector3":95}],95:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22335,7 +22042,7 @@ var Vector3 = /** @class */ (function () { }()); module.exports = Vector3; -},{"./Quaternion":103}],106:[function(require,module,exports){ +},{"./Quaternion":93}],96:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Vector3 = exports.Transform = exports.Quaternion = exports.Pose = void 0; @@ -22344,7 +22051,7 @@ exports.Quaternion = require('./Quaternion'); exports.Transform = require('./Transform'); exports.Vector3 = require('./Vector3'); -},{"./Pose":102,"./Quaternion":103,"./Transform":104,"./Vector3":105}],107:[function(require,module,exports){ +},{"./Pose":92,"./Quaternion":93,"./Transform":94,"./Vector3":95}],97:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22583,13 +22290,13 @@ var TFClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = TFClient; -},{"../actionlib/ActionClient":84,"../actionlib/Goal":86,"../core/Ros":95,"../core/Service.js":96,"../core/ServiceRequest.js":97,"../core/Topic.js":100,"../math/Transform":104,"eventemitter2":13}],108:[function(require,module,exports){ +},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":85,"../core/Service.js":86,"../core/ServiceRequest.js":87,"../core/Topic.js":90,"../math/Transform":94,"eventemitter2":16}],98:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TFClient = void 0; exports.TFClient = require('./TFClient'); -},{"./TFClient":107}],109:[function(require,module,exports){ +},{"./TFClient":97}],99:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22622,7 +22329,7 @@ var UrdfBox = /** @class */ (function () { }()); module.exports = UrdfBox; -},{"../math/Vector3":105,"./UrdfTypes":118}],110:[function(require,module,exports){ +},{"../math/Vector3":95,"./UrdfTypes":108}],100:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22650,7 +22357,7 @@ var UrdfColor = /** @class */ (function () { }()); module.exports = UrdfColor; -},{}],111:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22677,7 +22384,7 @@ var UrdfCylinder = /** @class */ (function () { }()); module.exports = UrdfCylinder; -},{"./UrdfTypes":118}],112:[function(require,module,exports){ +},{"./UrdfTypes":108}],102:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22766,7 +22473,7 @@ var UrdfJoint = /** @class */ (function () { }()); module.exports = UrdfJoint; -},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105}],113:[function(require,module,exports){ +},{"../math/Pose":92,"../math/Quaternion":93,"../math/Vector3":95}],103:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22796,7 +22503,7 @@ var UrdfLink = /** @class */ (function () { }()); module.exports = UrdfLink; -},{"./UrdfVisual":119}],114:[function(require,module,exports){ +},{"./UrdfVisual":109}],104:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22841,7 +22548,7 @@ var UrdfMaterial = /** @class */ (function () { var assign = require('object-assign'); module.exports = UrdfMaterial; -},{"./UrdfColor":110,"object-assign":33}],115:[function(require,module,exports){ +},{"./UrdfColor":100,"object-assign":31}],105:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22878,7 +22585,7 @@ var UrdfMesh = /** @class */ (function () { }()); module.exports = UrdfMesh; -},{"../math/Vector3":105,"./UrdfTypes":118}],116:[function(require,module,exports){ +},{"../math/Vector3":95,"./UrdfTypes":108}],106:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22979,7 +22686,7 @@ var UrdfModel = /** @class */ (function () { }()); module.exports = UrdfModel; -},{"./UrdfJoint":112,"./UrdfLink":113,"./UrdfMaterial":114,"@xmldom/xmldom":80}],117:[function(require,module,exports){ +},{"./UrdfJoint":102,"./UrdfLink":103,"./UrdfMaterial":104,"@xmldom/xmldom":70}],107:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -23003,7 +22710,7 @@ var UrdfSphere = /** @class */ (function () { }()); module.exports = UrdfSphere; -},{"./UrdfTypes":118}],118:[function(require,module,exports){ +},{"./UrdfTypes":108}],108:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.URDF_MESH = exports.URDF_CYLINDER = exports.URDF_BOX = exports.URDF_SPHERE = void 0; @@ -23012,7 +22719,7 @@ exports.URDF_BOX = 1; exports.URDF_CYLINDER = 2; exports.URDF_MESH = 3; -},{}],119:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -23147,7 +22854,7 @@ var UrdfVisual = /** @class */ (function () { }()); module.exports = UrdfVisual; -},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105,"./UrdfBox":109,"./UrdfCylinder":111,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfSphere":117}],120:[function(require,module,exports){ +},{"../math/Pose":92,"../math/Quaternion":93,"../math/Vector3":95,"./UrdfBox":99,"./UrdfCylinder":101,"./UrdfMaterial":104,"./UrdfMesh":105,"./UrdfSphere":107}],110:[function(require,module,exports){ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -23176,7 +22883,7 @@ exports.UrdfSphere = require('./UrdfSphere'); exports.UrdfVisual = require('./UrdfVisual'); __exportStar(require("./UrdfTypes"), exports); -},{"./UrdfBox":109,"./UrdfColor":110,"./UrdfCylinder":111,"./UrdfLink":113,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfModel":116,"./UrdfSphere":117,"./UrdfTypes":118,"./UrdfVisual":119}],121:[function(require,module,exports){ +},{"./UrdfBox":99,"./UrdfColor":100,"./UrdfCylinder":101,"./UrdfLink":103,"./UrdfMaterial":104,"./UrdfMesh":105,"./UrdfModel":106,"./UrdfSphere":107,"./UrdfTypes":108,"./UrdfVisual":109}],111:[function(require,module,exports){ 'use strict'; var UPPER32 = Math.pow(2, 32); var warnedPrecision = false; @@ -23280,7 +22987,7 @@ if (typeof module !== 'undefined' && module.exports) { module.exports = cborTypedArrayTagger; } -},{}],122:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ (function (Buffer){(function (){ /** * @fileOverview @@ -23316,7 +23023,7 @@ function decompressPng(data, callback) { module.exports = decompressPng; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":8,"pngparse":50}],123:[function(require,module,exports){ +},{"buffer":11,"pngparse":43}],113:[function(require,module,exports){ "use strict"; try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now @@ -23375,7 +23082,7 @@ var WorkerSocket = /** @class */ (function () { }()); module.exports = WorkerSocket; -},{"./workerSocketImpl":124,"webworkify":78,"webworkify-webpack":77}],124:[function(require,module,exports){ +},{"./workerSocketImpl":114,"webworkify":68,"webworkify-webpack":67}],114:[function(require,module,exports){ "use strict"; var WebSocket = WebSocket || require('ws'); module.exports = function (self) { @@ -23422,4 +23129,4 @@ module.exports = function (self) { }); }; -},{"ws":81}]},{},[83]); +},{"ws":71}]},{},[73]); diff --git a/build/roslib.min.js b/build/roslib.min.js index e4c365fd9..36e43f246 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&O.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):O.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&O.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),O.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,T("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var k=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return O(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function O(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function O(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return T});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function O(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&O(t)<=O(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(T(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(T(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,O,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,r.check=U(r.check,O,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(O[0]=255&c,O[1]=c>>>8&255,r.check=U(r.check,O,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=U(r.check,O,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(P(I,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;P(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],T[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=c=1<>k)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(O=0!==l?(O&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)J(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,O);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,O,T=i.createInflate(),c=0,u=0,f=new P(13),e=2,R=-1,j=0,L=0,M=0;function U(e){return o.destroy&&o.destroy(),T.destroy&&T.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,O,b,l))}o.on("error",U),T.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),T.on("end",function(){return T.destroy&&T.destroy(),j!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return U(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));L=s/3,A=new P(s),c=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));O++,x=new P(M=s),c=4;break;case"IDAT":b=b||new P(p*a*O),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(j===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return U(new Error("Invalid palette index."));switch(O){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function O(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs} request - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. @@ -164,7 +167,7 @@ class Action extends EventEmitter2 { * Helper function to send action feedback inside an action handler. * * @param {string} id - The action goal ID. - * @param {ActionFeedback} feedback - The feedback to send. + * @param {ActionFeedback} feedback - The feedback to send. */ sendFeedback(id, feedback) { var call = { diff --git a/src/core/ActionFeedback.js b/src/core/ActionFeedback.js index 21da0f5a4..69b0ff68d 100644 --- a/src/core/ActionFeedback.js +++ b/src/core/ActionFeedback.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionFeedback(values) { - assign(this, values || {}); +class ActionFeedback { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + constructor(values) { + assign(this, values || {}); + } } module.exports = ActionFeedback; diff --git a/src/core/ActionGoal.js b/src/core/ActionGoal.js index 27fb9f151..9f5ccdc0a 100644 --- a/src/core/ActionGoal.js +++ b/src/core/ActionGoal.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionGoal(values) { - assign(this, values || {}); +class ActionGoal { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + constructor(values) { + assign(this, values || {}); + } } module.exports = ActionGoal; diff --git a/src/core/ActionResult.js b/src/core/ActionResult.js index bf028c642..7d6a810de 100644 --- a/src/core/ActionResult.js +++ b/src/core/ActionResult.js @@ -9,10 +9,15 @@ var assign = require('object-assign'); * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @param {Object} [values={}] - Object matching the fields defined in the .action definition file. + * @template T */ -function ActionResult(values) { - assign(this, values || {}); +class ActionResult { + /** + * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + */ + constructor(values) { + assign(this, values || {}); + } } module.exports = ActionResult; diff --git a/src/core/Service.js b/src/core/Service.js index c4affcced..22b9fa237 100644 --- a/src/core/Service.js +++ b/src/core/Service.js @@ -10,7 +10,7 @@ var Ros = require('../core/Ros'); /** * A ROS service client. - * @template T, U + * @template TRequest, TResponse */ class Service extends EventEmitter2 { /** @@ -30,7 +30,7 @@ class Service extends EventEmitter2 { } /** * @callback callServiceCallback - * @param {U} response - The response from the service request. + * @param {TResponse} response - The response from the service request. */ /** * @callback callServiceFailedCallback @@ -40,7 +40,7 @@ class Service extends EventEmitter2 { * Call the service. Returns the service response in the * callback. Does nothing if this service is currently advertised. * - * @param {T} request - The ROSLIB.ServiceRequest to send. + * @param {TRequest} request - The ROSLIB.ServiceRequest to send. * @param {callServiceCallback} [callback] - Function with the following params: * @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params: */ @@ -76,7 +76,7 @@ class Service extends EventEmitter2 { } /** * @callback advertiseCallback - * @param {ServiceRequest} request - The service request. + * @param {ServiceRequest} request - The service request. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the service has finished successfully, * i.e., without any fatal errors. From 562dfdea70cf7e178d0d45e9e60953dd60ec58dd Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Tue, 28 Nov 2023 12:40:54 -0700 Subject: [PATCH 57/66] Put ES5 module exports back not sure why they didn't work before --- build/RosLib.d.ts | 54 ++++++++++++-- build/RosLibNode.d.ts | 39 ++++++++-- build/actionlib/index.d.ts | 8 +- build/core/index.d.ts | 14 ++-- build/math/index.d.ts | 8 +- build/roslib.js | 145 +++++++++++++++---------------------- build/roslib.min.js | 2 +- build/tf/index.d.ts | 2 +- build/urdf/UrdfTypes.d.ts | 8 +- build/urdf/index.d.ts | 26 ++++--- src/RosLib.js | 28 ++----- src/RosLibNode.js | 17 +++-- src/actionlib/index.js | 10 ++- src/core/index.js | 16 ++-- src/math/index.js | 10 ++- src/tf/index.js | 4 +- src/urdf/UrdfTypes.js | 10 ++- src/urdf/index.js | 22 +++--- 18 files changed, 234 insertions(+), 189 deletions(-) diff --git a/build/RosLib.d.ts b/build/RosLib.d.ts index 750ffcd22..d5c5f381d 100644 --- a/build/RosLib.d.ts +++ b/build/RosLib.d.ts @@ -1,5 +1,49 @@ -export * from "./core"; -export * from "./actionlib"; -export * from "./math"; -export * from "./tf"; -export * from "./urdf"; +export = ROSLIB; +/** + * @fileOverview + * @author Russell Toris - rctoris@wpi.edu + */ +/** + * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. + * + * If you use nodejs, this is the variable you get when you require('roslib'). + */ +declare var ROSLIB: { + URDF_SPHERE: number; + URDF_BOX: number; + URDF_CYLINDER: number; + URDF_MESH: number; + UrdfBox: typeof import("./urdf/UrdfBox"); + UrdfColor: typeof import("./urdf/UrdfColor"); + UrdfCylinder: typeof import("./urdf/UrdfCylinder"); + UrdfLink: typeof import("./urdf/UrdfLink"); + UrdfMaterial: typeof import("./urdf/UrdfMaterial"); + UrdfMesh: typeof import("./urdf/UrdfMesh"); + UrdfModel: typeof import("./urdf/UrdfModel"); /** + * @default + * @description Library version + */ + UrdfSphere: typeof import("./urdf/UrdfSphere"); + UrdfVisual: typeof import("./urdf/UrdfVisual"); + TFClient: typeof import("./tf/TFClient"); + Pose: typeof import("./math/Pose"); + Quaternion: typeof import("./math/Quaternion"); + Transform: typeof import("./math/Transform"); + Vector3: typeof import("./math/Vector3"); + ActionClient: typeof import("./actionlib/ActionClient"); + ActionListener: typeof import("./actionlib/ActionListener"); + Goal: typeof import("./actionlib/Goal"); + SimpleActionServer: typeof import("./actionlib/SimpleActionServer"); + Ros: typeof import("./core/Ros"); + Topic: typeof import("./core/Topic"); + Message: typeof import("./core/Message"); + Param: typeof import("./core/Param"); + Service: typeof import("./core/Service"); + ServiceRequest: typeof import("./core/ServiceRequest"); + ServiceResponse: typeof import("./core/ServiceResponse"); + /** + * @default + * @description Library version + */ + REVISION: string; +}; diff --git a/build/RosLibNode.d.ts b/build/RosLibNode.d.ts index 744d6069e..9880dd61f 100644 --- a/build/RosLibNode.d.ts +++ b/build/RosLibNode.d.ts @@ -1,7 +1,32 @@ -export * from "./core"; -export * from "./actionlib"; -export * from "./math"; -export * from "./tf"; -export * from "./urdf"; -export const Ros: typeof import("./node/RosTCP"); -export const Topic: typeof import("./node/TopicStream"); +declare const _exports: { + Ros: typeof import("./node/RosTCP"); + Topic: typeof import("./node/TopicStream"); + URDF_SPHERE: number; + URDF_BOX: number; + URDF_CYLINDER: number; + URDF_MESH: number; + UrdfBox: typeof import("./urdf/UrdfBox"); + UrdfColor: typeof import("./urdf/UrdfColor"); + UrdfCylinder: typeof import("./urdf/UrdfCylinder"); + UrdfLink: typeof import("./urdf/UrdfLink"); + UrdfMaterial: typeof import("./urdf/UrdfMaterial"); + UrdfMesh: typeof import("./urdf/UrdfMesh"); + UrdfModel: typeof import("./urdf/UrdfModel"); + UrdfSphere: typeof import("./urdf/UrdfSphere"); + UrdfVisual: typeof import("./urdf/UrdfVisual"); + TFClient: typeof import("./tf/TFClient"); + Pose: typeof import("./math/Pose"); + Quaternion: typeof import("./math/Quaternion"); + Transform: typeof import("./math/Transform"); + Vector3: typeof import("./math/Vector3"); + ActionClient: typeof import("./actionlib/ActionClient"); + ActionListener: typeof import("./actionlib/ActionListener"); + Goal: typeof import("./actionlib/Goal"); + SimpleActionServer: typeof import("./actionlib/SimpleActionServer"); + Message: typeof import("./core/Message"); + Param: typeof import("./core/Param"); + Service: typeof import("./core/Service"); + ServiceRequest: typeof import("./core/ServiceRequest"); + ServiceResponse: typeof import("./core/ServiceResponse"); +}; +export = _exports; diff --git a/build/actionlib/index.d.ts b/build/actionlib/index.d.ts index 96cc884d7..c5b9e1cba 100644 --- a/build/actionlib/index.d.ts +++ b/build/actionlib/index.d.ts @@ -1,4 +1,4 @@ -export const ActionClient: typeof import("./ActionClient"); -export const ActionListener: typeof import("./ActionListener"); -export const Goal: typeof import("./Goal"); -export const SimpleActionServer: typeof import("./SimpleActionServer"); +export let ActionClient: typeof import("./ActionClient"); +export let ActionListener: typeof import("./ActionListener"); +export let Goal: typeof import("./Goal"); +export let SimpleActionServer: typeof import("./SimpleActionServer"); diff --git a/build/core/index.d.ts b/build/core/index.d.ts index 6b984016c..9d692235d 100644 --- a/build/core/index.d.ts +++ b/build/core/index.d.ts @@ -1,7 +1,7 @@ -export const Ros: typeof import("./Ros"); -export const Topic: typeof import("./Topic"); -export const Message: typeof import("./Message"); -export const Param: typeof import("./Param"); -export const Service: typeof import("./Service"); -export const ServiceRequest: typeof import("./ServiceRequest"); -export const ServiceResponse: typeof import("./ServiceResponse"); +export let Ros: typeof import("./Ros"); +export let Topic: typeof import("./Topic"); +export let Message: typeof import("./Message"); +export let Param: typeof import("./Param"); +export let Service: typeof import("./Service"); +export let ServiceRequest: typeof import("./ServiceRequest"); +export let ServiceResponse: typeof import("./ServiceResponse"); diff --git a/build/math/index.d.ts b/build/math/index.d.ts index 78fb6c552..72e1086d9 100644 --- a/build/math/index.d.ts +++ b/build/math/index.d.ts @@ -1,4 +1,4 @@ -export const Pose: typeof import("./Pose"); -export const Quaternion: typeof import("./Quaternion"); -export const Transform: typeof import("./Transform"); -export const Vector3: typeof import("./Vector3"); +export let Pose: typeof import("./Pose"); +export let Quaternion: typeof import("./Quaternion"); +export let Transform: typeof import("./Transform"); +export let Vector3: typeof import("./Vector3"); diff --git a/build/roslib.js b/build/roslib.js index 258118738..367722bd2 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -19305,52 +19305,35 @@ module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; },{}],72:[function(require,module,exports){ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); /** * @fileOverview * @author Russell Toris - rctoris@wpi.edu */ -__exportStar(require("./core"), exports); -__exportStar(require("./actionlib"), exports); -__exportStar(require("./math"), exports); -__exportStar(require("./tf"), exports); -__exportStar(require("./urdf"), exports); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; /** * If you use roslib in a browser, all the classes will be exported to a global variable called ROSLIB. * * If you use nodejs, this is the variable you get when you require('roslib'). */ -// @ts-expect-error -- global browser-only shenanigans -var ROSLIB = this.ROSLIB || { +var ROSLIB = __assign(__assign(__assign(__assign(__assign({ /** * @default * @description Library version */ - REVISION: '1.3.0' -}; -var assign = require('object-assign'); -// Add core components -assign(ROSLIB, require('./core')); -assign(ROSLIB, require('./actionlib')); -assign(ROSLIB, require('./math')); -assign(ROSLIB, require('./tf')); -assign(ROSLIB, require('./urdf')); - -},{"./actionlib":78,"./core":87,"./math":92,"./tf":94,"./urdf":106,"object-assign":31}],73:[function(require,module,exports){ + REVISION: '1.3.0' }, require('./core')), require('./actionlib')), require('./math')), require('./tf')), require('./urdf')); +module.exports = ROSLIB; + +},{"./actionlib":78,"./core":87,"./math":92,"./tf":94,"./urdf":106}],73:[function(require,module,exports){ (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); @@ -19958,12 +19941,12 @@ module.exports = SimpleActionServer; },{"../core/Message":79,"../core/Ros":81,"../core/Topic":86,"eventemitter2":16}],78:[function(require,module,exports){ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SimpleActionServer = exports.Goal = exports.ActionListener = exports.ActionClient = void 0; -exports.ActionClient = require('./ActionClient'); -exports.ActionListener = require('./ActionListener'); -exports.Goal = require('./Goal'); -exports.SimpleActionServer = require('./SimpleActionServer'); +module.exports = { + ActionClient: require('./ActionClient'), + ActionListener: require('./ActionListener'), + Goal: require('./Goal'), + SimpleActionServer: require('./SimpleActionServer') +}; },{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ "use strict"; @@ -21461,15 +21444,15 @@ module.exports = Topic; },{"../core/Ros":81,"./Message":79,"eventemitter2":16}],87:[function(require,module,exports){ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ServiceResponse = exports.ServiceRequest = exports.Service = exports.Param = exports.Message = exports.Topic = exports.Ros = void 0; -exports.Ros = require('./Ros'); -exports.Topic = require('./Topic'); -exports.Message = require('./Message'); -exports.Param = require('./Param'); -exports.Service = require('./Service'); -exports.ServiceRequest = require('./ServiceRequest'); -exports.ServiceResponse = require('./ServiceResponse'); +module.exports = { + Ros: require('./Ros'), + Topic: require('./Topic'), + Message: require('./Message'), + Param: require('./Param'), + Service: require('./Service'), + ServiceRequest: require('./ServiceRequest'), + ServiceResponse: require('./ServiceResponse') +}; },{"./Message":79,"./Param":80,"./Ros":81,"./Service":82,"./ServiceRequest":83,"./ServiceResponse":84,"./Topic":86}],88:[function(require,module,exports){ "use strict"; @@ -21743,12 +21726,12 @@ module.exports = Vector3; },{"./Quaternion":89}],92:[function(require,module,exports){ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Vector3 = exports.Transform = exports.Quaternion = exports.Pose = void 0; -exports.Pose = require('./Pose'); -exports.Quaternion = require('./Quaternion'); -exports.Transform = require('./Transform'); -exports.Vector3 = require('./Vector3'); +module.exports = { + Pose: require('./Pose'), + Quaternion: require('./Quaternion'), + Transform: require('./Transform'), + Vector3: require('./Vector3') +}; },{"./Pose":88,"./Quaternion":89,"./Transform":90,"./Vector3":91}],93:[function(require,module,exports){ "use strict"; @@ -21991,9 +21974,9 @@ module.exports = TFClient; },{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":81,"../core/Service.js":82,"../core/ServiceRequest.js":83,"../core/Topic.js":86,"../math/Transform":90,"eventemitter2":16}],94:[function(require,module,exports){ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TFClient = void 0; -exports.TFClient = require('./TFClient'); +module.exports = { + TFClient: require('./TFClient') +}; },{"./TFClient":93}],95:[function(require,module,exports){ "use strict"; @@ -22411,12 +22394,12 @@ module.exports = UrdfSphere; },{"./UrdfTypes":104}],104:[function(require,module,exports){ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.URDF_MESH = exports.URDF_CYLINDER = exports.URDF_BOX = exports.URDF_SPHERE = void 0; -exports.URDF_SPHERE = 0; -exports.URDF_BOX = 1; -exports.URDF_CYLINDER = 2; -exports.URDF_MESH = 3; +module.exports = { + URDF_SPHERE: 0, + URDF_BOX: 1, + URDF_CYLINDER: 2, + URDF_MESH: 3 +}; },{}],105:[function(require,module,exports){ "use strict"; @@ -22555,32 +22538,18 @@ module.exports = UrdfVisual; },{"../math/Pose":88,"../math/Quaternion":89,"../math/Vector3":91,"./UrdfBox":95,"./UrdfCylinder":97,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfSphere":103}],106:[function(require,module,exports){ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); }; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UrdfVisual = exports.UrdfSphere = exports.UrdfModel = exports.UrdfMesh = exports.UrdfMaterial = exports.UrdfLink = exports.UrdfCylinder = exports.UrdfColor = exports.UrdfBox = void 0; -exports.UrdfBox = require('./UrdfBox'); -exports.UrdfColor = require('./UrdfColor'); -exports.UrdfCylinder = require('./UrdfCylinder'); -exports.UrdfLink = require('./UrdfLink'); -exports.UrdfMaterial = require('./UrdfMaterial'); -exports.UrdfMesh = require('./UrdfMesh'); -exports.UrdfModel = require('./UrdfModel'); -exports.UrdfSphere = require('./UrdfSphere'); -exports.UrdfVisual = require('./UrdfVisual'); -__exportStar(require("./UrdfTypes"), exports); +module.exports = __assign({ UrdfBox: require('./UrdfBox'), UrdfColor: require('./UrdfColor'), UrdfCylinder: require('./UrdfCylinder'), UrdfLink: require('./UrdfLink'), UrdfMaterial: require('./UrdfMaterial'), UrdfMesh: require('./UrdfMesh'), UrdfModel: require('./UrdfModel'), UrdfSphere: require('./UrdfSphere'), UrdfVisual: require('./UrdfVisual') }, require('./UrdfTypes')); },{"./UrdfBox":95,"./UrdfColor":96,"./UrdfCylinder":97,"./UrdfLink":99,"./UrdfMaterial":100,"./UrdfMesh":101,"./UrdfModel":102,"./UrdfSphere":103,"./UrdfTypes":104,"./UrdfVisual":105}],107:[function(require,module,exports){ 'use strict'; diff --git a/build/roslib.min.js b/build/roslib.min.js index 16f87041e..430202b06 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(b[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,I,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+m,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function U(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(U(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=P,t.deflateResetKeep=N,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(U(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(U(e),e.lookahead<=m&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,U(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=U(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=U(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=U(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=U(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=U(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(P(I,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;P(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=P(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===m){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=P(I,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=P(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,N(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[u&(1<>>16&255,m=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[U+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)P(e,2+(n?1:0),3),H(e,k,T);else{P(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(P(l,t-257,5),P(l,r-1,5),P(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){P(e,2,3),I(e,b,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(P){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new P("89504e470d0a1a0a","hex");function N(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}N.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new P(13),e=2,R=-1,L=0,j=0,M=0;function U(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new N(p,a,T,b,l))}o.on("error",U),O.on("error",U),o.on("end",function(){return o.destroy(),b&&l?r():U(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==b.length?U(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return U(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return U(new Error("Invalid PLTE size."));j=s/3,A=new P(s),u=3}break;case"tRNS":if(3!==g)return U(new Error("tRNS for non-paletted images not yet supported."));T++,x=new P(M=s),u=4;break;case"IDAT":b=b||new P(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return U(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return U(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===b.length)return U(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return U(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[L++]=w[0]*y;break;case 2:b[L++]=w[0]*y,b[L++]=w[1]*y,b[L++]=w[2]*y;break;case 3:if(w[0]>=j)return U(new Error("Invalid palette index."));switch(T){case 1:b[L++]=A[3*w[0]];break;case 2:b[L++]=A[3*w[0]],b[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(I,t,e))}function I(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function P(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new b),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new b),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||m,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(k,o),k.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},k.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},k.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},k.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},k.prototype.close=function(e){A(this,e),T.nextTick(x,this)},k.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},k.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw A(this),new RangeError(b);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,k),e.inherits(p,k),e.inherits(d,k),e.inherits(_,k),e.inherits(v,k),e.inherits(w,k),e.inherits(E,k)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var k=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return k.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=S(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,B=-1,C=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,S=2,k=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?k:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:S}(n,t):a[n.level].func(n,t);if(s!==k&&s!==A||(n.status=666),s===E||s===k)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===S&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,B):C}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):C}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},S=I(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},S=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,S){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},S=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,S){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(x=r.lencode[u&(1<>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(x=r.distcode[u&(1<>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-k),v=u=1<>k)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,S=0,k=0;k<=x;k++)y.bl_count[k]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,k,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,k),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,S,k,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?S[R]:(o=E[R-_],s=S[R],a=S[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+k))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=A[3*w[0]];break;case 2:m[L++]=A[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(S<=(r=e)?r=S:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs Date: Tue, 28 Nov 2023 16:29:38 -0500 Subject: [PATCH 58/66] Fix Action advertise types --- build/core/Action.d.ts | 7 +++---- build/roslib.js | 2 +- src/core/Action.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index e4958c34c..64301616c 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -19,7 +19,7 @@ declare class Action extends EventEmitter2 { name: string; actionType: string; isAdvertised: boolean; - _actionCallback: ((request: ActionGoal, response: any) => any) | null; + _actionCallback: ((goal: TGoal, response: any) => any) | null; _cancelCallback: any; /** * @callback sendGoalResultCallback @@ -52,7 +52,7 @@ declare class Action extends EventEmitter2 { cancelGoal(id: string): void; /** * @callback advertiseCallback - * @param {ActionGoal} request - The action goal. + * @param {TGoal} goal - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. @@ -63,7 +63,7 @@ declare class Action extends EventEmitter2 { * * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. */ - advertise(callback: (request: ActionGoal, response: any) => any): void; + advertise(callback: (goal: TGoal, response: any) => any): void; /** * Unadvertise a previously advertised action. */ @@ -103,6 +103,5 @@ declare class Action extends EventEmitter2 { import EventEmitter2_1 = require("eventemitter2"); import EventEmitter2 = EventEmitter2_1.EventEmitter2; import Ros = require("../core/Ros"); -import ActionGoal = require("./ActionGoal"); import ActionFeedback = require("./ActionFeedback"); import ActionResult = require("./ActionResult"); diff --git a/build/roslib.js b/build/roslib.js index 64c9ef96a..ced8a37d1 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -20066,7 +20066,7 @@ var Action = /** @class */ (function (_super) { }; /** * @callback advertiseCallback - * @param {ActionGoal} request - The action goal. + * @param {TGoal} goal - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. diff --git a/src/core/Action.js b/src/core/Action.js index 05d4328ed..a23314771 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -105,7 +105,7 @@ class Action extends EventEmitter2 { /** * @callback advertiseCallback - * @param {ActionGoal} request - The action goal. + * @param {TGoal} goal - The action goal. * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. * It should return true if the action has finished successfully, * i.e., without any fatal errors. From 102603d7853f41e34a58c58b7666436f68470342 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 13 Dec 2023 16:45:19 -0500 Subject: [PATCH 59/66] Add action cancellation callback --- build/core/Action.d.ts | 21 +- build/roslib.js | 10938 ++++++++++++++++++++------------------- build/roslib.min.js | 2 +- pnpm-lock.yaml | 4309 +++++++++++++++ src/core/Action.js | 32 +- 5 files changed, 9978 insertions(+), 5324 deletions(-) create mode 100644 pnpm-lock.yaml diff --git a/build/core/Action.d.ts b/build/core/Action.d.ts index 64301616c..c68ab34d6 100644 --- a/build/core/Action.d.ts +++ b/build/core/Action.d.ts @@ -19,11 +19,11 @@ declare class Action extends EventEmitter2 { name: string; actionType: string; isAdvertised: boolean; - _actionCallback: ((goal: TGoal, response: any) => any) | null; - _cancelCallback: any; + _actionCallback: ((goal: TGoal, id: string) => any) | null; + _cancelCallback: ((id: string) => any) | null; /** * @callback sendGoalResultCallback - * @param {TResult} result - The result from the action. + * @param {TResult} result - The result from the action. */ /** * @callback sendGoalFeedbackCallback @@ -51,19 +51,22 @@ declare class Action extends EventEmitter2 { */ cancelGoal(id: string): void; /** - * @callback advertiseCallback + * @callback advertiseActionCallback * @param {TGoal} goal - The action goal. - * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the action has finished successfully, - * i.e., without any fatal errors. + * @param {string} id - The ID of the action goal to execute. + */ + /** + * @callback advertiseCancelCallback + * @param {string} id - The ID of the action goal to cancel. */ /** * Advertise the action. This turns the Action object from a client * into a server. The callback will be called with every goal sent to this action. * - * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. + * @param {advertiseActionCallback} actionCallback - This works similarly to the callback for a C++ action. + * @param {advertiseCancelCallback} cancelCallback - A callback function to execute when the action is canceled. */ - advertise(callback: (goal: TGoal, response: any) => any): void; + advertise(actionCallback: (goal: TGoal, id: string) => any, cancelCallback: (id: string) => any): void; /** * Unadvertise a previously advertised action. */ diff --git a/build/roslib.js b/build/roslib.js index ced8a37d1..5d49df2c4 100644 --- a/build/roslib.js +++ b/build/roslib.js @@ -2,7 +2,7 @@ (function (global){(function (){ 'use strict'; -var objectAssign = require('object-assign'); +var objectAssign = require('object.assign/polyfill')(); // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: @@ -508,3687 +508,3062 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":31,"util/":4}],2:[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 - } -} +},{"object.assign/polyfill":38,"util/":73}],2:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; -},{}],3:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],4:[function(require,module,exports){ -(function (process,global){(function (){ -// 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. +var possibleNames = [ + 'BigInt64Array', + 'BigUint64Array', + 'Float32Array', + 'Float64Array', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray' +]; -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } +var g = typeof globalThis === 'undefined' ? global : globalThis; - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; +module.exports = function availableTypedArrays() { + var out = []; + for (var i = 0; i < possibleNames.length; i++) { + if (typeof g[possibleNames[i]] === 'function') { + out[out.length] = possibleNames[i]; + } + } + return out; }; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],3:[function(require,module,exports){ +'use strict' -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray - if (process.noDeprecation === true) { - return fn; - } +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} - return deprecated; -}; +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 +function getLens (b64) { + var len = b64.length -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') } - return debugs[set]; -}; + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] } -exports.inspect = inspect; +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; + var curByte = 0 - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } -function stylizeNoColor(str, styleType) { - return str; -} + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } -function arrayToHash(array) { - var hash = {}; + return arr +} - array.forEach(function(val, idx) { - hash[val] = true; - }); +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} - return hash; +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + 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 parts = [] + var maxChunkLength = 16383 // must be multiple of 3 -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; + // 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))) } - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) } - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); + return parts.join('') +} - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } +},{}],4:[function(require,module,exports){ - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } +},{}],5:[function(require,module,exports){ +(function (process,Buffer){(function (){ +'use strict'; +/* eslint camelcase: "off" */ - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } +var assert = require('assert'); - var base = '', array = false, braces = ['{', '}']; +var Zstream = require('pako/lib/zlib/zstream'); +var zlib_deflate = require('pako/lib/zlib/deflate.js'); +var zlib_inflate = require('pako/lib/zlib/inflate.js'); +var constants = require('pako/lib/zlib/constants'); - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } +for (var key in constants) { + exports[key] = constants[key]; +} - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); } - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; +} - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } + this.pending_close = false; - ctx.seen.push(value); + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); } - ctx.seen.pop(); + this.mode = exports.NONE; - return reduceToSingleString(output, base, braces); -} + this.dictionary = null; +}; +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +}; -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +}; +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); + this.write_in_progress = true; -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} + assert.equal(false, flush === undefined, 'must provide flush value'); + this.write_in_progress = true; -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); } - return name + ': ' + str; -} + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; + } + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); + if (!async) { + // sync version + this._process(); - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; + if (this._checkError()) { + return this._afterSync(); + } + return; } - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} + // async version + var self = this; + process.nextTick(function () { + self._process(); + self._after(); + }); + return this; +}; -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; + this.write_in_progress = false; -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; + return [avail_in, avail_out]; +}; -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; +Zlib.prototype._process = function () { + var next_expected_header_byte = null; -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush -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 = require('./support/isBuffer'); + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. -function objectToString(o) { - return Object.prototype.toString.call(o); -} + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} + return true; +}; +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} + this.write_in_progress = false; + // call the write() cb + this.callback(avail_in, avail_out); -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); + if (this.pending_close) { + this.close(); + } }; +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; + } + this.onerror(message, this.err -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); } - return origin; }; -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":3,"_process":44,"inherits":2}],5:[function(require,module,exports){ -(function (global){(function (){ -'use strict'; + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); -var possibleNames = [ - 'BigInt64Array', - 'BigUint64Array', - 'Float32Array', - 'Float64Array', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray' -]; + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); -var g = typeof globalThis === 'undefined' ? global : globalThis; + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); -module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - return out; + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); }; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],6:[function(require,module,exports){ -'use strict' +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} + this.flush = exports.Z_NO_FLUSH; -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 + this.err = exports.Z_OK; -function getLens (b64) { - var len = b64.length + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') + if (this.mode === exports.UNZIP) { + this.windowBits += 32; } - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) + this.strm = new Zstream(); - return [validLen, placeHoldersLen] -} + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); + } -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + if (this.err !== exports.Z_OK) { + this._error('Init error'); + } -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + this.dictionary = dictionary; -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen + this.write_in_progress = false; + this.init_done = true; +}; - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; } - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } + this.err = exports.Z_OK; - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; } - 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) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); } - 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 parts = [] - var maxChunkLength = 16383 // must be multiple of 3 +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; - // 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))) + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; } - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); } +}; - return parts.join('') -} - -},{}],7:[function(require,module,exports){ - -},{}],8:[function(require,module,exports){ -(function (process,Buffer){(function (){ +exports.Zlib = Zlib; +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":51,"assert":1,"buffer":8,"pako/lib/zlib/constants":41,"pako/lib/zlib/deflate.js":43,"pako/lib/zlib/inflate.js":45,"pako/lib/zlib/zstream":49}],6:[function(require,module,exports){ +(function (process){(function (){ 'use strict'; -/* eslint camelcase: "off" */ -var assert = require('assert'); +var Buffer = require('buffer').Buffer; +var Transform = require('stream').Transform; +var binding = require('./binding'); +var util = require('util'); +var assert = require('assert').ok; +var kMaxLength = require('buffer').kMaxLength; +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; -var Zstream = require('pako/lib/zlib/zstream'); -var zlib_deflate = require('pako/lib/zlib/deflate.js'); -var zlib_inflate = require('pako/lib/zlib/inflate.js'); -var constants = require('pako/lib/zlib/constants'); +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; -for (var key in constants) { - exports[key] = constants[key]; -} +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; -// zlib modes -exports.NONE = 0; -exports.DEFLATE = 1; -exports.INFLATE = 2; -exports.GZIP = 3; -exports.GUNZIP = 4; -exports.DEFLATERAW = 5; -exports.INFLATERAW = 6; -exports.UNZIP = 7; +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; -var GZIP_HEADER_ID1 = 0x1f; -var GZIP_HEADER_ID2 = 0x8b; +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; -/** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ -function Zlib(mode) { - if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { - throw new TypeError('Bad argument'); +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); } - - this.dictionary = null; - this.err = 0; - this.flush = 0; - this.init_done = false; - this.level = 0; - this.memLevel = 0; - this.mode = mode; - this.strategy = 0; - this.windowBits = 0; - this.write_in_progress = false; - this.pending_close = false; - this.gzip_id_bytes_read = 0; } -Zlib.prototype.close = function () { - if (this.write_in_progress) { - this.pending_close = true; - return; - } +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; - this.pending_close = false; +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} - assert(this.init_done, 'close before init'); - assert(this.mode <= exports.UNZIP); +Object.defineProperty(exports, 'codes', { + enumerable: true, value: Object.freeze(codes), writable: false +}); - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { - zlib_inflate.inflateEnd(this.strm); - } +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; - this.mode = exports.NONE; +exports.createDeflate = function (o) { + return new Deflate(o); +}; - this.dictionary = null; +exports.createInflate = function (o) { + return new Inflate(o); }; -Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); }; -Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +exports.createInflateRaw = function (o) { + return new InflateRaw(o); }; -Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { - assert.equal(arguments.length, 8); +exports.createGzip = function (o) { + return new Gzip(o); +}; - assert(this.init_done, 'write before init'); - assert(this.mode !== exports.NONE, 'already finalized'); - assert.equal(false, this.write_in_progress, 'write already in progress'); - assert.equal(false, this.pending_close, 'close is pending'); +exports.createGunzip = function (o) { + return new Gunzip(o); +}; - this.write_in_progress = true; +exports.createUnzip = function (o) { + return new Unzip(o); +}; - assert.equal(false, flush === undefined, 'must provide flush value'); +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; - this.write_in_progress = true; +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; - if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { - throw new Error('Invalid flush value'); +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; - if (input == null) { - input = Buffer.alloc(0); - in_len = 0; - in_off = 0; - } +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; - this.strm.avail_in = in_len; - this.strm.input = input; - this.strm.next_in = in_off; - this.strm.avail_out = out_len; - this.strm.output = out; - this.strm.next_out = out_off; - this.flush = flush; +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; - if (!async) { - // sync version - this._process(); +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; - if (this._checkError()) { - return this._afterSync(); - } - return; +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; - // async version - var self = this; - process.nextTick(function () { - self._process(); - self._after(); - }); - - return this; +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); }; -Zlib.prototype._afterSync = function () { - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; - this.write_in_progress = false; +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; - return [avail_in, avail_out]; +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); }; -Zlib.prototype._process = function () { - var next_expected_header_byte = null; +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; - // If the avail_out is left at 0, then it means that it ran out - // of room. If there was avail_out left over, then it means - // that all of the input was consumed. - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflate(this.strm, this.flush); - break; - case exports.UNZIP: - if (this.strm.avail_in > 0) { - next_expected_header_byte = this.strm.next_in; - } +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; - switch (this.gzip_id_bytes_read) { - case 0: - if (next_expected_header_byte === null) { - break; - } +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { - this.gzip_id_bytes_read = 1; - next_expected_header_byte++; +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; - if (this.strm.avail_in === 1) { - // The only available byte was already read. - break; - } - } else { - this.mode = exports.INFLATE; - break; - } + engine.on('error', onError); + engine.on('end', onEnd); - // fallthrough - case 1: - if (next_expected_header_byte === null) { - break; - } + engine.end(buffer); + flow(); - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { - this.gzip_id_bytes_read = 2; - this.mode = exports.GUNZIP; - } else { - // There is no actual difference between INFLATE and INFLATERAW - // (after initialization). - this.mode = exports.INFLATE; - } + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } - break; - default: - throw new Error('invalid number of gzip magic number bytes read'); - } + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } - // fallthrough - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - this.err = zlib_inflate.inflate(this.strm, this.flush + function onEnd() { + var buf; + var err = null; - // If data was encoded with dictionary - );if (this.err === exports.Z_NEED_DICT && this.dictionary) { - // Load it - this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); - if (this.err === exports.Z_OK) { - // And try to decode again - this.err = zlib_inflate.inflate(this.strm, this.flush); - } else if (this.err === exports.Z_DATA_ERROR) { - // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. - // Make it possible for After() to tell a bad dictionary from bad - // input. - this.err = exports.Z_NEED_DICT; - } - } - while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { - // Bytes remain in input buffer. Perhaps this is another compressed - // member in the same archive, or just trailing garbage. - // Trailing zero bytes are okay, though, since they are frequently - // used for padding. + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } - this.reset(); - this.err = zlib_inflate.inflate(this.strm, this.flush); - } - break; - default: - throw new Error('Unknown mode ' + this.mode); + buffers = []; + engine.close(); + callback(err, buf); } -}; +} -Zlib.prototype._checkError = function () { - // Acceptable error states depend on the type of zlib stream. - switch (this.err) { - case exports.Z_OK: - case exports.Z_BUF_ERROR: - if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { - this._error('unexpected end of file'); - return false; - } - break; - case exports.Z_STREAM_END: - // normal statuses, not fatal - break; - case exports.Z_NEED_DICT: - if (this.dictionary == null) { - this._error('Missing dictionary'); - } else { - this._error('Bad dictionary'); - } - return false; - default: - // something else. - this._error('Zlib error'); - return false; - } +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); - return true; -}; + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); -Zlib.prototype._after = function () { - if (!this._checkError()) { - return; - } - - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; + var flushFlag = engine._finishFlushFlag; - this.write_in_progress = false; + return engine._processChunk(buffer, flushFlag); +} - // call the write() cb - this.callback(avail_in, avail_out); +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} - if (this.pending_close) { - this.close(); - } -}; +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} -Zlib.prototype._error = function (message) { - if (this.strm.msg) { - message = this.strm.msg; - } - this.onerror(message, this.err +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} - // no hope of rescue. - );this.write_in_progress = false; - if (this.pending_close) { - this.close(); - } -}; +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} -Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { - assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} - assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); - assert(level >= -1 && level <= 9, 'invalid compression level'); +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} - assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} - assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} - this._init(level, windowBits, memLevel, strategy, dictionary); - this._setDictionary(); -}; +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. -Zlib.prototype.params = function () { - throw new Error('deflateParams Not supported'); -}; +function Zlib(opts, mode) { + var _this = this; -Zlib.prototype.reset = function () { - this._reset(); - this._setDictionary(); -}; + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; -Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { - this.level = level; - this.windowBits = windowBits; - this.memLevel = memLevel; - this.strategy = strategy; + Transform.call(this, opts); - this.flush = exports.Z_NO_FLUSH; + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); + } - this.err = exports.Z_OK; + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { - this.windowBits += 16; + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } } - if (this.mode === exports.UNZIP) { - this.windowBits += 32; + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } } - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { - this.windowBits = -1 * this.windowBits; + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } } - this.strm = new Zstream(); + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); - break; - default: - throw new Error('Unknown mode ' + this.mode); + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } } - if (this.err !== exports.Z_OK) { - this._error('Init error'); + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } } - this.dictionary = dictionary; + this._handle = new binding.Zlib(mode); - this.write_in_progress = false; - this.init_done = true; -}; + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; -Zlib.prototype._setDictionary = function () { - if (this.dictionary == null) { - return; - } + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; - this.err = exports.Z_OK; + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); - break; - default: - break; - } + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; - if (this.err !== exports.Z_OK) { - this._error('Failed to set dictionary'); - } -}; + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); -Zlib.prototype._reset = function () { - this.err = exports.Z_OK; + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - case exports.GZIP: - this.err = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - case exports.GUNZIP: - this.err = zlib_inflate.inflateReset(this.strm); - break; - default: - break; + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); } - if (this.err !== exports.Z_OK) { - this._error('Failed to reset stream'); + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + process.nextTick(callback); } }; -exports.Zlib = Zlib; -}).call(this)}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":44,"assert":1,"buffer":11,"pako/lib/zlib/constants":34,"pako/lib/zlib/deflate.js":36,"pako/lib/zlib/inflate.js":38,"pako/lib/zlib/zstream":42}],9:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; -var Buffer = require('buffer').Buffer; -var Transform = require('stream').Transform; -var binding = require('./binding'); -var util = require('util'); -var assert = require('assert').ok; -var kMaxLength = require('buffer').kMaxLength; -var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; - -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = 16 * 1024; +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; + var ws = this._writableState; -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } -// expose all the zlib constants -var bkeys = Object.keys(binding); -for (var bk = 0; bk < bkeys.length; bk++) { - var bkey = bkeys[bk]; - if (bkey.match(/^Z/)) { - Object.defineProperty(exports, bkey, { - enumerable: true, value: binding[bkey], writable: false - }); + if (ws.ended) { + if (callback) process.nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); + } + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); } -} +}; -// translation table for return codes. -var codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR +Zlib.prototype.close = function (callback) { + _close(this, callback); + process.nextTick(emitCloseNT, this); }; -var ckeys = Object.keys(codes); -for (var ck = 0; ck < ckeys.length; ck++) { - var ckey = ckeys[ck]; - codes[codes[ckey]] = ckey; -} +function _close(engine, callback) { + if (callback) process.nextTick(callback); -Object.defineProperty(exports, 'codes', { - enumerable: true, value: Object.freeze(codes), writable: false -}); + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; + engine._handle.close(); + engine._handle = null; +} -exports.createDeflate = function (o) { - return new Deflate(o); -}; +function emitCloseNT(self) { + self.emit('close'); +} -exports.createInflate = function (o) { - return new Inflate(o); -}; +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); -exports.createDeflateRaw = function (o) { - return new DeflateRaw(o); -}; + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); -exports.createInflateRaw = function (o) { - return new InflateRaw(o); -}; + if (!this._handle) return cb(new Error('zlib binding closed')); -exports.createGzip = function (o) { - return new Gzip(o); -}; + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } -exports.createGunzip = function (o) { - return new Gunzip(o); + this._processChunk(chunk, flushFlag, cb); }; -exports.createUnzip = function (o) { - return new Unzip(o); -}; +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); -}; + var self = this; -exports.deflateSync = function (buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); -}; + var async = typeof cb === 'function'; -exports.gzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); -}; + if (!async) { + var buffers = []; + var nread = 0; -exports.gzipSync = function (buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); -}; + var error; + this.on('error', function (er) { + error = er; + }); -exports.deflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); -}; + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); -exports.deflateRawSync = function (buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); -}; + if (this._hadError) { + throw error; + } -exports.unzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Unzip(opts), buffer, callback); -}; + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } -exports.unzipSync = function (buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); -}; + var buf = Buffer.concat(buffers, nread); + _close(this); -exports.inflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; + return buf; } - return zlibBuffer(new Inflate(opts), buffer, callback); -}; -exports.inflateSync = function (buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -}; + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len -exports.gunzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gunzip(opts), buffer, callback); -}; + req.buffer = chunk; + req.callback = callback; -exports.gunzipSync = function (buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); -}; + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } -exports.inflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); -}; + if (self._hadError) return; -exports.inflateRawSync = function (buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); -}; - -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); - engine.end(buffer); - flow(); + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); } - engine.once('readable', flow); - } - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; - function onEnd() { - var buf; - var err = null; + if (!async) return true; - if (nread >= kMaxLength) { - err = new RangeError(kRangeErrorMessage); - } else { - buf = Buffer.concat(buffers, nread); + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; } - buffers = []; - engine.close(); - callback(err, buf); + if (!async) return false; + + // finished with the chunk. + cb(); } -} +}; -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') buffer = Buffer.from(buffer); +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); +}).call(this)}).call(this,require('_process')) +},{"./binding":5,"_process":51,"assert":1,"buffer":8,"stream":68,"util":76}],7:[function(require,module,exports){ +arguments[4][4][0].apply(exports,arguments) +},{"dup":4}],8:[function(require,module,exports){ +(function (Buffer){(function (){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ - if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); +'use strict' - var flushFlag = engine._finishFlushFlag; +var base64 = require('base64-js') +var ieee754 = require('ieee754') - return engine._processChunk(buffer, flushFlag); -} +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} +var K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} +/** + * 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() -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); +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 Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); +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 + } } -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + buf.__proto__ = Buffer.prototype + return buf } -function isValidFlushFlag(flag) { - return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +/** + * 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 TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) } -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. +// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 +if (typeof Symbol !== 'undefined' && Symbol.species != null && + Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }) +} -function Zlib(opts, mode) { - var _this = this; +Buffer.poolSize = 8192 // not used by this implementation - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } - Transform.call(this, opts); + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) + } - if (opts.flush && !isValidFlushFlag(opts.flush)) { - throw new Error('Invalid flush flag: ' + opts.flush); + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) } - if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { - throw new Error('Invalid flush flag: ' + opts.finishFlush); + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) } - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) } - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } + var b = fromObject(value) + if (b) return b - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) } - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } +/** + * 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 of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') } +} - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } +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) +} - this._handle = new binding.Zlib(mode); +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} - var self = this; - this._hadError = false; - this._handle.onerror = function (message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - _close(self); - self._hadError = true; +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; +/** + * 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) +} - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } - this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) - this._buffer = Buffer.allocUnsafe(this._chunkSize); - this._offset = 0; - this._level = level; - this._strategy = strategy; + var actual = buf.write(string, encoding) - this.once('end', this.close); + 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) + } - Object.defineProperty(this, '_closed', { - get: function () { - return !_this._handle; - }, - configurable: true, - enumerable: true - }); + return buf } -util.inherits(Zlib, Transform); +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 +} -Zlib.prototype.params = function (level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') } - if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') } - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function () { - assert(self._handle, 'zlib binding closed'); - self._handle.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) } else { - process.nextTick(callback); + buf = new Uint8Array(array, byteOffset, length) } -}; - -Zlib.prototype.reset = function () { - assert(this._handle, 'zlib binding closed'); - return this._handle.reset(); -}; -// This is the _flush function called by the transform class, -// internally, when the last chunk has been written. -Zlib.prototype._flush = function (callback) { - this._transform(Buffer.alloc(0), '', callback); -}; + // Return an augmented `Uint8Array` instance + buf.__proto__ = Buffer.prototype + return buf +} -Zlib.prototype.flush = function (kind, callback) { - var _this2 = this; +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + var buf = createBuffer(len) - var ws = this._writableState; + if (buf.length === 0) { + return buf + } - if (typeof kind === 'function' || kind === undefined && !callback) { - callback = kind; - kind = binding.Z_FULL_FLUSH; + obj.copy(buf, 0, 0, len) + return buf } - if (ws.ended) { - if (callback) process.nextTick(callback); - } else if (ws.ending) { - if (callback) this.once('end', callback); - } else if (ws.needDrain) { - if (callback) { - this.once('drain', function () { - return _this2.flush(kind, callback); - }); + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) } - } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); + return fromArrayLike(obj) } -}; - -Zlib.prototype.close = function (callback) { - _close(this, callback); - process.nextTick(emitCloseNT, this); -}; - -function _close(engine, callback) { - if (callback) process.nextTick(callback); - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) return; - engine._handle.close(); - engine._handle = null; + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } } -function emitCloseNT(self) { - self.emit('close'); +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 } -Zlib.prototype._transform = function (chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} - if (!this._handle) return cb(new Error('zlib binding closed')); +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) flushFlag = this._finishFlushFlag;else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) } - this._processChunk(chunk, flushFlag, cb); -}; + if (a === b) return 0 -Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; + var x = a.length + var y = b.length - var self = this; + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } - var async = typeof cb === 'function'; + if (x < y) return -1 + if (y < x) return 1 + return 0 +} - if (!async) { - var buffers = []; - var nread = 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 + } +} - var error; - this.on('error', function (er) { - error = er; - }); +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); + if (list.length === 0) { + return Buffer.alloc(0) + } - if (this._hadError) { - throw error; + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length } + } - if (nread >= kMaxLength) { - _close(this); - throw new RangeError(kRangeErrorMessage); + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length } + return buffer +} - assert(this._handle, 'zlib binding closed'); - var req = this._handle.write(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } - req.buffer = chunk; - req.callback = callback; + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 - function callback(availInAfter, availOutAfter) { - // When the callback is used in an async write, the callback's - // context is the `req` object that was created. The req object - // is === this._handle, and that's why it's important to null - // out the values after they are done being used. `this._handle` - // can stay in memory longer than the callback and buffer are needed. - if (this) { - this.buffer = null; - this.callback = null; + // 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': + 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 mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true } + } +} +Buffer.byteLength = byteLength - if (self._hadError) return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } +function slowToString (encoding, start, end) { + var loweredCase = false - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += availInBefore - availInAfter; - availInBefore = availInAfter; + // 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 (!async) return true; + if (end === undefined || end > this.length) { + end = this.length + } - var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } + if (end <= 0) { + return '' + } - if (!async) return false; + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 - // finished with the chunk. - cb(); + if (end <= start) { + return '' } -}; -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); -}).call(this)}).call(this,require('_process')) -},{"./binding":8,"_process":44,"assert":1,"buffer":11,"stream":46,"util":66}],10:[function(require,module,exports){ -arguments[4][7][0].apply(exports,arguments) -},{"dup":7}],11:[function(require,module,exports){ -(function (Buffer){(function (){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ + if (!encoding) encoding = 'utf8' -'use strict' + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) -var base64 = require('base64-js') -var ieee754 = require('ieee754') + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 + case 'ascii': + return asciiSlice(this, start, end) -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) -/** - * 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() + case 'base64': + return base64Slice(this, start, end) -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.' - ) -} + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) -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 + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } } } -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) +// 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 -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') +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') } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this } -/** - * 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 TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) +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') } - return from(arg, encodingOrOffset, length) + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this } -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) +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.poolSize = 8192 // not used by this implementation +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) +} -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } +Buffer.prototype.toLocaleString = Buffer.prototype.toString - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } +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 +} - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) } - - if (typeof value === 'number') { + if (!Buffer.isBuffer(target)) { throw new TypeError( - 'The "value" argument must not be of type number. Received type number' + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) ) } - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length } - var b = fromObject(value) - if (b) return b + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 } - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 -/** - * 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) -} + if (this === target) return 0 -// 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 + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) -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) + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } } - 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) + if (x < y) return -1 + if (y < x) return 1 + return 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) -} +// 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 -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) + 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) } - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) + // 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 + } - var actual = buf.write(string, encoding) + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, 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) + // 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) } - return buf + throw new TypeError('val must be string, number or Buffer') } -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 arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') + 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 + } } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } } - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) + 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 { - buf = new Uint8Array(array, byteOffset, length) + 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 an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf + return -1 } -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} - if (buf.length === 0) { - return buf - } +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} - obj.copy(buf, 0, 0, len) - return buf - } +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) +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 } - return fromArrayLike(obj) } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) + var strLen = string.length + + 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 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 utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) } -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) } -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - 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 +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) } -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 - } +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } -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 (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') +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 } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && 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': - 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 mustMatch ? -1 : 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 + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining - if (end <= start) { - return '' + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' - while (true) { + var loweredCase = false + for (;;) { switch (encoding) { case 'hex': - return hexSlice(this, start, end) + return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': - return utf8Slice(this, start, end) + return utf8Write(this, string, offset, length) case 'ascii': - return asciiSlice(this, start, end) + return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': - return latin1Slice(this, start, end) + return latin1Write(this, string, offset, length) case 'base64': - return base64Slice(this, start, end) + // 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 utf16leSlice(this, start, end) + return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() + 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.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } } -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) +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) } - 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) +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 this + + return decodeCodePointsArray(res) } -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') +// 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() } - 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) + + // 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 this + return res } -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) +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 } -Buffer.prototype.toLocaleString = Buffer.prototype.toString +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) -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 + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret } -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} +function hexSlice (buf, start, end) { + var len = buf.length -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) } + return out +} - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') +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 +} - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 +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 (start >= end) { - return 1 + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len } - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 + if (end < start) end = start - if (this === target) return 0 + var newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + newBuf.__proto__ = Buffer.prototype + return newBuf +} - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) +/* + * 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') +} - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul } - if (x < y) return -1 - if (y < x) return 1 - return 0 + return val } -// 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) +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) } - // 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 + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul } - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } + return val +} - // 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) - } +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} - throw new TypeError('val must be string, number or Buffer') +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) } -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} - 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 - } - } +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } + 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 - 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 - } + 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 - return -1 + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val } -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 +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.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +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.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +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 } -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 - } - } +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) - var strLen = string.length + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} - 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 +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]) } -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +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) } -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) +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) } -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) +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) } -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) +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 ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +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.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' - ) +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 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') + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF } - 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) + return offset + byteLength +} - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) +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) + } - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) + return offset + byteLength +} - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } +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.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } +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 } -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } +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 } -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] +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 +} - 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 +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 +} - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) - 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 - } - } - } - } + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } - 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 + 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 } - - res.push(codePoint) - i += bytesPerSequence + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } - return decodeCodePointsArray(res) + return offset + byteLength } -// 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 +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + checkInt(this, value, offset, byteLength, limit - 1, -limit) } - // 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) - ) + 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 res -} -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) + return offset + byteLength +} - 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 +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 } -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.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.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 +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 } -/* - * 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.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.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value 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 - } + 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 +} - return val +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') } -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value 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 + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } - - return val + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 } -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) } -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.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) } -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] + 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.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.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) } -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.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) } -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 -} +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + 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 -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') } - mul *= 0x80 + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') - if (val >= mul) val -= Math.pow(2, 8 * byteLength) + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } - return val -} + var len = end - start -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) -} + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } -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 + return len } -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 -} +// 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 (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) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + // 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') + } - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} + if (end <= start) { + return this + } -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} + if (!val) val = 0 -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) -} + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } -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) + return this } -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) -} +// HELPER FUNCTIONS +// ================ -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) +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // 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 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') +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) } -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) - } +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF + 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 offset + byteLength + return bytes } -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) +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 +} - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF +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 offset + byteLength + return byteArray } -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 +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) } -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 +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 offset + byteLength + return i } -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 +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) } - -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 +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare } -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 -} +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":3,"buffer":8,"ieee754":26}],9:[function(require,module,exports){ +'use strict'; -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 -} +var GetIntrinsic = require('get-intrinsic'); -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 -} +var callBind = require('./'); -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') -} +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); -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 -} +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} +},{"./":10,"get-intrinsic":18}],10:[function(require,module,exports){ +'use strict'; -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); +var setFunctionLength = require('set-function-length'); -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 -} +var $TypeError = GetIntrinsic('%TypeError%'); +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } } -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - 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('Index out of range') - 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 +module.exports = function callBind(originalFunction) { + if (typeof originalFunction !== 'function') { + throw new $TypeError('a function is required'); + } + var func = $reflectApply(bind, $call, arguments); + return setFunctionLength( + func, + 1 + $max(0, originalFunction.length - (arguments.length - 1)), + true + ); +}; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; - return len +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; } -// 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 (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) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } 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 - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - 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 takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // 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 -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -}).call(this)}).call(this,require("buffer").Buffer) -},{"base64-js":6,"buffer":11,"ieee754":26}],12:[function(require,module,exports){ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var callBind = require('./'); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; - -},{"./":13,"get-intrinsic":21}],13:[function(require,module,exports){ -'use strict'; - -var bind = require('function-bind'); -var GetIntrinsic = require('get-intrinsic'); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} - -},{"function-bind":20,"get-intrinsic":21}],14:[function(require,module,exports){ +},{"function-bind":17,"get-intrinsic":18,"set-function-length":67}],11:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -4596,24 +3971,77 @@ else if (!global.CBOR) })(this); -},{}],15:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ 'use strict'; +var hasPropertyDescriptors = require('has-property-descriptors')(); + var GetIntrinsic = require('get-intrinsic'); -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -if ($gOPD) { +var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true); +if ($defineProperty) { try { - $gOPD([], 'length'); + $defineProperty({}, 'a', { value: 1 }); } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; + // IE 8 has a broken defineProperty + $defineProperty = false; } } -module.exports = $gOPD; +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var gopd = require('gopd'); + +/** @type {(obj: Record, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; -},{"get-intrinsic":21}],16:[function(require,module,exports){ +},{"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],13:[function(require,module,exports){ (function (process,setImmediate){(function (){ /*! * EventEmitter2 @@ -4716,7 +4144,7 @@ module.exports = $gOPD; var obj = {}; var key; var len = keys.length; - var valuesCount = values ? value.length : 0; + var valuesCount = values ? values.length : 0; for (var i = 0; i < len; i++) { key = keys[i]; obj[key] = i < valuesCount ? values[i] : undefined; @@ -6246,7 +5674,7 @@ module.exports = $gOPD; }(); }).call(this)}).call(this,require('_process'),require("timers").setImmediate) -},{"_process":44,"timers":62}],17:[function(require,module,exports){ +},{"_process":51,"timers":70}],14:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6745,31 +6173,71 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { } } -},{}],18:[function(require,module,exports){ +},{}],15:[function(require,module,exports){ +'use strict'; -var hasOwn = Object.prototype.hasOwnProperty; -var toString = Object.prototype.toString; +var isCallable = require('is-callable'); -module.exports = function forEach (obj, fn, ctx) { - if (toString.call(fn) !== '[object Function]') { - throw new TypeError('iterator must be a function'); +var toStr = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var forEachArray = function forEachArray(array, iterator, receiver) { + for (var i = 0, len = array.length; i < len; i++) { + if (hasOwnProperty.call(array, i)) { + if (receiver == null) { + iterator(array[i], i, array); + } else { + iterator.call(receiver, array[i], i, array); + } + } } - var l = obj.length; - if (l === +l) { - for (var i = 0; i < l; i++) { - fn.call(ctx, obj[i], i, obj); +}; + +var forEachString = function forEachString(string, iterator, receiver) { + for (var i = 0, len = string.length; i < len; i++) { + // no such thing as a sparse string. + if (receiver == null) { + iterator(string.charAt(i), i, string); + } else { + iterator.call(receiver, string.charAt(i), i, string); } - } else { - for (var k in obj) { - if (hasOwn.call(obj, k)) { - fn.call(ctx, obj[k], k, obj); + } +}; + +var forEachObject = function forEachObject(object, iterator, receiver) { + for (var k in object) { + if (hasOwnProperty.call(object, k)) { + if (receiver == null) { + iterator(object[k], k, object); + } else { + iterator.call(receiver, object[k], k, object); } } } }; +var forEach = function forEach(list, iterator, thisArg) { + if (!isCallable(iterator)) { + throw new TypeError('iterator must be a function'); + } + + var receiver; + if (arguments.length >= 3) { + receiver = thisArg; + } + + if (toStr.call(list) === '[object Array]') { + forEachArray(list, iterator, receiver); + } else if (typeof list === 'string') { + forEachString(list, iterator, receiver); + } else { + forEachObject(list, iterator, receiver); + } +}; + +module.exports = forEach; -},{}],19:[function(require,module,exports){ +},{"is-callable":30}],16:[function(require,module,exports){ 'use strict'; /* eslint no-invalid-this: 1 */ @@ -6855,14 +6323,14 @@ module.exports = function bind(that) { return bound; }; -},{}],20:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); module.exports = Function.prototype.bind || implementation; -},{"./implementation":19}],21:[function(require,module,exports){ +},{"./implementation":16}],18:[function(require,module,exports){ 'use strict'; var undefined; @@ -6908,18 +6376,23 @@ var ThrowTypeError = $gOPD : throwTypeError; var hasSymbols = require('has-symbols')(); +var hasProto = require('has-proto')(); -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto +var getProto = Object.getPrototypeOf || ( + hasProto + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto + : null +); var needsEval = {}; -var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); var INTRINSICS = { '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, '%AsyncFromSyncIteratorPrototype%': undefined, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, @@ -6927,6 +6400,8 @@ var INTRINSICS = { '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, '%Date%': Date, @@ -6947,10 +6422,10 @@ var INTRINSICS = { '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, '%JSON%': typeof JSON === 'object' ? JSON : undefined, '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': Object, @@ -6963,10 +6438,10 @@ var INTRINSICS = { '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '%String%': String, - '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, '%Symbol%': hasSymbols ? Symbol : undefined, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, @@ -6982,6 +6457,16 @@ var INTRINSICS = { '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet }; +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { @@ -6997,7 +6482,7 @@ var doEval = function doEval(name) { } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); - if (gen) { + if (gen && getProto) { value = getProto(gen.prototype); } } @@ -7062,11 +6547,12 @@ var LEGACY_ALIASES = { }; var bind = require('function-bind'); -var hasOwn = require('has'); +var hasOwn = require('hasown'); var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); var $strSlice = bind.call(Function.call, String.prototype.slice); +var $exec = bind.call(Function.call, RegExp.prototype.exec); /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; @@ -7122,6 +6608,9 @@ module.exports = function GetIntrinsic(name, allowMissing) { throw new $TypeError('"allowMissing" argument must be a boolean'); } + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; @@ -7194,7 +6683,73 @@ module.exports = function GetIntrinsic(name, allowMissing) { return value; }; -},{"function-bind":20,"has":25,"has-symbols":22}],22:[function(require,module,exports){ +},{"function-bind":17,"has-proto":21,"has-symbols":22,"hasown":25}],19:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + +},{"get-intrinsic":18}],20:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + return true; + } catch (e) { + // IE 8 has a broken defineProperty + return false; + } + } + return false; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!hasPropertyDescriptors()) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; + +},{"get-intrinsic":18}],21:[function(require,module,exports){ +'use strict'; + +var test = { + foo: {} +}; + +var $Object = Object; + +module.exports = function hasProto() { + return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); +}; + +},{}],22:[function(require,module,exports){ 'use strict'; var origSymbol = typeof Symbol !== 'undefined' && Symbol; @@ -7265,11 +6820,14 @@ module.exports = function hasToStringTagShams() { },{"has-symbols/shams":23}],25:[function(require,module,exports){ 'use strict'; +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; var bind = require('function-bind'); -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); +/** @type {(o: {}, p: PropertyKey) => p is keyof o} */ +module.exports = bind.call(call, $hasOwn); -},{"function-bind":20}],26:[function(require,module,exports){ +},{"function-bind":17}],26:[function(require,module,exports){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m @@ -7357,6 +6915,31 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { } },{}],27:[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 + } +} + +},{}],28:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -7385,7 +6968,7 @@ if (typeof Object.create === 'function') { } } -},{}],28:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; var hasToStringTag = require('has-tostringtag/shams')(); @@ -7420,7 +7003,110 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; -},{"call-bind/callBound":12,"has-tostringtag/shams":24}],29:[function(require,module,exports){ +},{"call-bind/callBound":9,"has-tostringtag/shams":24}],30:[function(require,module,exports){ +'use strict'; + +var fnToStr = Function.prototype.toString; +var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; +var badArrayLike; +var isCallableMarker; +if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { + try { + badArrayLike = Object.defineProperty({}, 'length', { + get: function () { + throw isCallableMarker; + } + }); + isCallableMarker = {}; + // eslint-disable-next-line no-throw-literal + reflectApply(function () { throw 42; }, null, badArrayLike); + } catch (_) { + if (_ !== isCallableMarker) { + reflectApply = null; + } + } +} else { + reflectApply = null; +} + +var constructorRegex = /^\s*class\b/; +var isES6ClassFn = function isES6ClassFunction(value) { + try { + var fnStr = fnToStr.call(value); + return constructorRegex.test(fnStr); + } catch (e) { + return false; // not a function + } +}; + +var tryFunctionObject = function tryFunctionToStr(value) { + try { + if (isES6ClassFn(value)) { return false; } + fnToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var objectClass = '[object Object]'; +var fnClass = '[object Function]'; +var genClass = '[object GeneratorFunction]'; +var ddaClass = '[object HTMLAllCollection]'; // IE 11 +var ddaClass2 = '[object HTML document.all class]'; +var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 +var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` + +var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing + +var isDDA = function isDocumentDotAll() { return false; }; +if (typeof document === 'object') { + // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly + var all = document.all; + if (toStr.call(all) === toStr.call(document.all)) { + isDDA = function isDocumentDotAll(value) { + /* globals document: false */ + // in IE 6-8, typeof document.all is "object" and it's truthy + if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { + try { + var str = toStr.call(value); + return ( + str === ddaClass + || str === ddaClass2 + || str === ddaClass3 // opera 12.16 + || str === objectClass // IE 6-8 + ) && value('') == null; // eslint-disable-line eqeqeq + } catch (e) { /**/ } + } + return false; + }; + } +} + +module.exports = reflectApply + ? function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + try { + reflectApply(value, null, badArrayLike); + } catch (e) { + if (e !== isCallableMarker) { return false; } + } + return !isES6ClassFn(value) && tryFunctionObject(value); + } + : function isCallable(value) { + if (isDDA(value)) { return true; } + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (hasToStringTag) { return tryFunctionObject(value); } + if (isES6ClassFn(value)) { return false; } + var strClass = toStr.call(value); + if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } + return tryFunctionObject(value); + }; + +},{}],31:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; @@ -7460,71 +7146,16 @@ module.exports = function isGeneratorFunction(fn) { return getProto(fn) === GeneratorFunction; }; -},{"has-tostringtag/shams":24}],30:[function(require,module,exports){ -(function (global){(function (){ +},{"has-tostringtag/shams":24}],32:[function(require,module,exports){ 'use strict'; -var forEach = require('foreach'); -var availableTypedArrays = require('available-typed-arrays'); -var callBound = require('call-bind/callBound'); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = require('has-tostringtag/shams')(); - -var g = typeof globalThis === 'undefined' ? global : globalThis; -var typedArrays = availableTypedArrays(); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function (getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { /**/ } - } - }); - return anyTrue; -}; +var whichTypedArray = require('which-typed-array'); module.exports = function isTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { return false; } - return tryTypedArrays(value); + return !!whichTypedArray(value); }; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24}],31:[function(require,module,exports){ +},{"which-typed-array":79}],33:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -7613,10 +7244,292 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { } } - return to; + return to; +}; + +},{}],34:[function(require,module,exports){ +'use strict'; + +var keysShim; +if (!Object.keys) { + // modified from https://github.com/es-shims/es5-shim + var has = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var isArgs = require('./isArguments'); // eslint-disable-line global-require + var isEnumerable = Object.prototype.propertyIsEnumerable; + var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); + var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); + var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; + }; + var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $onmozfullscreenchange: true, + $onmozfullscreenerror: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true + }; + var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; + }()); + var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } + }; + + keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; + }; +} +module.exports = keysShim; + +},{"./isArguments":36}],35:[function(require,module,exports){ +'use strict'; + +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); + +var origKeys = Object.keys; +var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); + +var originalKeys = Object.keys; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + var args = Object.keys(arguments); + return args && args.length === arguments.length; + }(1, 2)); + if (!keysWorksWithArguments) { + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } + return originalKeys(object); + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; + +},{"./implementation":34,"./isArguments":36}],36:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; + +},{}],37:[function(require,module,exports){ +'use strict'; + +// modified from https://github.com/es-shims/es6-shim +var objectKeys = require('object-keys'); +var hasSymbols = require('has-symbols/shams')(); +var callBound = require('call-bind/callBound'); +var toObject = Object; +var $push = callBound('Array.prototype.push'); +var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; + +// eslint-disable-next-line no-unused-vars +module.exports = function assign(target, source1) { + if (target == null) { throw new TypeError('target must be an object'); } + var to = toObject(target); // step 1 + if (arguments.length === 1) { + return to; // step 2 + } + for (var s = 1; s < arguments.length; ++s) { + var from = toObject(arguments[s]); // step 3.a.i + + // step 3.a.ii: + var keys = objectKeys(from); + var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); + if (getSymbols) { + var syms = getSymbols(from); + for (var j = 0; j < syms.length; ++j) { + var key = syms[j]; + if ($propIsEnumerable(from, key)) { + $push(keys, key); + } + } + } + + // step 3.a.iii: + for (var i = 0; i < keys.length; ++i) { + var nextKey = keys[i]; + if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2 + var propValue = from[nextKey]; // step 3.a.iii.2.a + to[nextKey] = propValue; // step 3.a.iii.2.b + } + } + } + + return to; // step 4 +}; + +},{"call-bind/callBound":9,"has-symbols/shams":23,"object-keys":35}],38:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +var lacksProperEnumerationOrder = function () { + if (!Object.assign) { + return false; + } + /* + * v8, specifically in node 4.x, has a bug with incorrect property enumeration order + * note: this does not detect the bug unless there's 20 characters + */ + var str = 'abcdefghijklmnopqrst'; + var letters = str.split(''); + var map = {}; + for (var i = 0; i < letters.length; ++i) { + map[letters[i]] = letters[i]; + } + var obj = Object.assign({}, map); + var actual = ''; + for (var k in obj) { + actual += k; + } + return str !== actual; +}; + +var assignHasPendingExceptions = function () { + if (!Object.assign || !Object.preventExtensions) { + return false; + } + /* + * Firefox 37 still has "pending exception" logic in its Object.assign implementation, + * which is 72% slower than our shim, and Firefox 40's native implementation. + */ + var thrower = Object.preventExtensions({ 1: 2 }); + try { + Object.assign(thrower, 'xy'); + } catch (e) { + return thrower[1] === 'y'; + } + return false; +}; + +module.exports = function getPolyfill() { + if (!Object.assign) { + return implementation; + } + if (lacksProperEnumerationOrder()) { + return implementation; + } + if (assignHasPendingExceptions()) { + return implementation; + } + return Object.assign; }; -},{}],32:[function(require,module,exports){ +},{"./implementation":37}],39:[function(require,module,exports){ 'use strict'; @@ -7723,7 +7636,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],33:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. @@ -7776,7 +7689,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],34:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -7846,7 +7759,7 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],35:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. @@ -7907,7 +7820,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],36:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -9783,7 +9696,7 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":32,"./adler32":33,"./crc32":35,"./messages":40,"./trees":41}],37:[function(require,module,exports){ +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./messages":47,"./trees":48}],44:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -10130,7 +10043,7 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],38:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11688,7 +11601,7 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":32,"./adler32":33,"./crc32":35,"./inffast":37,"./inftrees":39}],39:[function(require,module,exports){ +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./inffast":44,"./inftrees":46}],46:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -12033,7 +11946,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":32}],40:[function(require,module,exports){ +},{"../utils/common":39}],47:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -12067,7 +11980,7 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],41:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13291,7 +13204,7 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":32}],42:[function(require,module,exports){ +},{"../utils/common":39}],49:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -13340,7 +13253,7 @@ function ZStream() { module.exports = ZStream; -},{}],43:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ (function (Buffer){(function (){ var fs = require("fs"), stream = require("stream"), @@ -13954,7 +13867,7 @@ exports.parseBuffer = function(buf, callback) { exports.parse = exports.parseBuffer }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":11,"fs":10,"stream":46,"zlib":9}],44:[function(require,module,exports){ +},{"buffer":8,"fs":7,"stream":68,"zlib":6}],51:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14011,334 +13924,136 @@ function runTimeout(fun) { 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; }; - -},{}],45:[function(require,module,exports){ -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":11}],46:[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/lib/_stream_readable.js'); -Stream.Writable = require('readable-stream/lib/_stream_writable.js'); -Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); -Stream.Transform = require('readable-stream/lib/_stream_transform.js'); -Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); -Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') -Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - + return cachedSetTimeout.call(this, fun, 0); + } + } -// 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(); - } +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); + // 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); + } } - } - - 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(); - } +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - // 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. +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; } - } - - source.on('error', onerror); - dest.on('error', onerror); + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - source.removeListener('end', onend); - source.removeListener('close', onclose); + 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); +} - source.removeListener('error', onerror); - dest.removeListener('error', onerror); +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); + } +}; - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); +// 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 = {}; - dest.removeListener('close', cleanup); - } +function noop() {} - source.on('end', cleanup); - source.on('close', cleanup); +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; - dest.on('close', cleanup); +process.listeners = function (name) { return [] } - dest.emit('pipe', source); +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); }; +process.umask = function() { return 0; }; -},{"events":17,"inherits":27,"readable-stream/lib/_stream_duplex.js":48,"readable-stream/lib/_stream_passthrough.js":49,"readable-stream/lib/_stream_readable.js":50,"readable-stream/lib/_stream_transform.js":51,"readable-stream/lib/_stream_writable.js":52,"readable-stream/lib/internal/streams/end-of-stream.js":56,"readable-stream/lib/internal/streams/pipeline.js":58}],47:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } @@ -14467,7 +14182,7 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); module.exports.codes = codes; -},{}],48:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14489,60 +14204,48 @@ module.exports.codes = codes; // 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. + // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. + 'use strict'; -/**/ +/**/ var objectKeys = Object.keys || function (obj) { var keys = []; - - for (var key in obj) { - keys.push(key); - } - + for (var key in obj) keys.push(key); return keys; }; /**/ - module.exports = Duplex; - var Readable = require('./_stream_readable'); - var Writable = require('./_stream_writable'); - require('inherits')(Duplex, Readable); - { // Allow the keys array to be GC'ed. 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); this.allowHalfOpen = true; - if (options) { if (options.readable === false) this.readable = false; if (options.writable === false) this.writable = false; - if (options.allowHalfOpen === false) { this.allowHalfOpen = false; this.once('end', onend); } } } - Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14569,20 +14272,20 @@ Object.defineProperty(Duplex.prototype, 'writableLength', { get: function get() { return this._writableState.length; } -}); // the no-half-open enforcer +}); +// the no-half-open enforcer function onend() { // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. + if (this._writableState.ended) return; + // no more data can be written. + // But allow more writes to happen in this tick. process.nextTick(onEndNT, this); } - function onEndNT(self) { self.end(); } - Object.defineProperty(Duplex.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14592,7 +14295,6 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { if (this._readableState === undefined || this._writableState === undefined) { return false; } - return this._readableState.destroyed && this._writableState.destroyed; }, set: function set(value) { @@ -14600,16 +14302,16 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // has not been initialized yet if (this._readableState === undefined || this._writableState === undefined) { return; - } // backward compatibility, the user is explicitly - // managing destroyed - + } + // backward compatibility, the user is explicitly + // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; } }); }).call(this)}).call(this,require('_process')) -},{"./_stream_readable":50,"./_stream_writable":52,"_process":44,"inherits":27}],49:[function(require,module,exports){ +},{"./_stream_readable":55,"./_stream_writable":57,"_process":51,"inherits":28}],54:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -14630,26 +14332,24 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { // 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. + // 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'); - require('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":51,"inherits":27}],50:[function(require,module,exports){ +},{"./_stream_transform":56,"inherits":28}],55:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -14671,49 +14371,40 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. + 'use strict'; module.exports = Readable; -/**/ +/**/ var Duplex; /**/ Readable.ReadableState = ReadableState; -/**/ +/**/ var EE = require('events').EventEmitter; - var EElistenerCount = function EElistenerCount(emitter, type) { return emitter.listeners(type).length; }; /**/ /**/ - - var Stream = require('./internal/streams/stream'); /**/ - var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } - function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -/**/ - +/**/ var debugUtil = require('util'); - var debug; - if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { @@ -14721,60 +14412,57 @@ if (debugUtil && debugUtil.debuglog) { } /**/ - var BufferList = require('./internal/streams/buffer_list'); - var destroyImpl = require('./internal/streams/destroy'); - var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - + getHighWaterMark = _require.getHighWaterMark; var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. - + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; +// Lazy loaded to improve the startup performance. var StringDecoder; var createReadableStreamAsyncIterator; var from; - require('inherits')(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; 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); // This is a hack to make sure that our error handler is attached before any + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // 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 (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } - function ReadableState(options, stream, isDuplex) { Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share + options = options || {}; + + // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // 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 (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + if (isDuplex) 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" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // 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; @@ -14782,61 +14470,66 @@ function ReadableState(options, stream, isDuplex) { this.flowing = null; this.ended = false; this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted // 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 read call. + this.sync = true; - this.sync = true; // whenever we return null, then we set a flag to say + // 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; - this.paused = true; // Should close be emitted on destroy. Defaults to true. + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; - this.autoDestroy = !!options.autoDestroy; // has it been destroyed + // has it been destroyed + this.destroyed = false; - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // 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'; - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + // 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); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 + if (!(this instanceof Readable)) return new Readable(options); + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy + this._readableState = new ReadableState(options, this, isDuplex); + // legacy this.readable = true; - if (options) { if (typeof options.read === 'function') this._read = options.read; if (typeof options.destroy === 'function') this._destroy = options.destroy; } - Stream.call(this); } - Object.defineProperty(Readable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -14846,7 +14539,6 @@ Object.defineProperty(Readable.prototype, 'destroyed', { if (this._readableState === undefined) { return false; } - return this._readableState.destroyed; }, set: function set(value) { @@ -14854,69 +14546,60 @@ Object.defineProperty(Readable.prototype, 'destroyed', { // has not been initialized yet if (!this._readableState) { return; - } // backward compatibility, the user is explicitly - // managing destroyed - + } + // backward compatibility, the user is explicitly + // managing destroyed this._readableState.destroyed = value; } }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function (err, cb) { cb(err); -}; // Manually shove something into the read() buffer. +}; + +// 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; var skipChunkCheck; - if (!state.objectMode) { if (typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } - skipChunkCheck = true; } } else { skipChunkCheck = true; } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() - +}; +// Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, true, false); }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { debug('readableAddChunk', chunk); var state = stream._readableState; - if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else { var er; if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { errorOrDestroy(stream, er); } else if (state.objectMode || chunk && chunk.length > 0) { if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = _uint8ArrayToBuffer(chunk); } - if (addToFront) { if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); } else if (state.ended) { @@ -14925,7 +14608,6 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { return false; } else { state.reading = false; - if (state.decoder && !encoding) { chunk = state.decoder.write(chunk); if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); @@ -14937,14 +14619,13 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { state.reading = false; maybeReadMore(stream, state); } - } // We can push more data if we are below the highWaterMark. + } + + // We can push more data if we are below the highWaterMark. // 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. - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); } - function addChunk(stream, state, chunk, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { state.awaitDrain = 0; @@ -14955,50 +14636,42 @@ function addChunk(stream, state, chunk, addToFront) { if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } - maybeReadMore(stream, state); } - function chunkInvalid(state, chunk) { var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); } - return er; } - Readable.prototype.isPaused = function () { return this._readableState.flowing === false; -}; // backwards compatibility. - +}; +// backwards compatibility. Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + // Iterate over current buffer to convert already stored Buffers: var p = this._readableState.buffer.head; var content = ''; - while (p !== null) { content += decoder.write(p.data); p = p.next; } - this._readableState.buffer.clear(); - if (content !== '') this._readableState.buffer.push(content); this._readableState.length = content.length; return this; -}; // Don't raise the hwm > 1GB - +}; +// Don't raise the hwm > 1GB var MAX_HWM = 0x40000000; - function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. @@ -15014,55 +14687,54 @@ function computeNewHighWaterMark(n) { n |= n >>> 16; n++; } - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. - +} +// 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 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 (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. - +} +// 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 + 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.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || 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); - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - + // 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 + } + + // 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 @@ -15083,40 +14755,37 @@ Readable.prototype.read = function (n) { // '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. - + // 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 + 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. - + } + // 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 - + 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, + 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 = state.length <= state.highWaterMark; n = 0; @@ -15124,34 +14793,28 @@ Readable.prototype.read = function (n) { state.length -= n; state.awaitDrain = 0; } - 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 (!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 onEofChunk(stream, state) { debug('onEofChunk'); 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; - if (state.sync) { // if we are sync, wait until next tick to emit the data. // Otherwise we risk emitting data in the flow() @@ -15160,61 +14823,56 @@ function onEofChunk(stream, state) { } else { // emit 'readable' now to make sure it gets picked up. state.needReadable = false; - if (!state.emittedReadable) { state.emittedReadable = true; emitReadable_(stream); } } -} // Don't emit readable right away in sync mode, because this can trigger +} + +// 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; debug('emitReadable', state.needReadable, state.emittedReadable); state.needReadable = false; - if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; process.nextTick(emitReadable_, stream); } } - function emitReadable_(stream) { var state = stream._readableState; debug('emitReadable_', state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { stream.emit('readable'); state.emittedReadable = false; - } // The stream needs another readable event if + } + + // The stream needs another readable event if // 1. It is not flowing, as the flow mechanism will take // care of it. // 2. It is not ended. // 3. It is below the highWaterMark, so we can schedule // another readable later. - - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; flow(stream); -} // at this point, the user has presumably seen the 'readable' event, +} + +// 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; process.nextTick(maybeReadMore_, stream, state); } } - function maybeReadMore_(stream, state) { // Attempt to read more data if we should. // @@ -15243,49 +14901,42 @@ function maybeReadMore_(stream, state) { var len = state.length; debug('maybeReadMore read 0'); stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. + if (len === state.length) + // didn't get any data, stop spinning. break; } - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. +} + +// 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) { errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); }; - 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) process.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { debug('onunpipe'); - if (readable === src) { if (unpipeInfo && unpipeInfo.hasUnpiped === false) { unpipeInfo.hasUnpiped = true; @@ -15293,23 +14944,21 @@ Readable.prototype.pipe = function (dest, pipeOpts) { } } } - function onend() { debug('onend'); dest.end(); - } // when the dest drains, it reduces the awaitDrain counter + } + + // 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 - + debug('cleanup'); + // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); @@ -15318,22 +14967,20 @@ Readable.prototype.pipe = function (dest, pipeOpts) { 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 + 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(); } - src.on('data', ondata); - function ondata(chunk) { debug('ondata'); var ret = dest.write(chunk); debug('dest.write', ret); - if (ret === false) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write @@ -15343,87 +14990,84 @@ Readable.prototype.pipe = function (dest, pipeOpts) { debug('false write response, pause', state.awaitDrain); state.awaitDrain++; } - src.pause(); } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - + } + // 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) errorOrDestroy(dest, 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. + // 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. + // 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 pipeOnDrainFunctionResult() { 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; var unpipeInfo = { hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. + }; - if (state.pipesCount === 0) return this; // just one destination. most common case. + // 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. + if (!dest) dest = state.pipes; + // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; if (dest) dest.emit('unpipe', this, unpipeInfo); return this; - } // slow case. multiple pipe destinations. + } + // slow case. multiple pipe destinations. if (!dest) { // remove all. @@ -15432,17 +15076,13 @@ Readable.prototype.unpipe = function (dest) { state.pipes = null; state.pipesCount = 0; state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } - + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); return this; - } // try to find the right one. - + } + // try to find the right one. var index = indexOf(state.pipes, dest); if (index === -1) return this; state.pipes.splice(index, 1); @@ -15450,19 +15090,19 @@ Readable.prototype.unpipe = function (dest) { if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this, unpipeInfo); return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something - +}; +// 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); var state = this._readableState; - if (ev === 'data') { // update readableListening so that resume() may be a no-op // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + state.readableListening = this.listenerCount('readable') > 0; + // Try start flowing on next tick if stream isn't explicitly paused if (state.flowing !== false) this.resume(); } else if (ev === 'readable') { if (!state.endEmitted && !state.readableListening) { @@ -15470,7 +15110,6 @@ Readable.prototype.on = function (ev, fn) { state.flowing = false; state.emittedReadable = false; debug('on readable', state.length, state.reading); - if (state.length) { emitReadable(this); } else if (!state.reading) { @@ -15478,15 +15117,11 @@ Readable.prototype.on = function (ev, fn) { } } } - return res; }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function (ev, fn) { var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === 'readable') { // We need to check if there is someone still listening to // readable and reset the state. However this needs to happen @@ -15496,13 +15131,10 @@ Readable.prototype.removeListener = function (ev, fn) { // effect. process.nextTick(updateReadableListening, this); } - return res; }; - Readable.prototype.removeAllListeners = function (ev) { var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === 'readable' || ev === undefined) { // We need to check if there is someone still listening to // readable and reset the state. However this needs to happen @@ -15512,121 +15144,103 @@ Readable.prototype.removeAllListeners = function (ev) { // effect. process.nextTick(updateReadableListening, this); } - return res; }; - function updateReadableListening(self) { var state = self._readableState; state.readableListening = self.listenerCount('readable') > 0; - if (state.resumeScheduled && !state.paused) { // flowing needs to be set to true now, otherwise // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume + state.flowing = true; + + // crude way to check if we should resume } else if (self.listenerCount('data') > 0) { self.resume(); } } - 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. - +} +// 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'); // we flow only if there is no one listening + debug('resume'); + // we flow only if there is no one listening // for readable, but we still have to call // resume() - state.flowing = !state.readableListening; resume(this, state); } - state.paused = false; return this; }; - function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; process.nextTick(resume_, stream, state); } } - function resume_(stream, state) { debug('resume', state.reading); - if (!state.reading) { stream.read(0); } - state.resumeScheduled = false; 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 (this._readableState.flowing !== false) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } - this._readableState.paused = true; return this; }; - function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. +// 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 _this = this; - var state = this._readableState; var paused = false; stream.on('end', function () { debug('wrapped end'); - if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) _this.push(chunk); } - _this.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.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 = _this.push(chunk); - if (!ret) { paused = true; stream.pause(); } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. + }); + // 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 methodWrap(method) { @@ -15635,37 +15249,32 @@ Readable.prototype.wrap = function (stream) { }; }(i); } - } // proxy certain important events. - + } + // proxy certain important events. for (var n = 0; n < kProxyEvents.length; n++) { stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. - + } + // when we try to consume some more bytes, simply unpause the + // underlying stream. this._read = function (n) { debug('wrapped _read', n); - if (paused) { paused = false; stream.resume(); } }; - return this; }; - if (typeof Symbol === 'function') { Readable.prototype[Symbol.asyncIterator] = function () { if (createReadableStreamAsyncIterator === undefined) { createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); } - return createReadableStreamAsyncIterator(this); }; } - Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in @@ -15697,8 +15306,9 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', { this._readableState.flowing = state; } } -}); // exposed for testing purposes only. +}); +// exposed for testing purposes only. Readable._fromList = fromList; Object.defineProperty(Readable.prototype, 'readableLength', { // making it explicit this property is not enumerable @@ -15708,11 +15318,12 @@ Object.defineProperty(Readable.prototype, 'readableLength', { get: function get() { return this._readableState.length; } -}); // Pluck off n bytes from an array of buffers. +}); + +// 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; @@ -15727,56 +15338,48 @@ function fromList(n, state) { } return ret; } - function endReadable(stream) { var state = stream._readableState; debug('endReadable', state.endEmitted); - if (!state.endEmitted) { state.ended = true; process.nextTick(endReadableNT, state, stream); } } - function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + debug('endReadableNT', state.endEmitted, state.length); + // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); - if (state.autoDestroy) { // In case of duplex streams we need a way to detect // if the writable side is ready for autoDestroy as well var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { stream.destroy(); } } } } - if (typeof Symbol === 'function') { Readable.from = function (iterable, opts) { if (from === undefined) { from = require('./internal/streams/from'); } - return from(Readable, iterable, opts); }; } - function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } - return -1; } }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":47,"./_stream_duplex":48,"./internal/streams/async_iterator":53,"./internal/streams/buffer_list":54,"./internal/streams/destroy":55,"./internal/streams/from":57,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"events":17,"inherits":27,"string_decoder/":61,"util":7}],51:[function(require,module,exports){ +},{"../errors":52,"./_stream_duplex":53,"./internal/streams/async_iterator":58,"./internal/streams/buffer_list":59,"./internal/streams/destroy":60,"./internal/streams/from":62,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"events":14,"inherits":28,"string_decoder/":69,"util":4}],56:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -15797,6 +15400,7 @@ function indexOf(xs, x) { // 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. + // 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 @@ -15838,42 +15442,36 @@ function indexOf(xs, x) { // 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 _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; var Duplex = require('./_stream_duplex'); - require('inherits')(Transform, Duplex); - function afterTransform(er, data) { var ts = this._transformState; ts.transforming = false; var cb = ts.writecb; - if (cb === null) { return this.emit('error', new ERR_MULTIPLE_CALLBACK()); } - ts.writechunk = null; ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` + if (data != null) + // single equals check for both `null` and `undefined` this.push(data); cb(er); var rs = this._readableState; rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { this._read(rs.highWaterMark); } } - function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); @@ -15884,26 +15482,25 @@ function Transform(options) { writecb: null, writechunk: null, writeencoding: null - }; // start out asking for a readable event once data is transformed. + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; - this._readableState.needReadable = true; // we have implemented the _read method, and done the other things + // 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. - + } + // When the writable side finishes, then flush out anything remaining. this.on('prefinish', prefinish); } - function prefinish() { var _this = this; - if (typeof this._flush === 'function' && !this._readableState.destroyed) { this._flush(function (er, data) { done(_this, er, data); @@ -15912,11 +15509,12 @@ function prefinish() { done(this, null, null); } } - 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! +}; + +// This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // @@ -15926,33 +15524,27 @@ Transform.prototype.push = function (chunk, encoding) { // 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) { cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); }; - 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. +}; + +// 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.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 @@ -15960,25 +15552,25 @@ Transform.prototype._read = function (n) { ts.needTransform = true; } }; - Transform.prototype._destroy = function (err, cb) { Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2); }); }; - function done(stream, er, data) { if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases // if there's nothing in the write buffer, then that means // that nothing more will ever be provided - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); return stream.push(null); } -},{"../errors":47,"./_stream_duplex":48,"inherits":27}],52:[function(require,module,exports){ +},{"../errors":52,"./_stream_duplex":53,"inherits":28}],57:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -16000,29 +15592,29 @@ function done(stream, er, data) { // 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. + // 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; -/* */ +/* */ function WriteReq(chunk, encoding, cb) { this.chunk = chunk; this.encoding = encoding; this.callback = cb; this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - +} +// 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 () { onCorkedFinish(_this, state); }; @@ -16030,155 +15622,159 @@ function CorkedRequest(state) { /* */ /**/ - - var Duplex; /**/ Writable.WritableState = WritableState; -/**/ +/**/ var internalUtil = { deprecate: require('util-deprecate') }; /**/ /**/ - var Stream = require('./internal/streams/stream'); /**/ - var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } - function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } - var destroyImpl = require('./internal/streams/destroy'); - var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - + getHighWaterMark = _require.getHighWaterMark; var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; var errorOrDestroy = destroyImpl.errorOrDestroy; - require('inherits')(Writable, Stream); - function nop() {} - function WritableState(options, stream, isDuplex) { Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share + options = options || {}; + + // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream, // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // object stream flag to indicate whether or not this stream // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false + if (isDuplex) 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() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() + // if _final has been called + this.finalCalled = false; - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted + // 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; - this.finished = false; // has it been destroyed + // has it been destroyed + this.destroyed = false; - this.destroyed = false; // should we decode strings into buffers before passing to _write? + // 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 + 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'; - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement + // 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; - this.length = 0; // a flag to see when we're in the middle of a write. + // a flag to see when we're in the middle of a write. + this.writing = false; - this.writing = false; // when true all writes will be buffered until .uncork() call + // when true all writes will be buffered until .uncork() call + this.corked = 0; - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, + // 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; - this.sync = true; // a flag to know if we're processing previously buffered items, which + // 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; - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - + // 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. + // 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.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs + // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams + this.prefinished = false; - this.prefinished = false; // True if the error was already emitted and should not be thrown again + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; - this.autoDestroy = !!options.autoDestroy; // count buffered requests + // count buffered requests + this.bufferedRequestCount = 0; - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // 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', { @@ -16187,12 +15783,11 @@ WritableState.prototype.getBuffer = function getBuffer() { }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') }); } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. - +})(); +// 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, { @@ -16207,1695 +15802,2377 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot return object instanceof this; }; } - function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. + 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. + // Checking for a Stream.Duplex instance is faster here instead of inside // the WritableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. + this._writableState = new WritableState(options, this, isDuplex); + // legacy. this.writable = true; - if (options) { if (typeof options.write === 'function') this._write = options.write; if (typeof options.writev === 'function') this._writev = options.writev; if (typeof options.destroy === 'function') this._destroy = options.destroy; if (typeof options.final === 'function') this._final = options.final; } - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. - +} +// Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb errorOrDestroy(stream, er); process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular +} + +// 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 er; - if (chunk === null) { er = new ERR_STREAM_NULL_VALUES(); } else if (typeof chunk !== 'string' && !state.objectMode) { er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); } - if (er) { errorOrDestroy(stream, er); process.nextTick(cb, er); return false; } - - return true; + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(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.ending) 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 () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !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 ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// 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) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + 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 = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + 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 (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else 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) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +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; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + 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) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + 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); + } + state.bufferedRequestCount = 0; + } 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; + state.bufferedRequestCount--; + // 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.bufferedRequest = entry; + state.bufferProcessing = false; } - -Writable.prototype.write = function (chunk, encoding, cb) { +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; - var ret = false; - - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { + 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); - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) 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 () { - this._writableState.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - + // .end() fully uncorks if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + state.corked = 1; + this.uncork(); } -}; -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 ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); return this; }; - -Object.defineProperty(Writable.prototype, 'writableBuffer', { +Object.defineProperty(Writable.prototype, 'writableLength', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState && this._writableState.getBuffer(); + return this._writableState.length; } }); - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } } - - return chunk; } +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function get() { - return this._writableState.highWaterMark; - } -}); // 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. + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":52,"./_stream_duplex":53,"./internal/streams/destroy":60,"./internal/streams/state":64,"./internal/streams/stream":65,"_process":51,"buffer":8,"inherits":28,"util-deprecate":71}],58:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = require('./end-of-stream'); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); } - } - - 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 = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); } else { - state.bufferedRequest = state.lastBufferedRequest; + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); } - - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + this[kLastPromise] = promise; + return promise; } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":61,"_process":51}],59:[function(require,module,exports){ +'use strict'; - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = require('buffer'), + Buffer = _require.Buffer; +var _require2 = require('util'), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); } - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error - - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; } -} - -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; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - 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) || stream.destroyed; + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + 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; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; } - } -} - -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; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.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) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; } - buffer.allBuffers = allBuffers; - 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); + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); } + }]); + return BufferList; +}(); +},{"buffer":8,"util":4}],60:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; - state.bufferedRequestCount = 0; - } 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; - state.bufferedRequestCount--; // 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; +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); } } - - if (entry === null) state.lastBufferedRequest = null; + return this; } - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; + if (this._readableState) { + this._readableState.destroyed = true; } - 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) endWritable(this, state, cb); + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); return this; -}; - -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } -}); + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); } +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this)}).call(this,require('_process')) +},{"_process":51}],61:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; +'use strict'; - if (err) { - errorOrDestroy(stream, err); +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); + callback.apply(this, args); + }; } - -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; } +module.exports = eos; +},{"../../../errors":52}],62:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; -function finishMaybe(stream, state) { - var need = needFinish(state); - - if (need) { - prefinish(stream, state); - - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; +},{}],63:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } +'use strict'; - return need; +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; } +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; } - - state.ended = true; - stream.writable = false; + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } +module.exports = pipeline; +},{"../../../errors":52,"./end-of-stream":61}],64:[function(require,module,exports){ +'use strict'; -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. - - - state.corkedRequestsFree.next = corkReq; +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } - -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._writableState.destroyed = value; + return Math.floor(hwm); } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - cb(err); + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark }; -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":47,"./_stream_duplex":48,"./internal/streams/destroy":55,"./internal/streams/state":59,"./internal/streams/stream":60,"_process":44,"buffer":11,"inherits":27,"util-deprecate":63}],53:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; - -var _Object$setPrototypeO; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +},{"../../../errors":52}],65:[function(require,module,exports){ +module.exports = require('events').EventEmitter; -var finished = require('./end-of-stream'); +},{"events":14}],66:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} -function createIterResult(value, done) { - return { - value: value, - done: done - }; +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) } -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; +SafeBuffer.prototype = Object.create(Buffer.prototype) - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') } + return Buffer(arg, encodingOrOffset, length) } -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf } -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} - iter[kHandlePromise](resolve, reject); - }, reject); - }; +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) } -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, +},{"buffer":8}],67:[function(require,module,exports){ +'use strict'; - next: function next() { - var _this = this; +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; +var $TypeError = GetIntrinsic('%TypeError%'); +var $floor = GetIntrinsic('%Math.floor%'); - if (error !== null) { - return Promise.reject(error); - } +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } + var loose = arguments.length > 2 && !!arguments[2]; - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(fn, 'length', length, true, true); + } else { + define(fn, 'length', length); + } + } + return fn; +}; - var lastPromise = this[kLastPromise]; - var promise; +},{"define-data-property":12,"get-intrinsic":18,"gopd":19,"has-property-descriptors":20}],68:[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. - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); +module.exports = Stream; - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } +var EE = require('events').EventEmitter; +var inherits = require('inherits'); - promise = new Promise(this[kHandlePromise]); - } +inherits(Stream, EE); +Stream.Readable = require('readable-stream/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); +function Stream() { + EE.call(this); +} - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error +Stream.prototype.pipe = function(dest, options) { + var source = this; - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); } - - iterator[kError] = err; - return; } + } - var resolve = iterator[kLastResolve]; + source.on('data', ondata); - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); + function ondrain() { + if (source.readable && source.resume) { + source.resume(); } + } - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; + dest.on('drain', ondrain); -module.exports = createReadableStreamAsyncIterator; -}).call(this)}).call(this,require('_process')) -},{"./end-of-stream":56,"_process":44}],54:[function(require,module,exports){ -'use strict'; + // 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); + } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + dest.end(); + } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function onclose() { + if (didOnEnd) return; + didOnEnd = true; -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); } } + if (typeof dest.destroy === 'function') dest.destroy(); + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + // 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. + } + } -var _require = require('buffer'), - Buffer = _require.Buffer; + source.on('error', onerror); + dest.on('error', onerror); -var _require2 = require('util'), - inspect = _require2.inspect; + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); -var custom = inspect && inspect.custom || 'inspect'; + source.removeListener('end', onend); + source.removeListener('close', onclose); -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} + source.removeListener('error', onerror); + dest.removeListener('error', onerror); -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - _classCallCheck(this, BufferList); + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); - this.head = null; - this.tail = null; - this.length = 0; + dest.removeListener('close', cleanup); } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - 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; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - - while (p = p.next) { - ret += s + p.data; - } - - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } + source.on('end', cleanup); + source.on('close', cleanup); - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. + dest.on('close', cleanup); - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; + dest.emit('pipe', source); - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. +},{"events":14,"inherits":28,"readable-stream/lib/_stream_duplex.js":53,"readable-stream/lib/_stream_passthrough.js":54,"readable-stream/lib/_stream_readable.js":55,"readable-stream/lib/_stream_transform.js":56,"readable-stream/lib/_stream_writable.js":57,"readable-stream/lib/internal/streams/end-of-stream.js":61,"readable-stream/lib/internal/streams/pipeline.js":63}],69:[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. - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; +'use strict'; - 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) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } +var Buffer = require('safe-buffer').Buffer; +/**/ - break; - } +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; + } +}; - ++c; - } +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; + } + } +}; - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. +// 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; +} - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; +// 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); +} - 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; +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 || ''; +}; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } +StringDecoder.prototype.end = utf8End; - break; - } +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; - ++c; - } +// 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; +}; - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +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 byte >> 6 === 0x02 ? -1 : -2; +} - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); +// 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 || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } - }]); - - return BufferList; -}(); -},{"buffer":11,"util":7}],55:[function(require,module,exports){ -(function (process){(function (){ -'use strict'; // undocumented cb() API, needed for core, not for public API - -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; + return nb; + } + return 0; +} - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); +// 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 +// a single UTF-8 replacement character ('\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'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; } } + } +} - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well +// 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); +} - if (this._writableState) { - this._writableState.destroyed = true; - } +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); +// 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); } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); } - }); - - return this; + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); } -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); +// 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 emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); +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 undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } +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; +} - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); } -function emitErrorNT(self, err) { - self.emit('error', err); +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; } +},{"safe-buffer":66}],70:[function(require,module,exports){ +(function (setImmediate,clearImmediate){(function (){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; } +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; }; -}).call(this)}).call(this,require('_process')) -},{"_process":44}],56:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); } + }); - callback.apply(this, args); - }; -} + return id; +}; -function noop() {} +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) +},{"process/browser.js":51,"timers":70}],71:[function(require,module,exports){ +(function (global){(function (){ -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} +/** + * Module exports. + */ -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; +module.exports = deprecate; - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; +/** + * 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 + */ - var writableEnded = stream._writableState && stream._writableState.finished; +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; + 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); + } - var readableEnded = stream._readableState && stream._readableState.endEmitted; + return deprecated; +} - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ - var onerror = function onerror(err) { - callback.call(stream, err); - }; +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'; +} - var onclose = function onclose() { - var err; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],72:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],73:[function(require,module,exports){ +(function (process,global){(function (){ +// 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. - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); } + return objects.join(' '); + } - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; } - }; + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; } - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; -} + if (process.noDeprecation === true) { + return fn; + } -module.exports = eos; -},{"../../../errors":47}],57:[function(require,module,exports){ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; }; -},{}],58:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; -var eos; +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); } +exports.inspect = inspect; -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; -function call(fn) { - fn(); + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } } -function pipe(from, to) { - return from.pipe(to); -} -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); +function stylizeNoColor(str, styleType) { + return str; } -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } +function arrayToHash(array) { + var hash = {}; - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); + array.forEach(function(val, idx) { + hash[val] = true; }); - return streams.reduce(pipe); + + return hash; } -module.exports = pipeline; -},{"../../../errors":47,"./end-of-stream":56}],59:[function(require,module,exports){ -'use strict'; -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } - return Math.floor(hwm); - } // Default value + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } - return state.objectMode ? 16 : 16 * 1024; -} + var base = '', array = false, braces = ['{', '}']; -module.exports = { - getHighWaterMark: getHighWaterMark -}; -},{"../../../errors":47}],60:[function(require,module,exports){ -module.exports = require('events').EventEmitter; + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } -},{"events":17}],61:[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. + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } -'use strict'; + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } -/**/ + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } -var Buffer = require('safe-buffer').Buffer; -/**/ + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } -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; + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; } -}; -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; + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); } } -}; -// 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; -} + ctx.seen.push(value); -// 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; + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); } -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; +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} -// 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. If an invalid byte is detected, -2 is returned. -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 byte >> 6 === 0x02 ? -1 : -2; +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; } -// 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; + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); } - 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 -// a single UTF-8 replacement character ('\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'; } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); } } + + return name + ': ' + str; } -// 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); + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } -// 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); + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); } +exports.isArray = isArray; -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; +function isBoolean(arg) { + return typeof arg === 'boolean'; } +exports.isBoolean = isBoolean; -// 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); +function isNull(arg) { + return arg === null; } +exports.isNull = isNull; -// 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 isNullOrUndefined(arg) { + return arg == null; } +exports.isNullOrUndefined = isNullOrUndefined; -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 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 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; +function isUndefined(arg) { + return arg === void 0; } +exports.isUndefined = isUndefined; -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; } +exports.isRegExp = isRegExp; -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; } -},{"safe-buffer":45}],62:[function(require,module,exports){ -(function (setImmediate,clearImmediate){(function (){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; +exports.isObject = isObject; -// DOM APIs, for completeness +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; +function isFunction(arg) { + return typeof arg === 'function'; } -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; +exports.isFunction = isFunction; -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; +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.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; +exports.isBuffer = require('./support/isBuffer'); -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); +function objectToString(o) { + return Object.prototype.toString.call(o); +} - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} - immediateIds[id] = true; - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; - return id; -}; +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":44,"timers":62}],63:[function(require,module,exports){ -(function (global){(function (){ -/** - * Module exports. - */ +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; -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. + * Inherit the prototype methods from one constructor into another. * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). * - * @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 + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. */ +exports.inherits = require('inherits'); -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; - 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); + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; } + return origin; +}; - 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'; +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],64:[function(require,module,exports){ -arguments[4][3][0].apply(exports,arguments) -},{"dup":3}],65:[function(require,module,exports){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":72,"_process":51,"inherits":27}],74:[function(require,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"dup":72}],75:[function(require,module,exports){ // Currently in sync with Node.js lib/internal/util/types.js // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 @@ -18231,7 +18508,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer; }); }); -},{"is-arguments":28,"is-generator-function":29,"is-typed-array":30,"which-typed-array":69}],66:[function(require,module,exports){ +},{"is-arguments":29,"is-generator-function":31,"is-typed-array":32,"which-typed-array":79}],76:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -18645,7 +18922,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; - }).join('\n').substr(2); + }).join('\n').slice(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; @@ -18662,7 +18939,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); + name = name.slice(1, -1); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") @@ -18950,7 +19227,7 @@ function callbackify(original) { exports.callbackify = callbackify; }).call(this)}).call(this,require('_process')) -},{"./support/isBuffer":64,"./support/types":65,"_process":44,"inherits":27}],67:[function(require,module,exports){ +},{"./support/isBuffer":74,"./support/types":75,"_process":51,"inherits":28}],77:[function(require,module,exports){ function webpackBootstrapFunc (modules) { /******/ // The module cache /******/ var installedModules = {}; @@ -19154,7 +19431,7 @@ module.exports = function (moduleId, options) { return worker } -},{}],68:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -19236,13 +19513,15 @@ module.exports = function (fn, options) { return worker; }; -},{}],69:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ (function (global){(function (){ 'use strict'; -var forEach = require('foreach'); +var forEach = require('for-each'); var availableTypedArrays = require('available-typed-arrays'); +var callBind = require('call-bind'); var callBound = require('call-bind/callBound'); +var gOPD = require('gopd'); var $toString = callBound('Object.prototype.toString'); var hasToStringTag = require('has-tostringtag/shams')(); @@ -19251,59 +19530,94 @@ var g = typeof globalThis === 'undefined' ? global : globalThis; var typedArrays = availableTypedArrays(); var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var cache = { __proto__: null }; if (hasToStringTag && gOPD && getPrototypeOf) { forEach(typedArrays, function (typedArray) { - if (typeof g[typedArray] === 'function') { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); } + cache['$' + typedArray] = callBind(descriptor.get); + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + cache['$' + typedArray] = callBind(fn); } }); } var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function (getter, typedArray) { - if (!foundName) { + var found = false; + forEach(cache, function (getter, typedArray) { + if (!found) { try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; + if ('$' + getter(value) === typedArray) { + found = $slice(typedArray, 1); } - } catch (e) {} + } catch (e) { /**/ } } }); - return foundName; + return found; }; -var isTypedArray = require('is-typed-array'); +var trySlices = function tryAllSlices(value) { + var found = false; + forEach(cache, function (getter, name) { + if (!found) { + try { + getter(value); + found = $slice(name, 1); + } catch (e) { /**/ } + } + }); + return found; +}; module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + var tag = $slice($toString(value), 8, -1); + if ($indexOf(typedArrays, tag) > -1) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine return tryTypedArrays(value); }; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"available-typed-arrays":5,"call-bind/callBound":12,"es-abstract/helpers/getOwnPropertyDescriptor":15,"foreach":18,"has-tostringtag/shams":24,"is-typed-array":30}],70:[function(require,module,exports){ +},{"available-typed-arrays":2,"call-bind":10,"call-bind/callBound":9,"for-each":15,"gopd":19,"has-tostringtag/shams":24}],80:[function(require,module,exports){ exports.DOMImplementation = window.DOMImplementation; exports.XMLSerializer = window.XMLSerializer; exports.DOMParser = window.DOMParser; -},{}],71:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ module.exports = typeof window !== 'undefined' ? window.WebSocket : WebSocket; -},{}],72:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19333,13 +19647,13 @@ var ROSLIB = __assign(__assign(__assign(__assign(__assign({ REVISION: '1.3.0' }, require('./core')), require('./actionlib')), require('./math')), require('./tf')), require('./urdf')); module.exports = ROSLIB; -},{"./actionlib":78,"./core":91,"./math":96,"./tf":98,"./urdf":110}],73:[function(require,module,exports){ +},{"./actionlib":88,"./core":101,"./math":106,"./tf":108,"./urdf":120}],83:[function(require,module,exports){ (function (global){(function (){ "use strict"; global.ROSLIB = require('./RosLib'); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./RosLib":72}],74:[function(require,module,exports){ +},{"./RosLib":82}],84:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19497,7 +19811,7 @@ var ActionClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionClient; -},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],75:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],85:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19591,7 +19905,7 @@ var ActionListener = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = ActionListener; -},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],76:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],86:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19695,7 +20009,7 @@ var Goal = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Goal; -},{"../core/Message":83,"./ActionClient":74,"eventemitter2":16}],77:[function(require,module,exports){ +},{"../core/Message":93,"./ActionClient":84,"eventemitter2":13}],87:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19939,7 +20253,7 @@ var SimpleActionServer = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = SimpleActionServer; -},{"../core/Message":83,"../core/Ros":85,"../core/Topic":90,"eventemitter2":16}],78:[function(require,module,exports){ +},{"../core/Message":93,"../core/Ros":95,"../core/Topic":100,"eventemitter2":13}],88:[function(require,module,exports){ "use strict"; module.exports = { ActionClient: require('./ActionClient'), @@ -19948,7 +20262,7 @@ module.exports = { SimpleActionServer: require('./SimpleActionServer') }; -},{"./ActionClient":74,"./ActionListener":75,"./Goal":76,"./SimpleActionServer":77}],79:[function(require,module,exports){ +},{"./ActionClient":84,"./ActionListener":85,"./Goal":86,"./SimpleActionServer":87}],89:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -19998,7 +20312,7 @@ var Action = /** @class */ (function (_super) { } /** * @callback sendGoalResultCallback - * @param {TResult} result - The result from the action. + * @param {TResult} result - The result from the action. */ /** * @callback sendGoalFeedbackCallback @@ -20065,23 +20379,27 @@ var Action = /** @class */ (function (_super) { this.ros.callOnConnection(call); }; /** - * @callback advertiseCallback + * @callback advertiseActionCallback * @param {TGoal} goal - The action goal. - * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the action has finished successfully, - * i.e., without any fatal errors. + * @param {string} id - The ID of the action goal to execute. + */ + /** + * @callback advertiseCancelCallback + * @param {string} id - The ID of the action goal to cancel. */ /** * Advertise the action. This turns the Action object from a client * into a server. The callback will be called with every goal sent to this action. * - * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. + * @param {advertiseActionCallback} actionCallback - This works similarly to the callback for a C++ action. + * @param {advertiseCancelCallback} cancelCallback - A callback function to execute when the action is canceled. */ - Action.prototype.advertise = function (callback) { - if (this.isAdvertised || typeof callback !== 'function') { + Action.prototype.advertise = function (actionCallback, cancelCallback) { + if (this.isAdvertised || typeof actionCallback !== 'function') { return; } - this._actionCallback = callback; + this._actionCallback = actionCallback; + this._cancelCallback = cancelCallback; this.ros.on(this.name, this._executeAction.bind(this)); this.ros.callOnConnection({ op: 'advertise_action', @@ -20112,10 +20430,20 @@ var Action = /** @class */ (function (_super) { * @param {string} rosbridgeRequest.id - The ID of the action goal. */ Action.prototype._executeAction = function (rosbridgeRequest) { + var _this = this; var id; if (rosbridgeRequest.id) { id = rosbridgeRequest.id; } + // If a cancellation callback exists, call it when a cancellation event is emitted. + if (typeof id === 'string') { + this.ros.on(id, function (message) { + if (message.op === 'cancel_action_goal' && typeof _this._cancelCallback === 'function') { + _this._cancelCallback(id); + } + }); + } + // Call the goal execution function provided. // @ts-expect-error -- possibly null this._actionCallback(rosbridgeRequest.args, id); }; @@ -20168,7 +20496,7 @@ var Action = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Action; -},{"../core/Ros":85,"./ActionFeedback":80,"./ActionGoal":81,"./ActionResult":82,"eventemitter2":16}],80:[function(require,module,exports){ +},{"../core/Ros":95,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"eventemitter2":13}],90:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20192,7 +20520,7 @@ var ActionFeedback = /** @class */ (function () { }()); module.exports = ActionFeedback; -},{"object-assign":31}],81:[function(require,module,exports){ +},{"object-assign":33}],91:[function(require,module,exports){ "use strict"; /** * @fileoverview @@ -20216,7 +20544,7 @@ var ActionGoal = /** @class */ (function () { }()); module.exports = ActionGoal; -},{"object-assign":31}],82:[function(require,module,exports){ +},{"object-assign":33}],92:[function(require,module,exports){ "use strict"; /** * @fileoverview @@ -20240,7 +20568,7 @@ var ActionResult = /** @class */ (function () { }()); module.exports = ActionResult; -},{"object-assign":31}],83:[function(require,module,exports){ +},{"object-assign":33}],93:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20264,7 +20592,7 @@ var Message = /** @class */ (function () { }()); module.exports = Message; -},{"object-assign":31}],84:[function(require,module,exports){ +},{"object-assign":33}],94:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -20362,7 +20690,7 @@ var Param = /** @class */ (function () { }()); module.exports = Param; -},{"../core/Ros":85,"./Service":86,"./ServiceRequest":87}],85:[function(require,module,exports){ +},{"../core/Ros":95,"./Service":96,"./ServiceRequest":97}],95:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21176,7 +21504,7 @@ var Ros = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Ros; -},{"../actionlib":78,"../tf":98,"../util/workerSocket":113,"./Param":84,"./Service":86,"./ServiceRequest":87,"./ServiceResponse":88,"./SocketAdapter.js":89,"./Topic":90,"eventemitter2":16,"object-assign":31,"ws":71}],86:[function(require,module,exports){ +},{"../actionlib":88,"../tf":108,"../util/workerSocket":123,"./Param":94,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./SocketAdapter.js":99,"./Topic":100,"eventemitter2":13,"object-assign":33,"ws":81}],96:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21321,7 +21649,7 @@ var Service = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Service; -},{"../core/Ros":85,"./ServiceRequest":87,"./ServiceResponse":88,"eventemitter2":16}],87:[function(require,module,exports){ +},{"../core/Ros":95,"./ServiceRequest":97,"./ServiceResponse":98,"eventemitter2":13}],97:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21345,7 +21673,7 @@ var ServiceRequest = /** @class */ (function () { }()); module.exports = ServiceRequest; -},{"object-assign":31}],88:[function(require,module,exports){ +},{"object-assign":33}],98:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21369,7 +21697,7 @@ var ServiceResponse = /** @class */ (function () { }()); module.exports = ServiceResponse; -},{"object-assign":31}],89:[function(require,module,exports){ +},{"object-assign":33}],99:[function(require,module,exports){ /** * Socket event handling utilities for handling events on either * WebSocket and TCP sockets @@ -21514,7 +21842,7 @@ function SocketAdapter(client) { } module.exports = SocketAdapter; -},{"../util/cborTypedArrayTags":111,"../util/decompressPng":112,"cbor-js":14}],90:[function(require,module,exports){ +},{"../util/cborTypedArrayTags":121,"../util/decompressPng":122,"cbor-js":11}],100:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21746,7 +22074,7 @@ var Topic = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = Topic; -},{"../core/Ros":85,"./Message":83,"eventemitter2":16}],91:[function(require,module,exports){ +},{"../core/Ros":95,"./Message":93,"eventemitter2":13}],101:[function(require,module,exports){ "use strict"; module.exports = { Ros: require('./Ros'), @@ -21762,7 +22090,7 @@ module.exports = { ActionResult: require('./ActionResult') }; -},{"./Action":79,"./ActionFeedback":80,"./ActionGoal":81,"./ActionResult":82,"./Message":83,"./Param":84,"./Ros":85,"./Service":86,"./ServiceRequest":87,"./ServiceResponse":88,"./Topic":90}],92:[function(require,module,exports){ +},{"./Action":89,"./ActionFeedback":90,"./ActionGoal":91,"./ActionResult":92,"./Message":93,"./Param":94,"./Ros":95,"./Service":96,"./ServiceRequest":97,"./ServiceResponse":98,"./Topic":100}],102:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21838,7 +22166,7 @@ var Pose = /** @class */ (function () { }()); module.exports = Pose; -},{"./Quaternion":93,"./Transform":94,"./Vector3":95}],93:[function(require,module,exports){ +},{"./Quaternion":103,"./Transform":104,"./Vector3":105}],103:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21929,7 +22257,7 @@ var Quaternion = /** @class */ (function () { }()); module.exports = Quaternion; -},{}],94:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -21963,7 +22291,7 @@ var Transform = /** @class */ (function () { }()); module.exports = Transform; -},{"./Quaternion":93,"./Vector3":95}],95:[function(require,module,exports){ +},{"./Quaternion":103,"./Vector3":105}],105:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22032,7 +22360,7 @@ var Vector3 = /** @class */ (function () { }()); module.exports = Vector3; -},{"./Quaternion":93}],96:[function(require,module,exports){ +},{"./Quaternion":103}],106:[function(require,module,exports){ "use strict"; module.exports = { Pose: require('./Pose'), @@ -22041,7 +22369,7 @@ module.exports = { Vector3: require('./Vector3') }; -},{"./Pose":92,"./Quaternion":93,"./Transform":94,"./Vector3":95}],97:[function(require,module,exports){ +},{"./Pose":102,"./Quaternion":103,"./Transform":104,"./Vector3":105}],107:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22280,13 +22608,13 @@ var TFClient = /** @class */ (function (_super) { }(EventEmitter2)); module.exports = TFClient; -},{"../actionlib/ActionClient":74,"../actionlib/Goal":76,"../core/Ros":85,"../core/Service.js":86,"../core/ServiceRequest.js":87,"../core/Topic.js":90,"../math/Transform":94,"eventemitter2":16}],98:[function(require,module,exports){ +},{"../actionlib/ActionClient":84,"../actionlib/Goal":86,"../core/Ros":95,"../core/Service.js":96,"../core/ServiceRequest.js":97,"../core/Topic.js":100,"../math/Transform":104,"eventemitter2":13}],108:[function(require,module,exports){ "use strict"; module.exports = { TFClient: require('./TFClient') }; -},{"./TFClient":97}],99:[function(require,module,exports){ +},{"./TFClient":107}],109:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22319,7 +22647,7 @@ var UrdfBox = /** @class */ (function () { }()); module.exports = UrdfBox; -},{"../math/Vector3":95,"./UrdfTypes":108}],100:[function(require,module,exports){ +},{"../math/Vector3":105,"./UrdfTypes":118}],110:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22347,7 +22675,7 @@ var UrdfColor = /** @class */ (function () { }()); module.exports = UrdfColor; -},{}],101:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22374,7 +22702,7 @@ var UrdfCylinder = /** @class */ (function () { }()); module.exports = UrdfCylinder; -},{"./UrdfTypes":108}],102:[function(require,module,exports){ +},{"./UrdfTypes":118}],112:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22463,7 +22791,7 @@ var UrdfJoint = /** @class */ (function () { }()); module.exports = UrdfJoint; -},{"../math/Pose":92,"../math/Quaternion":93,"../math/Vector3":95}],103:[function(require,module,exports){ +},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105}],113:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22493,7 +22821,7 @@ var UrdfLink = /** @class */ (function () { }()); module.exports = UrdfLink; -},{"./UrdfVisual":109}],104:[function(require,module,exports){ +},{"./UrdfVisual":119}],114:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22538,7 +22866,7 @@ var UrdfMaterial = /** @class */ (function () { var assign = require('object-assign'); module.exports = UrdfMaterial; -},{"./UrdfColor":100,"object-assign":31}],105:[function(require,module,exports){ +},{"./UrdfColor":110,"object-assign":33}],115:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22575,7 +22903,7 @@ var UrdfMesh = /** @class */ (function () { }()); module.exports = UrdfMesh; -},{"../math/Vector3":95,"./UrdfTypes":108}],106:[function(require,module,exports){ +},{"../math/Vector3":105,"./UrdfTypes":118}],116:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22676,7 +23004,7 @@ var UrdfModel = /** @class */ (function () { }()); module.exports = UrdfModel; -},{"./UrdfJoint":102,"./UrdfLink":103,"./UrdfMaterial":104,"@xmldom/xmldom":70}],107:[function(require,module,exports){ +},{"./UrdfJoint":112,"./UrdfLink":113,"./UrdfMaterial":114,"@xmldom/xmldom":80}],117:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22700,7 +23028,7 @@ var UrdfSphere = /** @class */ (function () { }()); module.exports = UrdfSphere; -},{"./UrdfTypes":108}],108:[function(require,module,exports){ +},{"./UrdfTypes":118}],118:[function(require,module,exports){ "use strict"; module.exports = { URDF_SPHERE: 0, @@ -22709,7 +23037,7 @@ module.exports = { URDF_MESH: 3 }; -},{}],109:[function(require,module,exports){ +},{}],119:[function(require,module,exports){ "use strict"; /** * @fileOverview @@ -22844,7 +23172,7 @@ var UrdfVisual = /** @class */ (function () { }()); module.exports = UrdfVisual; -},{"../math/Pose":92,"../math/Quaternion":93,"../math/Vector3":95,"./UrdfBox":99,"./UrdfCylinder":101,"./UrdfMaterial":104,"./UrdfMesh":105,"./UrdfSphere":107}],110:[function(require,module,exports){ +},{"../math/Pose":102,"../math/Quaternion":103,"../math/Vector3":105,"./UrdfBox":109,"./UrdfCylinder":111,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfSphere":117}],120:[function(require,module,exports){ "use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { @@ -22859,7 +23187,7 @@ var __assign = (this && this.__assign) || function () { }; module.exports = __assign({ UrdfBox: require('./UrdfBox'), UrdfColor: require('./UrdfColor'), UrdfCylinder: require('./UrdfCylinder'), UrdfLink: require('./UrdfLink'), UrdfMaterial: require('./UrdfMaterial'), UrdfMesh: require('./UrdfMesh'), UrdfModel: require('./UrdfModel'), UrdfSphere: require('./UrdfSphere'), UrdfVisual: require('./UrdfVisual') }, require('./UrdfTypes')); -},{"./UrdfBox":99,"./UrdfColor":100,"./UrdfCylinder":101,"./UrdfLink":103,"./UrdfMaterial":104,"./UrdfMesh":105,"./UrdfModel":106,"./UrdfSphere":107,"./UrdfTypes":108,"./UrdfVisual":109}],111:[function(require,module,exports){ +},{"./UrdfBox":109,"./UrdfColor":110,"./UrdfCylinder":111,"./UrdfLink":113,"./UrdfMaterial":114,"./UrdfMesh":115,"./UrdfModel":116,"./UrdfSphere":117,"./UrdfTypes":118,"./UrdfVisual":119}],121:[function(require,module,exports){ 'use strict'; var UPPER32 = Math.pow(2, 32); var warnedPrecision = false; @@ -22963,7 +23291,7 @@ if (typeof module !== 'undefined' && module.exports) { module.exports = cborTypedArrayTagger; } -},{}],112:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ (function (Buffer){(function (){ /** * @fileOverview @@ -22999,7 +23327,7 @@ function decompressPng(data, callback) { module.exports = decompressPng; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":11,"pngparse":43}],113:[function(require,module,exports){ +},{"buffer":8,"pngparse":50}],123:[function(require,module,exports){ "use strict"; try { // @ts-expect-error -- webworker include workarounds I don't know enough about to fix right now @@ -23058,7 +23386,7 @@ var WorkerSocket = /** @class */ (function () { }()); module.exports = WorkerSocket; -},{"./workerSocketImpl":114,"webworkify":68,"webworkify-webpack":67}],114:[function(require,module,exports){ +},{"./workerSocketImpl":124,"webworkify":78,"webworkify-webpack":77}],124:[function(require,module,exports){ "use strict"; var WebSocket = WebSocket || require('ws'); module.exports = function (self) { @@ -23105,4 +23433,4 @@ module.exports = function (self) { }); }; -},{"ws":71}]},{},[73]); +},{"ws":81}]},{},[83]); diff --git a/build/roslib.min.js b/build/roslib.min.js index e98900012..1b8de86fe 100644 --- a/build/roslib.min.js +++ b/build/roslib.min.js @@ -1 +1 @@ -!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var l="function"==typeof require&&require,e=0;e>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,u(this.init_done,"close before init"),u(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(u.equal(arguments.length,8),u(this.init_done,"write before init"),u(this.mode!==h.NONE,"already finalized"),u.equal(!1,this.write_in_progress,"write already in progress"),u.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,u.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");if(null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,!e)return this._process(),this._checkError()?this._afterSync():void 0;var l=this;return c.nextTick(function(){l._process(),l._after()}),this},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),c(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(S,o),S.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},S.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},S.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},S.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},S.prototype.close=function(e){A(this,e),T.nextTick(x,this)},S.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},S.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,u=0,c=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,u,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(m<=p)throw A(this),new RangeError(b);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,u,a,this._buffer,this._offset,l);function d(e,t){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var r,n=l-t;if(g(0<=n,"have should not go down"),0=c._chunkSize)&&(l=c._chunkSize,c._offset=0,c._buffer=y.allocUnsafe(c._chunkSize)),0===t){if(u+=a-e,a=e,!f)return!0;n=c._handle.write(o,i,u,a,c._buffer,c._offset,c._chunkSize);return n.callback=d,void(n.buffer=i)}if(!f)return!1;s()}}r.buffer=i,r.callback=d},e.inherits(h,S),e.inherits(p,S),e.inherits(d,S),e.inherits(_,S),e.inherits(v,S),e.inherits(w,S),e.inherits(E,S)}.call(this)}.call(this,O("_process"))},{"./binding":8,_process:44,assert:1,buffer:11,stream:46,util:66}],10:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],11:[function(j,e,M){!function(e){!function(){"use strict";var S=j("base64-js"),o=j("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var u=-1,c=r;c>8,n=n%256,i.push(n),i.push(r);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}var h=n,p=h.length;if(p<=b)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var u=this,c=e,f=t,h=r,p=(f=Number(f)||0,u.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=c.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return S.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}.call(this)}.call(this,j("buffer").Buffer)},{"base64-js":6,buffer:11,ieee754:26}],12:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=65536+((o=(1023&o)<<10)|1023&t.charCodeAt(++i)),n.push(240|o>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof m&&(m=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=k(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(b.getFloat32(_),4);case 27:return v(b.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console&&console.warn&&console.warn(r))),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,u)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]:(l=_(o,u),o[u]),l&&!s&&(m[c]=o)}}return o}},{"function-bind":20,has:25,"has-symbols":22}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";e=e("function-bind");t.exports=e.call(Function.call,Object.prototype.hasOwnProperty)},{"function-bind":20}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-c)-1,i>>=-c,c+=a;0>=-c,c+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+c?f/n:f*Math.pow(2,1-c))*n&&(s++,n/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(t*n-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],36:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),u=0,c=4,d=0,y=-2,C=-1,B=4,D=2,g=8,z=9,r=286,Z=30,G=19,q=2*r+1,W=15,m=3,b=258,_=b+m+1,v=42,w=113,E=1,k=2,S=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function L(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+b,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===d&&u[r+s-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){for(o+=2,r++;u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,u,c=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=c+(c-_)){for(f.arraySet(e.window,e.window,c,c,0),e.match_start-=c,e.strstart-=c,e.block_start-=c,t=r=e.hash_size;n=e.head[--t],e.head[t]=c<=n?n-c:0,--r;);for(t=r=c;n=e.prev[--t],e.prev[t]=c<=n?n-c:0,--r;);l+=c}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,u=void 0,u=o.avail_in,r=0===(u=l=m)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-m),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=m){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=m&&(e.ins_h=(e.ins_h<=m&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-m,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-m),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===u)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,L(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?S:A):(e.strstart>e.block_start&&(L(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),j(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)j(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==c)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===u)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?S:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:k}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=b){if(N(e),e.lookahead<=b&&t===u)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=m&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=m?(r=l._tr_tally(e,1,e.match_length-m),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(L(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===c?(L(e,!0),0===e.strm.avail_out?S:A):e.last_lit&&(L(e,!1),0===e.strm.avail_out)?E:k}(n,t):a[n.level].func(n,t);if(s!==S&&s!==A||(n.status=666),s===E||s===S)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===k&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==c?d:n.wrap<=0?1:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,u-r.w_size,r.w_size,0),t=l,u=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=u,e.next_in=0,e.input=t,N(r);r.lookahead>=m;){for(n=r.strstart,i=r.lookahead-(m-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=c[u++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=u-=i,e.next_out=h,e.avail_in=u>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new j.Buf32(n),t.distcode=t.distdyn=new j.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(j.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),j.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(j.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),c=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=N(r.check,T,4,0)),c=u=0,r.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>8),512&r.flags&&(T[0]=255&u,T[1]=u>>>8&255,r.check=N(r.check,T,2,0)),c=u=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break e;a--,u+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),c=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),j.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,u+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break e;a--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=L=void 0;var R,L=r;if(q){for(Z=new j.Buf32(512),G=new j.Buf32(32),R=0;R<144;)L.lens[R++]=8;for(;R<256;)L.lens[R++]=9;for(;R<280;)L.lens[R++]=7;for(;R<288;)L.lens[R++]=8;for(I(P,L.lens,0,288,Z,0,L.work,{bits:9}),R=0;R<32;)L.lens[R++]=5;I(F,L.lens,0,32,G,0,L.work,{bits:5}),q=!1}if(L.lencode=Z,L.lenbits=9,L.distcode=G,L.distbits=5,r.mode=20,6!==t)break;u>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,c-=2;break;case 14:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,c=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,c-=5,r.ndist=1+(31&u),u>>>=5,c-=5,r.ncode=4+(15&u),u>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},k=I(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,k){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(A=g+2;c>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,c-=2}else if(17===b){for(A=g+3;c>>=g)),u>>>=3,c=c-g-3}else{for(A=g+7;c>>=g)),u>>>=7,c=c-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},k=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,k){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},k=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,k){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=u,r.bits=c,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,u=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(x=r.lencode[u&(1<>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,r.length=b,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(x=r.distcode[u&(1<>>16&255,b=65535&x,!((g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>_)])>>>16&255,b=65535&x,!(_+(g=x>>>24)<=c);){if(0===a)break e;a--,u+=n[o++]<>>=_,c-=_,r.back+=_}if(u>>>=g,c-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(A=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=b-S),v=u=1<>S)+(u-=l)]=d<<24|y<<16|g|0,0!==u;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--L[b]){if(b===w)break;b=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=z(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var c,f,h,p,d,y=e,g=t.dyn_tree,m=t.max_code,b=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,k=0,S=0;S<=x;S++)y.bl_count[S]=0;for(g[2*y.heap[y.heap_max]+1]=0,c=y.heap_max+1;c>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)Y(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,S,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,u=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,u-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,m,S),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":32}],42:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],43:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,m,b,_,v,w,E,k,S,l,A,x,T,O=i.createInflate(),u=0,c=0,f=new I(13),e=2,R=-1,L=0,j=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,m,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),m&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),L!==m.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(u){case 0:if(e[i++]!==h[c++])return N(new Error("Invalid PNG header."));c===h.length&&(u=1,c=0);break;case 1:if(n-i<8-c)e.copy(f,c,i),c+=n-i,i=n;else switch(e.copy(f,c,i,i+8-c),i+=8-c,c=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":u=2;break;case"PLTE":if(3!==g)u=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));j=s/3,A=new I(s),u=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),u=4;break;case"IDAT":m=m||new I(p*a*T),u=5;break;case"IEND":u=6;break;default:u=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?k[R]:(o=E[R-_],s=k[R],a=k[R-_],l=c=u=l=void 0,l=o+s-a,u=Math.abs(l-o),c=Math.abs(l-s),l=Math.abs(l-a),u<=c&&u<=l?o:c<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+S))}if(++R===v){if(L===m.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==b;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:m[L++]=w[0]*y;break;case 2:m[L++]=w[0]*y,m[L++]=w[1]*y,m[L++]=w[2]*y;break;case 3:if(w[0]>=j)return N(new Error("Invalid palette index."));switch(T){case 1:m[L++]=A[3*w[0]];break;case 2:m[L++]=A[3*w[0]],m[L++]=w[0]o.length)&&(a=o.length),o=o.substring(a-s.length,a)===s?"The ".concat(e," ").concat(n," ").concat(l(t,"type")):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(l(t,"type"))),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(c,f,e){!function(u){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,c("./_stream_readable")),r=c("./_stream_writable");c("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(k<=(r=e)?r=k:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,a.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),e}()},{buffer:11,util:7}],55:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:44}],56:[function(e,t,r){"use strict";var m=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function b(){}t.exports=function e(t,r,n){if("function"==typeof r)return e(t,null,r);function i(){t.writable||o()}function o(){y=!(d=!1),p||n.call(t)}function s(){g=!(p=!1),d||n.call(t)}function a(e){n.call(t,e)}function l(){var e;return p&&!g?(t._readableState&&t._readableState.ended||(e=new m),n.call(t,e)):d&&!y?(t._writableState&&t._writableState.ended||(e=new m),n.call(t,e)):void 0}function u(){t.req.on("finish",o)}c=n||b,f=!1,n=function(){if(!f){f=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs>16&255,o[s++]=t>>8&255,o[s++]=255&t;2===n&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,o[s++]=255&t);1===n&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return i.join("")}(e,o,s>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;ih.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}r.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,c(this.init_done,"close before init"),c(this.mode<=h.UNZIP),this.mode===h.DEFLATE||this.mode===h.GZIP||this.mode===h.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==h.INFLATE&&this.mode!==h.GUNZIP&&this.mode!==h.INFLATERAW&&this.mode!==h.UNZIP||a.inflateEnd(this.strm),this.mode=h.NONE,this.dictionary=null)},r.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},r.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},r.prototype._write=function(e,t,r,n,i,o,s,a){if(c.equal(arguments.length,8),c(this.init_done,"write before init"),c(this.mode!==h.NONE,"already finalized"),c.equal(!1,this.write_in_progress,"write already in progress"),c.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,c.equal(!1,void 0===t,"must provide flush value"),this.write_in_progress=!0,t!==h.Z_NO_FLUSH&&t!==h.Z_PARTIAL_FLUSH&&t!==h.Z_SYNC_FLUSH&&t!==h.Z_FULL_FLUSH&&t!==h.Z_FINISH&&t!==h.Z_BLOCK)throw new Error("Invalid flush value");var l;return null==r&&(r=f.alloc(0),n=i=0),this.strm.avail_in=i,this.strm.input=r,this.strm.next_in=n,this.strm.avail_out=a,this.strm.output=o,this.strm.next_out=s,this.flush=t,e?(l=this,u.nextTick(function(){l._process(),l._after()}),this):(this._process(),this._checkError()?this._afterSync():void 0)},r.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},r.prototype._process=function(){var e=null;switch(this.mode){case h.DEFLATE:case h.GZIP:case h.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case h.UNZIP:switch(0R.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsR.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelR.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelR.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=R.Z_FILTERED&&e.strategy!=R.Z_HUFFMAN_ONLY&&e.strategy!=R.Z_RLE&&e.strategy!=R.Z_FIXED&&e.strategy!=R.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!y.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new s.Zlib(t);var n=this,t=(this._hadError=!1,this._handle.onerror=function(e,t){A(n),n._hadError=!0;e=new Error(e);e.errno=t,e.code=R.codes[t],n.emit("error",e)},R.Z_DEFAULT_COMPRESSION),i=("number"==typeof e.level&&(t=e.level),R.Z_DEFAULT_STRATEGY);"number"==typeof e.strategy&&(i=e.strategy),this._handle.init(e.windowBits||R.Z_DEFAULT_WINDOWBITS,t,e.memLevel||R.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=y.allocUnsafe(this._chunkSize),this._offset=0,this._level=t,this._strategy=i,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function A(e,t){t&&T.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(R,"codes",{enumerable:!0,value:Object.freeze(i),writable:!1}),R.Deflate=h,R.Inflate=p,R.Gzip=d,R.Gunzip=_,R.DeflateRaw=v,R.InflateRaw=w,R.Unzip=E,R.createDeflate=function(e){return new h(e)},R.createInflate=function(e){return new p(e)},R.createDeflateRaw=function(e){return new v(e)},R.createInflateRaw=function(e){return new w(e)},R.createGzip=function(e){return new d(e)},R.createGunzip=function(e){return new _(e)},R.createUnzip=function(e){return new E(e)},R.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new h(t),e,r)},R.deflateSync=function(e,t){return f(new h(t),e)},R.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new d(t),e,r)},R.gzipSync=function(e,t){return f(new d(t),e)},R.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new v(t),e,r)},R.deflateRawSync=function(e,t){return f(new v(t),e)},R.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new E(t),e,r)},R.unzipSync=function(e,t){return f(new E(t),e)},R.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new p(t),e,r)},R.inflateSync=function(e,t){return f(new p(t),e)},R.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new _(t),e,r)},R.gunzipSync=function(e,t){return f(new _(t),e)},R.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),u(new w(t),e,r)},R.inflateRawSync=function(e,t){return f(new w(t),e)},e.inherits(S,o),S.prototype.params=function(e,t,r){if(eR.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=R.Z_FILTERED&&t!=R.Z_HUFFMAN_ONLY&&t!=R.Z_RLE&&t!=R.Z_FIXED&&t!=R.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);var n;this._level!==e||this._strategy!==t?(n=this).flush(s.Z_SYNC_FLUSH,function(){g(n._handle,"zlib binding closed"),n._handle.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}):T.nextTick(r)},S.prototype.reset=function(){return g(this._handle,"zlib binding closed"),this._handle.reset()},S.prototype._flush=function(e){this._transform(y.alloc(0),"",e)},S.prototype.flush=function(e,t){var r=this,n=this._writableState;"function"!=typeof e&&(void 0!==e||t)||(t=e,e=s.Z_FULL_FLUSH),n.ended?t&&T.nextTick(t):n.ending?t&&this.once("end",t):n.needDrain?t&&this.once("drain",function(){return r.flush(e,t)}):(this._flushFlag=e,this.write(y.alloc(0),"",t))},S.prototype.close=function(e){A(this,e),T.nextTick(x,this)},S.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);return null===e||y.isBuffer(e)?this._handle?(o?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||s.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},S.prototype._processChunk=function(i,o,s){var a=i&&i.length,l=this._chunkSize-this._offset,c=0,u=this,f="function"==typeof s;if(!f){var t,h=[],p=0;this.on("error",function(e){t=e}),g(this._handle,"zlib binding closed");do{var e=this._handle.writeSync(o,i,c,a,this._buffer,this._offset,l)}while(!this._hadError&&d(e[0],e[1]));if(this._hadError)throw t;if(b<=p)throw A(this),new RangeError(m);var r=y.concat(h,p);return A(this),r}g(this._handle,"zlib binding closed");r=this._handle.write(o,i,c,a,this._buffer,this._offset,l);function d(e,t){var r,n;if(this&&(this.buffer=null,this.callback=null),!u._hadError)return g(0<=(n=l-t),"have should not go down"),0=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=y.allocUnsafe(u._chunkSize)),0===t?(c+=a-e,a=e,!f||((n=u._handle.write(o,i,c,a,u._buffer,u._offset,u._chunkSize)).callback=d,void(n.buffer=i))):!!f&&void s()}r.buffer=i,r.callback=d},e.inherits(h,S),e.inherits(p,S),e.inherits(d,S),e.inherits(_,S),e.inherits(v,S),e.inherits(w,S),e.inherits(E,S)}.call(this)}.call(this,O("_process"))},{"./binding":5,_process:51,assert:1,buffer:8,stream:68,util:76}],7:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],8:[function(L,e,M){!function(e){!function(){"use strict";var S=L("base64-js"),o=L("ieee754"),t=(M.Buffer=f,M.SlowBuffer=function(e){+e!=e&&(e=0);return f.alloc(+e)},M.INSPECT_MAX_BYTES=50,2147483647);function l(e){if(t>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function r(e,t,r){var n,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var o=this,s=t,a=r,l=o.length;(!a||a<0||l=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=o=2,a/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i)for(var c=-1,u=r;u>8,i.push(r%256),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}var h=n,p=h.length;if(p<=m)return String.fromCharCode.apply(String,h);for(var d="",y=0;yt&&(e+=" ... "),""},f.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,s,a,l=!1;;)switch(n){case"hex":var c=this,u=e,f=t,h=r,p=(f=Number(f)||0,c.length-f);(!h||p<(h=Number(h)))&&(h=p),(p=u.length)/2e.length)throw new RangeError("Index out of range")}function v(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function w(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,i){return t=+t,r>>>=0,i||v(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||y(e,1,this.length),this[e]},f.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},f.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},f.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},f.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},f.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},f.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},f.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},f.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||_(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},f.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},f.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||_(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var i=r-1,o=1,s=0;for(this[t+i]=255&e;0<=--i&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},f.prototype.writeFloatLE=function(e,t,r){return w(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return w(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function T(e){return S.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function j(e){return e!=e}}.call(this)}.call(this,L("buffer").Buffer)},{"base64-js":3,buffer:8,ieee754:26}],9:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("./"),o=i(n("String.prototype.indexOf"));t.exports=function(e,t){t=n(e,!!t);return"function"==typeof t&&-1>2),o=0;o>6):(o<55296?n.push(224|o>>12):(o=(1023&o)<<10,o|=1023&t.charCodeAt(++i),n.push(240|(o+=65536)>>18),n.push(128|o>>12&63)),n.push(128|o>>6&63)),n.push(128|63&o))}return d(3,n.length),p(n);default:if(Array.isArray(t))for(d(4,s=t.length),i=0;i>5!==e)throw"Invalid indefinite length element";return r}function T(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof g&&(g=function(e){return e}),"function"!=typeof b&&(b=function(){return O});var e=function e(){var t,r,n=E(),i=n>>5,n=31&n;if(7==i)switch(n){case 25:var o=new ArrayBuffer(4),o=new DataView(o),s=k(),a=31744&s,l=1023&s;if(31744===a)a=261120;else if(0!==a)a+=114688;else if(0!=l)return l*R;return o.setUint32(0,(32768&s)<<16|a<<13|l<<13),o.getFloat32(0);case 26:return v(m.getFloat32(_),4);case 27:return v(m.getFloat64(_),8)}if((t=A(n))<0&&(i<2||6this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}.call(this,e,t,r):this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&0this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=t,i},i.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r=[];if(this.wildcard){var n="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=w.call(this,null,n,this.listenerTree,0)))return this}else{if(!this._events[e])return this;s=this._events[e],r.push({_listeners:s})}for(var i=0;ii&&!o.warned&&(o.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=o.length,r=n,console)&&console.warn&&console.warn(r)),e}function h(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function p(e,t,r){e=e._events;if(void 0===e)return[];e=e[t];if(void 0===e)return[];if("function"==typeof e)return r?[e.listener||e]:[e];if(r){for(var n=e,i=new Array(n.length),o=0;o=r.length?(l=!!(f=d(o,c)))&&"get"in f&&!("originalValue"in f.get)?f.get:o[c]:(l=_(o,c),o[c]),l&&!s&&(g[u]=o)}}return o}},{"function-bind":17,"has-proto":21,"has-symbols":22,hasown:25}],19:[function(t,e,r){"use strict";t=t("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch(e){t=null}e.exports=t},{"get-intrinsic":18}],20:[function(e,t,r){"use strict";function n(){if(i)try{return i({},"a",{value:1}),!0}catch(e){}return!1}var i=e("get-intrinsic")("%Object.defineProperty%",!0);n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},{"get-intrinsic":18}],21:[function(e,t,r){"use strict";var n={foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!({__proto__:null}instanceof i)}},{}],22:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},{"./shams":23}],23:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"!=typeof Symbol.iterator){var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}}return!0}},{}],24:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":23}],25:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,e=e("function-bind");t.exports=e.call(n,i)},{"function-bind":17}],26:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,i=e[t+f];for(f+=h,o=i&(1<<-u)-1,i>>=-u,u+=a;0>=-u,u+=n;0>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,o=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+u?f/n:f*Math.pow(2,1-u))*n&&(s++,n/=2),c<=s+u?(a=0,s=c):1<=s+u?(a=(t*n-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));8<=i;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:r>>>1;e[t]=r}return e}();t.exports=function(e,t,r,n){var i=a,o=n+r;e^=-1;for(var s=n;s>>8^i[255&(e^t[s])];return-1^e}},{}],43:[function(e,P,t){"use strict";var a,f=e("../utils/common"),l=e("./trees"),h=e("./adler32"),p=e("./crc32"),F=e("./messages"),c=0,u=4,d=0,y=-2,C=-1,B=4,z=2,g=8,D=9,r=286,Z=30,G=19,q=2*r+1,W=15,b=3,m=258,_=m+b+1,v=42,w=113,E=1,k=2,S=3,A=4;function x(e,t){return e.msg=F[t],t}function T(e){return(e<<1)-(4e.avail_out?e.avail_out:r)&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending)&&(t.pending_out=0)}function j(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function o(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,c=e.window,u=e.w_mask,f=e.prev,h=e.strstart+m,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){for(o+=2,r++;c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function N(e){var t,r,n,i,o,s,a,l,c,u=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=u+(u-_)){for(f.arraySet(e.window,e.window,u,u,0),e.match_start-=u,e.strstart-=u,e.block_start-=u,t=r=e.hash_size;n=e.head[--t],e.head[t]=u<=n?n-u:0,--r;);for(t=r=u;n=e.prev[--t],e.prev[t]=u<=n?n-u:0,--r;);l+=u}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,a=e.strstart+e.lookahead,l=l,c=void 0,c=o.avail_in,r=0===(c=l=b)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=l._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(N(e),0===e.lookahead&&t===c)return E;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,j(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-_&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?S:A):(e.strstart>e.block_start&&(j(e,!1),e.strm.avail_out),E)}),new s(4,4,8,4,n),new s(4,5,16,8,n),new s(4,6,32,32,n),new s(4,4,16,16,i),new s(8,16,32,32,i),new s(8,16,128,128,i),new s(8,32,128,256,i),new s(32,128,258,1024,i),new s(32,258,258,4096,i)],t.deflateInit=function(e,t){return V(e,t,g,15,8,0)},t.deflateInit2=V,t.deflateReset=I,t.deflateResetKeep=U,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?y:(e.state.gzhead=t,d)},t.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=w)):(s=g+(n.w_bits-8<<4)<<8,s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=w,M(n,s),0!==n.strstart&&(M(n,e.adler>>>16),M(n,65535&e.adler)),e.adler=1)),69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),R(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}}while(o=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&R(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=w)):n.status=w),0!==n.pending){if(R(e),0===e.avail_out)return n.last_flush=-1,d}else if(0===e.avail_in&&T(t)<=T(r)&&t!==u)return x(e,-5);if(666===n.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(N(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?S:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:k}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,s=e.window;;){if(e.lookahead<=m){if(N(e),e.lookahead<=m&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=l._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(j(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(j(e,!0),0===e.strm.avail_out?S:A):e.last_lit&&(j(e,!1),0===e.strm.avail_out)?E:k}(n,t):a[n.level].func(n,t);if(s!==S&&s!==A||(n.status=666),s===E||s===S)return 0===e.avail_out&&(n.last_flush=-1),d;if(s===k&&(1===t?l._tr_align(n):5!==t&&(l._tr_stored_block(n,0,0,!1),3===t)&&(O(n.head),0===n.lookahead)&&(n.strstart=0,n.block_start=0,n.insert=0),R(e),0===e.avail_out))return n.last_flush=-1,d}return t!==u||!(n.wrap<=0)&&(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(M(n,e.adler>>>16),M(n,65535&e.adler)),R(e),0=r.w_size&&(0===o&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),l=e.avail_in,s=e.next_in,a=e.input,e.avail_in=c,e.next_in=0,e.input=t,N(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=n=r>>>24,E-=n,0===(n=r>>>16&255))p[h++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=k[(65535&r)+(w&(1<>>=n,E-=n),E<15&&(w+=u[c++]<>>=n=r>>>24,E-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=S[(65535&r)+(w&(1<>>=n,E-=n,(n=h-d)>3)<<3))-1,e.next_in=c-=i,e.next_out=h,e.avail_in=c>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=z,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new L.Buf32(n),t.distcode=t.distdyn=new L.Buf32(i),t.sane=1,t.back=-1,C):B}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,s(e)):B}function l(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(L.arraySet(e.window,t,r-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),L.arraySet(e.window,t,r-n,i,e.wnext),(n-=i)?(L.arraySet(e.window,t,r-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,r.check=N(r.check,T,2,0),u=c=0,r.mode=2;else if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",r.mode=30;else if(8!=(15&c))e.msg="unknown compression method",r.mode=30;else{if(u-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,r.check=N(r.check,T,2,0)),u=c=0,r.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,r.check=N(r.check,T,4,0)),u=c=0,r.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>8),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,r.check=N(r.check,T,2,0)),u=c=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,c+=n[o++]<>>8&255,r.check=N(r.check,T,2,0)),u=c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=a<(p=r.length)?a:p)&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),L.arraySet(r.head.extra,n,o,p,E)),512&r.flags&&(r.check=N(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(p=0;E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E)),E&&p>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[o++]<>>=7&u,u-=7&u,r.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:R=j=void 0;var R,j=r;if(q){for(Z=new L.Buf32(512),G=new L.Buf32(32),R=0;R<144;)j.lens[R++]=8;for(;R<256;)j.lens[R++]=9;for(;R<280;)j.lens[R++]=7;for(;R<288;)j.lens[R++]=8;for(I(P,j.lens,0,288,Z,0,j.work,{bits:9}),R=0;R<32;)j.lens[R++]=5;I(F,j.lens,0,32,G,0,j.work,{bits:5}),q=!1}if(j.lencode=Z,j.lenbits=9,j.distcode=G,j.distbits=5,r.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,u=c=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(0===(p=l<(p=a>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,286>>=3,u-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},k=I(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,k){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=g,u-=g,r.lens[r.have++]=m;else{if(16===m){for(A=g+2;u>>=g,u-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}E=r.lens[r.have-1],p=3+(3&c),c>>>=2,u-=2}else if(17===m){for(A=g+3;u>>=g)),c>>>=3,u=u-g-3}else{for(A=g+7;u>>=g)),c>>>=7,u=u-g-7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=E}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},k=I(P,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,k){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},k=I(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,k){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=l){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,r.hold=c,r.bits=u,U(e,h),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,c=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;b=(x=r.lencode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,r.length=m,0===b){r.mode=26;break}if(32&b){r.back=-1,r.mode=12;break}if(64&b){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&b,r.mode=22;case 22:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;b=(x=r.distcode[c&(1<>>16&255,m=65535&x,!((g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>_)])>>>16&255,m=65535&x,!(_+(g=x>>>24)<=u);){if(0===a)break e;a--,c+=n[o++]<>>=_,u-=_,r.back+=_}if(c>>>=g,u-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=30;break}r.offset=m,r.extra=15&b,r.mode=24;case 24:if(r.extra){for(A=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break e;if(r.offset>(p=h-l)){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d=p>r.wnext?(p-=r.wnext,r.wsize-p):r.wnext-p,p>r.length&&(p=r.length),y=r.window}else y=i,d=s-r.offset,p=r.length;for(l-=p=lp?(y=M[N+s[_]],O[R+s[_]]):(y=96,0),l=1<<(d=m-S),v=c=1<>S)+(c-=l)]=d<<24|y<<16|g|0,0!==c;);for(l=1<>=1;if(T=0!==l?(T&l-1)+l:0,_++,0==--j[m]){if(m===w)break;m=t[r+s[_]]}if(E>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function I(e,t,r){e.bi_valid>n-r?(e.bi_buf|=t<>n-e.bi_valid,e.bi_valid+=r-n):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){for(var n,i=new Array(x+1),o=0,s=1;s<=x;s++)i[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=D(i[a]++,a))}}function G(e){for(var t=0;t>1;1<=r;r--)F(e,o,r);for(i=l;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,F(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var u,f,h,p,d,y=e,g=t.dyn_tree,b=t.max_code,m=t.stat_desc.static_tree,_=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,E=t.stat_desc.max_length,k=0,S=0;S<=x;S++)y.bl_count[S]=0;for(g[2*y.heap[y.heap_max]+1]=0,u=y.heap_max+1;u>=7;s>>=1)if(1&t&&0!==e.dyn_ltree[2*r])return u;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return f;for(r=32;r>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t)K(e,t,r,n);else if(4===e.strategy||o===i)I(e,2+(n?1:0),3),H(e,S,T);else{I(e,4+(n?1:0),3);var a,l=e,t=e.l_desc.max_code+1,r=e.d_desc.max_code+1,c=s+1;for(I(l,t-257,5),I(l,r-1,5),I(l,c-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){I(e,2,3),P(e,b,S),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":39}],49:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],50:[function(e,t,o){!function(I){!function(){var r=e("fs"),n=e("stream"),i=e("zlib"),h=new I("89504e470d0a1a0a","hex");function U(e,t,r,n,i){this.width=e,this.height=t,this.channels=r,this.data=n,this.trailer=i}U.prototype.getPixel=function(e,t){if(t|=0,(e|=0)<0||t<0||e>=this.width||t>=this.height)return 0;var r,n,i,o,s=(t*this.width+e)*this.channels;switch(this.channels){case 1:r=n=i=this.data[s],o=255;break;case 2:r=n=i=this.data[s],o=this.data[1+s];break;case 3:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=255;break;case 4:r=this.data[s],n=this.data[1+s],i=this.data[2+s],o=this.data[3+s]}return(r<<24|n<<16|i<<8|o)>>>0},o.parseStream=function(o,t){var s,p,a,d,y,g,b,m,_,v,w,E,k,S,l,A,x,T,O=i.createInflate(),c=0,u=0,f=new I(13),e=2,R=-1,j=0,L=0,M=0;function N(e){return o.destroy&&o.destroy(),O.destroy&&O.destroy(),t(e)}function r(){if(!--e)return t(void 0,new U(p,a,T,b,l))}o.on("error",N),O.on("error",N),o.on("end",function(){return o.destroy(),b&&l?r():N(new Error("Corrupt PNG?"))}),O.on("end",function(){return O.destroy&&O.destroy(),j!==b.length?N(new Error("Too little pixel data! (Corrupt PNG?)")):r()}),o.on("data",function(e){if(o.readable)for(var t,r,n=e.length,i=0;i!==n;)switch(c){case 0:if(e[i++]!==h[u++])return N(new Error("Invalid PNG header."));u===h.length&&(c=1,u=0);break;case 1:if(n-i<8-u)e.copy(f,u,i),u+=n-i,i=n;else switch(e.copy(f,u,i,i+8-u),i+=8-u,u=0,s=f.readUInt32BE(0),f.toString("ascii",4,8)){case"IHDR":c=2;break;case"PLTE":if(3!==g)c=7;else{if(s%3!=0)return N(new Error("Invalid PLTE size."));L=s/3,A=new I(s),c=3}break;case"tRNS":if(3!==g)return N(new Error("tRNS for non-paletted images not yet supported."));T++,x=new I(M=s),c=4;break;case"IDAT":b=b||new I(p*a*T),c=5;break;case"IEND":c=6;break;default:c=7}break;case 2:if(13!==s)return N(new Error("Invalid IHDR chunk."));if(n-i>>1)&255;break;case 4:E[R]=e[h]+(R<_?k[R]:(o=E[R-_],s=k[R],a=k[R-_],l=u=c=l=void 0,l=o+s-a,c=Math.abs(l-o),u=Math.abs(l-s),l=Math.abs(l-a),c<=u&&c<=l?o:u<=l?s:a))&255;break;default:return N(new Error("Unsupported scanline filter: "+S))}if(++R===v){if(j===b.length)return N(new Error("Too much pixel data! (Corrupt PNG?)"));for(r=n=0;r!==p;++r){for(i=0;i!==m;++n,++i)switch(d){case 1:w[i]=E[n>>>3]>>7-(7&n)&1;break;case 2:w[i]=E[n>>>2]>>(3-(3&n)<<1)&3;break;case 4:w[i]=E[n>>>1]>>(1-(1&n)<<2)&15;break;case 8:w[i]=E[n];break;default:return N(new Error("Unsupported bit depth: "+d))}switch(g){case 0:b[j++]=w[0]*y;break;case 2:b[j++]=w[0]*y,b[j++]=w[1]*y,b[j++]=w[2]*y;break;case 3:if(w[0]>=L)return N(new Error("Invalid palette index."));switch(T){case 1:b[j++]=A[3*w[0]];break;case 2:b[j++]=A[3*w[0]],b[j++]=w[0]o.length)&&(a=o.length),o=(o.substring(a-s.length,a)===s?"The ".concat(e," "):(a=(i="number"!=typeof i?0:i)+(o=".").length>(a=e).length||-1===a.indexOf(o,i)?"argument":"property",'The "'.concat(e,'" ').concat(a," "))).concat(n," ").concat(l(t,"type")),o+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],53:[function(u,f,e){!function(c){!function(){"use strict";var e=Object.keys||function(e){var t,r=[];for(t in e)r.push(t);return r},t=(f.exports=s,u("./_stream_readable")),r=u("./_stream_writable");u("inherits")(s,t);for(var n=e(r.prototype),i=0;it.highWaterMark&&(t.highWaterMark=(k<=(r=e)?r=k:(r--,r=(r=(r=(r=(r|=r>>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;y("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,F.nextTick(x,e))}function x(e){var t=e._readableState;y("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function T(e,t){t.readingMore||(t.readingMore=!0,F.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function U(e){var t=e._readableState;y("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,F.nextTick(P,t,e))}function P(e,t){y("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy&&(!(e=t._writableState)||e.autoDestroy&&e.finished)&&t.destroy())}function I(e,t){for(var r=0,n=e.length;r=r.highWaterMark:0>>0),i=this.head,o=0;i;)t=i.data,r=o,l.prototype.copy.call(t,n,r),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:8,util:4}],60:[function(e,t,r){!function(l){!function(){"use strict";function o(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,l.nextTick(a,this,e)):l.nextTick(a,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?l.nextTick(s,r):(r._writableState.errorEmitted=!0,l.nextTick(o,r,e)):l.nextTick(o,r,e):t?(l.nextTick(s,r),t(e)):l.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}.call(this)}.call(this,e("_process"))},{_process:51}],61:[function(e,t,r){"use strict";var b=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function m(){}t.exports=function e(t,r,n){var i,o,s,a,l,c,u,f,h,p,d,y,g;return"function"==typeof r?e(t,null,r):(i=n||m,o=!1,n=function(){if(!o){o=!0;for(var e=arguments.length,t=new Array(e),r=0;r>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function l(e){var t,r=this.lastTotal-this.lastNeed,n=(t=this,128!=(192&(n=e)[0])?(t.lastNeed=0,"�"):1t.secs)&&(e.secs=6.9.0'} + dependencies: + '@babel/highlight': 7.22.20 + chalk: 2.4.2 + dev: true + + /@babel/helper-string-parser@7.22.5: + resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-identifier@7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/highlight@7.22.20: + resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + + /@babel/parser@7.23.3: + resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/types@7.23.3: + resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.22.5 + '@babel/helper-validator-identifier': 7.22.20 + to-fast-properties: 2.0.0 + dev: true + + /@colors/colors@1.5.0: + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + dev: true + + /@cspotcode/source-map-support@0.8.1: + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + dev: true + + /@jridgewell/resolve-uri@3.1.1: + resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@jridgewell/trace-mapping@0.3.9: + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /@puppeteer/browsers@1.8.0: + resolution: {integrity: sha512-TkRHIV6k2D8OlUe8RtG+5jgOF/H98Myx0M6AOafC8DdNVOFiBSFa5cpRDtpm8LXOa9sVwe0+e6Q3FC56X/DZfg==} + engines: {node: '>=16.3.0'} + hasBin: true + dependencies: + debug: 4.3.4(supports-color@8.1.1) + extract-zip: 2.0.1 + progress: 2.0.3 + proxy-agent: 6.3.1 + tar-fs: 3.0.4 + unbzip2-stream: 1.4.3 + yargs: 17.7.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@socket.io/component-emitter@3.1.0: + resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==} + + /@tootallnate/quickjs-emscripten@0.23.0: + resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} + dev: true + + /@tsconfig/node10@1.0.9: + resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} + dev: true + + /@tsconfig/node12@1.0.11: + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + dev: true + + /@tsconfig/node14@1.0.3: + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + dev: true + + /@tsconfig/node16@1.0.4: + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + dev: true + + /@types/cookie@0.4.1: + resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==} + + /@types/cors@2.8.16: + resolution: {integrity: sha512-Trx5or1Nyg1Fq138PCuWqoApzvoSLWzZ25ORBiHMbbUT42g578lH1GT4TwYDbiUOLFuDsCkfLneT2105fsFWGg==} + dependencies: + '@types/node': 20.9.2 + + /@types/linkify-it@3.0.5: + resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==} + dev: true + + /@types/markdown-it@12.2.3: + resolution: {integrity: sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==} + dependencies: + '@types/linkify-it': 3.0.5 + '@types/mdurl': 1.0.5 + dev: true + + /@types/mdurl@1.0.5: + resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==} + dev: true + + /@types/minimatch@3.0.5: + resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} + dev: true + + /@types/mocha@10.0.6: + resolution: {integrity: sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==} + dev: true + + /@types/node@20.9.2: + resolution: {integrity: sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==} + dependencies: + undici-types: 5.26.5 + + /@types/yauzl@2.10.3: + resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} + requiresBuild: true + dependencies: + '@types/node': 20.9.2 + dev: true + optional: true + + /@xmldom/xmldom@0.8.10: + resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==} + engines: {node: '>=10.0.0'} + dev: false + + /JSONStream@0.10.0: + resolution: {integrity: sha512-8XbSFFd43EG+1thjLNFIzCBlwXti0yKa7L+ak/f0T/pkC+31b7G41DXL/JzYpAoYWZ2eCPiu4IIqzijM8N0a/w==} + hasBin: true + dependencies: + jsonparse: 0.0.5 + through: 2.3.8 + dev: true + + /JSONStream@1.3.5: + resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} + hasBin: true + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + dev: true + + /abbrev@1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + dev: true + + /accepts@1.3.8: + resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} + engines: {node: '>= 0.6'} + dependencies: + mime-types: 2.1.35 + negotiator: 0.6.3 + + /acorn-node@1.8.2: + resolution: {integrity: sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==} + dependencies: + acorn: 7.4.1 + acorn-walk: 7.2.0 + xtend: 4.0.2 + dev: true + + /acorn-walk@7.2.0: + resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn-walk@8.3.1: + resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn@7.4.1: + resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /acorn@8.11.2: + resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /agent-base@7.1.0: + resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} + engines: {node: '>= 14'} + dependencies: + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + + /ansi-colors@4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + dev: true + + /ansi-regex@2.1.1: + resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} + engines: {node: '>=0.10.0'} + dev: true + + /ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: true + + /ansi-styles@2.2.1: + resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} + engines: {node: '>=0.10.0'} + dev: true + + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + dependencies: + color-convert: 1.9.3 + dev: true + + /ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + dependencies: + color-convert: 2.0.1 + dev: true + + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + + /arg@4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: true + + /argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + dependencies: + sprintf-js: 1.0.3 + dev: true + + /argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true + + /array-differ@3.0.0: + resolution: {integrity: sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==} + engines: {node: '>=8'} + dev: true + + /array-each@1.0.1: + resolution: {integrity: sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==} + engines: {node: '>=0.10.0'} + dev: true + + /array-slice@1.1.0: + resolution: {integrity: sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==} + engines: {node: '>=0.10.0'} + dev: true + + /array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + dev: true + + /arrify@2.0.1: + resolution: {integrity: sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==} + engines: {node: '>=8'} + dev: true + + /asn1.js@5.4.1: + resolution: {integrity: sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==} + dependencies: + bn.js: 4.12.0 + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + safer-buffer: 2.1.2 + dev: true + + /assert@1.5.1: + resolution: {integrity: sha512-zzw1uCAgLbsKwBfFc8CX78DDg+xZeBksSO3vwVIDDN5i94eOrPsSSyiVhmsSABFDM/OcpE2aagCat9dnWQLG1A==} + dependencies: + object.assign: 4.1.4 + util: 0.10.4 + dev: true + + /assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true + + /ast-types@0.13.4: + resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} + engines: {node: '>=4'} + dependencies: + tslib: 2.6.2 + dev: true + + /async@2.6.4: + resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==} + dependencies: + lodash: 4.17.21 + dev: true + + /async@3.2.5: + resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} + dev: true + + /available-typed-arrays@1.0.5: + resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + engines: {node: '>= 0.4'} + dev: true + + /b4a@1.6.4: + resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} + dev: true + + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true + + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: true + + /base64id@2.0.0: + resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==} + engines: {node: ^4.5.0 || >= 5.9} + + /basic-ftp@5.0.3: + resolution: {integrity: sha512-QHX8HLlncOLpy54mh+k/sWIFd0ThmRqwe9ZjELybGZK+tZ8rUb9VO0saKJUROTbE+KhzDUT7xziGpGrW8Kmd+g==} + engines: {node: '>=10.0.0'} + dev: true + + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + + /bluebird@3.7.2: + resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} + dev: true + + /bn.js@4.12.0: + resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} + dev: true + + /bn.js@5.2.1: + resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + dev: true + + /body-parser@1.20.2: + resolution: {integrity: sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + dependencies: + bytes: 3.1.2 + content-type: 1.0.5 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.11.0 + raw-body: 2.5.2 + type-is: 1.6.18 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + dev: true + + /body@5.1.0: + resolution: {integrity: sha512-chUsBxGRtuElD6fmw1gHLpvnKdVLK302peeFa9ZqAEk8TyzZ3fygLyUEDDPTJvL9+Bor0dIwn6ePOsRM2y0zQQ==} + dependencies: + continuable-cache: 0.3.1 + error: 7.2.1 + raw-body: 1.1.7 + safe-json-parse: 1.0.1 + dev: true + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: true + + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + + /brorand@1.1.0: + resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} + dev: true + + /browser-pack@6.1.0: + resolution: {integrity: sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==} + hasBin: true + dependencies: + JSONStream: 1.3.5 + combine-source-map: 0.8.0 + defined: 1.0.1 + safe-buffer: 5.2.1 + through2: 2.0.5 + umd: 3.0.3 + dev: true + + /browser-resolve@2.0.0: + resolution: {integrity: sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==} + dependencies: + resolve: 1.22.8 + dev: true + + /browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + dev: true + + /browserify-aes@1.2.0: + resolution: {integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==} + dependencies: + buffer-xor: 1.0.3 + cipher-base: 1.0.4 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: true + + /browserify-cache-api@3.0.2: + resolution: {integrity: sha512-14YNbboSgSHY5QNZSLwlGYB7OuBuXS7gMyR2gfBjdS4JYcWB9BqyKhraQG/VW2W5ZhjkC/C8LZ38sP3bmbmeNA==} + dependencies: + async: 2.6.4 + through2: 2.0.5 + xtend: 4.0.2 + dev: true + + /browserify-cipher@1.0.1: + resolution: {integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==} + dependencies: + browserify-aes: 1.2.0 + browserify-des: 1.0.2 + evp_bytestokey: 1.0.3 + dev: true + + /browserify-des@1.0.2: + resolution: {integrity: sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==} + dependencies: + cipher-base: 1.0.4 + des.js: 1.1.0 + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: true + + /browserify-incremental@3.1.1(browserify@17.0.0): + resolution: {integrity: sha512-PrFwOzLEdy27VRXK2uGjmjLq1aROBG7QoQq3eKanmm6Q8vuzT0ZNFCORHh3yJgNQQooXA9tOizGv4vCOmhrvRQ==} + hasBin: true + peerDependencies: + browserify: '*' + dependencies: + JSONStream: 0.10.0 + browserify: 17.0.0 + browserify-cache-api: 3.0.2 + through2: 2.0.5 + xtend: 4.0.2 + dev: true + + /browserify-rsa@4.1.0: + resolution: {integrity: sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==} + dependencies: + bn.js: 5.2.1 + randombytes: 2.1.0 + dev: true + + /browserify-sign@4.2.2: + resolution: {integrity: sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==} + engines: {node: '>= 4'} + dependencies: + bn.js: 5.2.1 + browserify-rsa: 4.1.0 + create-hash: 1.2.0 + create-hmac: 1.1.7 + elliptic: 6.5.4 + inherits: 2.0.4 + parse-asn1: 5.1.6 + readable-stream: 3.6.2 + safe-buffer: 5.2.1 + dev: true + + /browserify-zlib@0.2.0: + resolution: {integrity: sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==} + dependencies: + pako: 1.0.11 + dev: true + + /browserify@17.0.0: + resolution: {integrity: sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w==} + engines: {node: '>= 0.8'} + hasBin: true + dependencies: + JSONStream: 1.3.5 + assert: 1.5.1 + browser-pack: 6.1.0 + browser-resolve: 2.0.0 + browserify-zlib: 0.2.0 + buffer: 5.2.1 + cached-path-relative: 1.1.0 + concat-stream: 1.6.2 + console-browserify: 1.2.0 + constants-browserify: 1.0.0 + crypto-browserify: 3.12.0 + defined: 1.0.1 + deps-sort: 2.0.1 + domain-browser: 1.2.0 + duplexer2: 0.1.4 + events: 3.3.0 + glob: 7.2.3 + has: 1.0.4 + htmlescape: 1.1.1 + https-browserify: 1.0.0 + inherits: 2.0.4 + insert-module-globals: 7.2.1 + labeled-stream-splicer: 2.0.2 + mkdirp-classic: 0.5.3 + module-deps: 6.2.3 + os-browserify: 0.3.0 + parents: 1.0.1 + path-browserify: 1.0.1 + process: 0.11.10 + punycode: 1.4.1 + querystring-es3: 0.2.1 + read-only-stream: 2.0.0 + readable-stream: 2.3.8 + resolve: 1.22.8 + shasum-object: 1.0.0 + shell-quote: 1.8.1 + stream-browserify: 3.0.0 + stream-http: 3.2.0 + string_decoder: 1.3.0 + subarg: 1.0.0 + syntax-error: 1.4.0 + through2: 2.0.5 + timers-browserify: 1.4.2 + tty-browserify: 0.0.1 + url: 0.11.3 + util: 0.12.5 + vm-browserify: 1.1.2 + xtend: 4.0.2 + dev: true + + /buffer-crc32@0.2.13: + resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} + dev: true + + /buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true + + /buffer-xor@1.0.3: + resolution: {integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==} + dev: true + + /buffer@5.2.1: + resolution: {integrity: sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: true + + /buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: true + + /builtin-status-codes@3.0.0: + resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==} + dev: true + + /bytes@1.0.0: + resolution: {integrity: sha512-/x68VkHLeTl3/Ll8IvxdwzhrT+IyKc52e/oyHhA2RwqPqswSnjVbSddfPRwAsJtbilMAPSRWwAlpxdYsSWOTKQ==} + dev: true + + /bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + dev: true + + /cached-path-relative@1.1.0: + resolution: {integrity: sha512-WF0LihfemtesFcJgO7xfOoOcnWzY/QHR4qeDqV44jPU3HTI54+LnfXK3SA27AVVGCdZFgjjFFaqUA9Jx7dMJZA==} + dev: true + + /call-bind@1.0.5: + resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + dependencies: + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + set-function-length: 1.1.1 + dev: true + + /callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + dev: true + + /camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + dev: true + + /catharsis@0.9.0: + resolution: {integrity: sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==} + engines: {node: '>= 10'} + dependencies: + lodash: 4.17.21 + dev: true + + /cbor-js@0.1.0: + resolution: {integrity: sha512-7sQ/TvDZPl7csT1Sif9G0+MA0I0JOVah8+wWlJVQdVEgIbCzlN/ab3x+uvMNsc34TUvO6osQTAmB2ls80JX6tw==} + dev: false + + /chai@4.3.10: + resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + + /chalk@1.1.3: + resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==} + engines: {node: '>=0.10.0'} + dependencies: + ansi-styles: 2.2.1 + escape-string-regexp: 1.0.5 + has-ansi: 2.0.0 + strip-ansi: 3.0.1 + supports-color: 2.0.0 + dev: true + + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + + /chalk@3.0.0: + resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} + engines: {node: '>=8'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /chromium-bidi@0.4.33(devtools-protocol@0.0.1203626): + resolution: {integrity: sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==} + peerDependencies: + devtools-protocol: '*' + dependencies: + devtools-protocol: 0.0.1203626 + mitt: 3.0.1 + urlpattern-polyfill: 9.0.0 + dev: true + + /cipher-base@1.0.4: + resolution: {integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==} + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: true + + /cli@1.0.1: + resolution: {integrity: sha512-41U72MB56TfUMGndAKK8vJ78eooOD4Z5NOL4xEfjc0c23s+6EYKXlXsmACBVclLP1yOfWCgEganVzddVrSNoTg==} + engines: {node: '>=0.2.5'} + dependencies: + exit: 0.1.2 + glob: 7.2.3 + dev: true + + /cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + + /cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + dependencies: + color-name: 1.1.3 + dev: true + + /color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + dependencies: + color-name: 1.1.4 + dev: true + + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true + + /color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: true + + /colors@1.1.2: + resolution: {integrity: sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==} + engines: {node: '>=0.1.90'} + dev: true + + /combine-source-map@0.8.0: + resolution: {integrity: sha512-UlxQ9Vw0b/Bt/KYwCFqdEwsQ1eL8d1gibiFb7lxQJFdvTgc2hIZi6ugsg+kyhzhPV+QEpUiEIwInIAIrgoEkrg==} + dependencies: + convert-source-map: 1.1.3 + inline-source-map: 0.6.2 + lodash.memoize: 3.0.4 + source-map: 0.5.7 + dev: true + + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: true + + /concat-stream@1.6.2: + resolution: {integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==} + engines: {'0': node >= 0.8} + dependencies: + buffer-from: 1.1.2 + inherits: 2.0.4 + readable-stream: 2.3.8 + typedarray: 0.0.6 + dev: true + + /connect@3.7.0: + resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} + engines: {node: '>= 0.10.0'} + dependencies: + debug: 2.6.9 + finalhandler: 1.1.2 + parseurl: 1.3.3 + utils-merge: 1.0.1 + transitivePeerDependencies: + - supports-color + dev: true + + /console-browserify@1.1.0: + resolution: {integrity: sha512-duS7VP5pvfsNLDvL1O4VOEbw37AI3A4ZUQYemvDlnpGrNu9tprR7BYWpDYwC0Xia0Zxz5ZupdiIrUp0GH1aXfg==} + dependencies: + date-now: 0.1.4 + dev: true + + /console-browserify@1.2.0: + resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==} + dev: true + + /constants-browserify@1.0.0: + resolution: {integrity: sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==} + dev: true + + /content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + dev: true + + /continuable-cache@0.3.1: + resolution: {integrity: sha512-TF30kpKhTH8AGCG3dut0rdd/19B7Z+qCnrMoBLpyQu/2drZdNrrpcjPEoJeSVsQM+8KmWG5O56oPDjSSUsuTyA==} + dev: true + + /convert-source-map@1.1.3: + resolution: {integrity: sha512-Y8L5rp6jo+g9VEPgvqNfEopjTR4OTYct8lXlS8iVQdmnjDvbdbzYe9rjtFCB9egC86JoNCU61WRY+ScjkZpnIg==} + dev: true + + /cookie@0.4.2: + resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} + engines: {node: '>= 0.6'} + + /core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + dev: true + + /cors@2.8.5: + resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} + engines: {node: '>= 0.10'} + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + + /cosmiconfig@8.3.6(typescript@5.2.2): + resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} + engines: {node: '>=14'} + peerDependencies: + typescript: '>=4.9.5' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + import-fresh: 3.3.0 + js-yaml: 4.1.0 + parse-json: 5.2.0 + path-type: 4.0.0 + typescript: 5.2.2 + dev: true + + /create-ecdh@4.0.4: + resolution: {integrity: sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==} + dependencies: + bn.js: 4.12.0 + elliptic: 6.5.4 + dev: true + + /create-hash@1.2.0: + resolution: {integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==} + dependencies: + cipher-base: 1.0.4 + inherits: 2.0.4 + md5.js: 1.3.5 + ripemd160: 2.0.2 + sha.js: 2.4.11 + dev: true + + /create-hmac@1.1.7: + resolution: {integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==} + dependencies: + cipher-base: 1.0.4 + create-hash: 1.2.0 + inherits: 2.0.4 + ripemd160: 2.0.2 + safe-buffer: 5.2.1 + sha.js: 2.4.11 + dev: true + + /create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + dev: true + + /cross-fetch@4.0.0: + resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==} + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: true + + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + + /crypto-browserify@3.12.0: + resolution: {integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==} + dependencies: + browserify-cipher: 1.0.1 + browserify-sign: 4.2.2 + create-ecdh: 4.0.4 + create-hash: 1.2.0 + create-hmac: 1.1.7 + diffie-hellman: 5.0.3 + inherits: 2.0.4 + pbkdf2: 3.1.2 + public-encrypt: 4.0.3 + randombytes: 2.1.0 + randomfill: 1.0.4 + dev: true + + /custom-event@1.0.1: + resolution: {integrity: sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==} + dev: true + + /dash-ast@1.0.0: + resolution: {integrity: sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==} + dev: true + + /data-uri-to-buffer@6.0.1: + resolution: {integrity: sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==} + engines: {node: '>= 14'} + dev: true + + /date-format@4.0.14: + resolution: {integrity: sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==} + engines: {node: '>=4.0'} + dev: true + + /date-now@0.1.4: + resolution: {integrity: sha512-AsElvov3LoNB7tf5k37H2jYSB+ZZPMT5sG2QjJCcdlV5chIv6htBUBUui2IKRjgtKAKtCBN7Zbwa+MtwLjSeNw==} + dev: true + + /date-time@1.1.0: + resolution: {integrity: sha512-RrxZQ06cdKe7YQ5oqIxs3GMc7W3vXscy7Ds+aZIqmxA59QnVtTiCseA4jbzVUub9xCbo9GuYVZo0OrZLYXnnmw==} + engines: {node: '>=0.10.0'} + dependencies: + time-zone: 0.1.0 + dev: true + + /dateformat@4.6.3: + resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} + dev: true + + /debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.0.0 + dev: true + + /debug@3.2.7: + resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.3 + dev: true + + /debug@4.3.4(supports-color@8.1.1): + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + supports-color: 8.1.1 + + /decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + dev: true + + /deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + dependencies: + type-detect: 4.0.8 + dev: true + + /define-data-property@1.1.1: + resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + has-property-descriptors: 1.0.1 + object-keys: 1.1.1 + dev: true + + /defined@1.0.1: + resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==} + dev: true + + /degenerator@5.0.1: + resolution: {integrity: sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==} + engines: {node: '>= 14'} + dependencies: + ast-types: 0.13.4 + escodegen: 2.1.0 + esprima: 4.0.1 + dev: true + + /depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + dev: true + + /deps-sort@2.0.1: + resolution: {integrity: sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==} + hasBin: true + dependencies: + JSONStream: 1.3.5 + shasum-object: 1.0.0 + subarg: 1.0.0 + through2: 2.0.5 + dev: true + + /des.js@1.1.0: + resolution: {integrity: sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==} + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + dev: true + + /destroy@1.2.0: + resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + dev: true + + /detect-file@1.0.0: + resolution: {integrity: sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==} + engines: {node: '>=0.10.0'} + dev: true + + /detective@5.2.1: + resolution: {integrity: sha512-v9XE1zRnz1wRtgurGu0Bs8uHKFSTdteYZNbIPFVhUZ39L/S79ppMpdmVOZAnoz1jfEFodc48n6MX483Xo3t1yw==} + engines: {node: '>=0.8.0'} + hasBin: true + dependencies: + acorn-node: 1.8.2 + defined: 1.0.1 + minimist: 1.2.8 + dev: true + + /devtools-protocol@0.0.1203626: + resolution: {integrity: sha512-nEzHZteIUZfGCZtTiS1fRpC8UZmsfD1SiyPvaUNvS13dvKf666OAm8YTi0+Ca3n1nLEyu49Cy4+dPWpaHFJk9g==} + dev: true + + /di@0.0.1: + resolution: {integrity: sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==} + dev: true + + /diff@4.0.2: + resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} + engines: {node: '>=0.3.1'} + dev: true + + /diff@5.0.0: + resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + engines: {node: '>=0.3.1'} + dev: true + + /diffie-hellman@5.0.3: + resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} + dependencies: + bn.js: 4.12.0 + miller-rabin: 4.0.1 + randombytes: 2.1.0 + dev: true + + /dom-serialize@2.2.1: + resolution: {integrity: sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ==} + dependencies: + custom-event: 1.0.1 + ent: 2.2.0 + extend: 3.0.2 + void-elements: 2.0.1 + dev: true + + /dom-serializer@0.2.2: + resolution: {integrity: sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==} + dependencies: + domelementtype: 2.3.0 + entities: 2.2.0 + dev: true + + /domain-browser@1.2.0: + resolution: {integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==} + engines: {node: '>=0.4', npm: '>=1.2'} + dev: true + + /domelementtype@1.3.1: + resolution: {integrity: sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==} + dev: true + + /domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + dev: true + + /domhandler@2.3.0: + resolution: {integrity: sha512-q9bUwjfp7Eif8jWxxxPSykdRZAb6GkguBGSgvvCrhI9wB71W2K/Kvv4E61CF/mcCfnVJDeDWx/Vb/uAqbDj6UQ==} + dependencies: + domelementtype: 1.3.1 + dev: true + + /domutils@1.5.1: + resolution: {integrity: sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==} + dependencies: + dom-serializer: 0.2.2 + domelementtype: 1.3.1 + dev: true + + /duplexer2@0.1.4: + resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==} + dependencies: + readable-stream: 2.3.8 + dev: true + + /duplexer@0.1.2: + resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} + dev: true + + /ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + dev: true + + /elliptic@6.5.4: + resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} + dependencies: + bn.js: 4.12.0 + brorand: 1.1.0 + hash.js: 1.1.7 + hmac-drbg: 1.0.1 + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + + /emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + dev: true + + /encodeurl@1.0.2: + resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} + engines: {node: '>= 0.8'} + dev: true + + /end-of-stream@1.4.4: + resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} + dependencies: + once: 1.4.0 + dev: true + + /engine.io-parser@5.2.1: + resolution: {integrity: sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==} + engines: {node: '>=10.0.0'} + + /engine.io@6.5.4: + resolution: {integrity: sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==} + engines: {node: '>=10.2.0'} + dependencies: + '@types/cookie': 0.4.1 + '@types/cors': 2.8.16 + '@types/node': 20.9.2 + accepts: 1.3.8 + base64id: 2.0.0 + cookie: 0.4.2 + cors: 2.8.5 + debug: 4.3.4(supports-color@8.1.1) + engine.io-parser: 5.2.1 + ws: 8.11.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + /ent@2.2.0: + resolution: {integrity: sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==} + dev: true + + /entities@1.0.0: + resolution: {integrity: sha512-LbLqfXgJMmy81t+7c14mnulFHJ170cM6E+0vMXR9k/ZiZwgX8i5pNgjTCX3SO4VeUsFLV+8InixoretwU+MjBQ==} + dev: true + + /entities@2.1.0: + resolution: {integrity: sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==} + dev: true + + /entities@2.2.0: + resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + dev: true + + /error-ex@1.3.2: + resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + dependencies: + is-arrayish: 0.2.1 + dev: true + + /error@7.2.1: + resolution: {integrity: sha512-fo9HBvWnx3NGUKMvMwB/CBCMMrfEJgbDTVDEkPygA3Bdd3lM1OyCd+rbQ8BwnpF6GdVeOLDNmyL4N5Bg80ZvdA==} + dependencies: + string-template: 0.2.1 + dev: true + + /escalade@3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: true + + /escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + dev: true + + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true + + /escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + dev: true + + /escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + dev: true + + /escodegen@2.1.0: + resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} + engines: {node: '>=6.0'} + hasBin: true + dependencies: + esprima: 4.0.1 + estraverse: 5.3.0 + esutils: 2.0.3 + optionalDependencies: + source-map: 0.6.1 + dev: true + + /esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + dev: true + + /esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + dev: true + + /eventemitter2@0.4.14: + resolution: {integrity: sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==} + dev: true + + /eventemitter2@6.4.9: + resolution: {integrity: sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==} + dev: false + + /eventemitter3@4.0.7: + resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + dev: true + + /events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + dev: true + + /evp_bytestokey@1.0.3: + resolution: {integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==} + dependencies: + md5.js: 1.3.5 + safe-buffer: 5.2.1 + dev: true + + /exit@0.1.2: + resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} + engines: {node: '>= 0.8.0'} + dev: true + + /expand-tilde@2.0.2: + resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} + engines: {node: '>=0.10.0'} + dependencies: + homedir-polyfill: 1.0.3 + dev: true + + /extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + dev: true + + /extract-zip@2.0.1: + resolution: {integrity: sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==} + engines: {node: '>= 10.17.0'} + hasBin: true + dependencies: + debug: 4.3.4(supports-color@8.1.1) + get-stream: 5.2.0 + yauzl: 2.10.0 + optionalDependencies: + '@types/yauzl': 2.10.3 + transitivePeerDependencies: + - supports-color + dev: true + + /fast-fifo@1.3.2: + resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==} + dev: true + + /fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + dev: true + + /faye-websocket@0.10.0: + resolution: {integrity: sha512-Xhj93RXbMSq8urNCUq4p9l0P6hnySJ/7YNRhYNug0bLOuii7pKO7xQFb5mx9xZXWCar88pLPb805PvUkwrLZpQ==} + engines: {node: '>=0.4.0'} + dependencies: + websocket-driver: 0.7.4 + dev: true + + /fd-slicer@1.1.0: + resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + dependencies: + pend: 1.2.0 + dev: true + + /figures@1.7.0: + resolution: {integrity: sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==} + engines: {node: '>=0.10.0'} + dependencies: + escape-string-regexp: 1.0.5 + object-assign: 4.1.1 + dev: true + + /figures@3.2.0: + resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} + engines: {node: '>=8'} + dependencies: + escape-string-regexp: 1.0.5 + dev: true + + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + + /finalhandler@1.1.2: + resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} + engines: {node: '>= 0.8'} + dependencies: + debug: 2.6.9 + encodeurl: 1.0.2 + escape-html: 1.0.3 + on-finished: 2.3.0 + parseurl: 1.3.3 + statuses: 1.5.0 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + dev: true + + /find-up@3.0.0: + resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} + engines: {node: '>=6'} + dependencies: + locate-path: 3.0.0 + dev: true + + /find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + dev: true + + /findup-sync@4.0.0: + resolution: {integrity: sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==} + engines: {node: '>= 8'} + dependencies: + detect-file: 1.0.0 + is-glob: 4.0.3 + micromatch: 4.0.5 + resolve-dir: 1.0.1 + dev: true + + /findup-sync@5.0.0: + resolution: {integrity: sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==} + engines: {node: '>= 10.13.0'} + dependencies: + detect-file: 1.0.0 + is-glob: 4.0.3 + micromatch: 4.0.5 + resolve-dir: 1.0.1 + dev: true + + /fined@1.2.0: + resolution: {integrity: sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==} + engines: {node: '>= 0.10'} + dependencies: + expand-tilde: 2.0.2 + is-plain-object: 2.0.4 + object.defaults: 1.1.0 + object.pick: 1.3.0 + parse-filepath: 1.0.2 + dev: true + + /flagged-respawn@1.0.1: + resolution: {integrity: sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==} + engines: {node: '>= 0.10'} + dev: true + + /flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + dev: true + + /flatted@3.2.9: + resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} + dev: true + + /follow-redirects@1.15.3: + resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: true + + /for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + + /for-in@1.0.2: + resolution: {integrity: sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==} + engines: {node: '>=0.10.0'} + dev: true + + /for-own@1.0.0: + resolution: {integrity: sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==} + engines: {node: '>=0.10.0'} + dependencies: + for-in: 1.0.2 + dev: true + + /fs-extra@8.1.0: + resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} + engines: {node: '>=6 <7 || >=8'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + dev: true + + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + + /gaze@1.1.3: + resolution: {integrity: sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==} + engines: {node: '>= 4.0.0'} + dependencies: + globule: 1.3.4 + dev: true + + /get-assigned-identifiers@1.2.0: + resolution: {integrity: sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==} + dev: true + + /get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + dev: true + + /get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + dev: true + + /get-intrinsic@1.2.2: + resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + dependencies: + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + dev: true + + /get-stream@5.2.0: + resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} + engines: {node: '>=8'} + dependencies: + pump: 3.0.0 + dev: true + + /get-uri@6.0.2: + resolution: {integrity: sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==} + engines: {node: '>= 14'} + dependencies: + basic-ftp: 5.0.3 + data-uri-to-buffer: 6.0.1 + debug: 4.3.4(supports-color@8.1.1) + fs-extra: 8.1.0 + transitivePeerDependencies: + - supports-color + dev: true + + /getobject@1.0.2: + resolution: {integrity: sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==} + engines: {node: '>=10'} + dev: true + + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob@7.1.7: + resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.0.8 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /glob@7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /global-modules@1.0.0: + resolution: {integrity: sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==} + engines: {node: '>=0.10.0'} + dependencies: + global-prefix: 1.0.2 + is-windows: 1.0.2 + resolve-dir: 1.0.1 + dev: true + + /global-prefix@1.0.2: + resolution: {integrity: sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==} + engines: {node: '>=0.10.0'} + dependencies: + expand-tilde: 2.0.2 + homedir-polyfill: 1.0.3 + ini: 1.3.8 + is-windows: 1.0.2 + which: 1.3.1 + dev: true + + /globule@1.3.4: + resolution: {integrity: sha512-OPTIfhMBh7JbBYDpa5b+Q5ptmMWKwcNcFSR/0c6t8V4f3ZAVBEsKNY37QdVqmLRYSMhOUGYrY0QhSoEpzGr/Eg==} + engines: {node: '>= 0.10'} + dependencies: + glob: 7.1.7 + lodash: 4.17.21 + minimatch: 3.0.8 + dev: true + + /gopd@1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true + + /grunt-browserify@6.0.0: + resolution: {integrity: sha512-m130pTVFEsxQZ+dJQd287TrnUI5VvEKJ+MmPjMF/7bVJBTBRWhJlYVFgBOYLZMUykfk1RWXfQ2sAQu5NuXumvg==} + engines: {node: '>= 8.10.x'} + dependencies: + async: 2.6.4 + browserify: 17.0.0 + browserify-incremental: 3.1.1(browserify@17.0.0) + glob: 7.2.3 + lodash: 4.17.21 + resolve: 1.22.8 + watchify: 4.0.0 + dev: true + + /grunt-cli@1.4.3: + resolution: {integrity: sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==} + engines: {node: '>=10'} + hasBin: true + dependencies: + grunt-known-options: 2.0.0 + interpret: 1.1.0 + liftup: 3.0.1 + nopt: 4.0.3 + v8flags: 3.2.0 + dev: true + + /grunt-contrib-clean@2.0.1(grunt@1.6.1): + resolution: {integrity: sha512-uRvnXfhiZt8akb/ZRDHJpQQtkkVkqc/opWO4Po/9ehC2hPxgptB9S6JHDC/Nxswo4CJSM0iFPT/Iym3cEMWzKA==} + engines: {node: '>=12'} + peerDependencies: + grunt: '>=0.4.5' + dependencies: + async: 3.2.5 + grunt: 1.6.1 + rimraf: 2.7.1 + dev: true + + /grunt-contrib-jshint@3.2.0: + resolution: {integrity: sha512-pcXWCSZWfoMSvcV4BwH21TUtLtcX0Ms8IGuOPIcLeXK3fud9KclY7iqMKY94jFx8TxZzh028YYtpR+io8DiEaQ==} + engines: {node: '>=10'} + dependencies: + chalk: 4.1.2 + hooker: 0.2.3 + jshint: 2.13.6 + dev: true + + /grunt-contrib-uglify@5.2.2: + resolution: {integrity: sha512-ITxiWxrjjP+RZu/aJ5GLvdele+sxlznh+6fK9Qckio5ma8f7Iv8woZjRkGfafvpuygxNefOJNc+hfjjBayRn2Q==} + engines: {node: '>=12'} + dependencies: + chalk: 4.1.2 + maxmin: 3.0.0 + uglify-js: 3.17.4 + uri-path: 1.0.0 + dev: true + + /grunt-contrib-watch@1.1.0: + resolution: {integrity: sha512-yGweN+0DW5yM+oo58fRu/XIRrPcn3r4tQx+nL7eMRwjpvk+rQY6R8o94BPK0i2UhTg9FN21hS+m8vR8v9vXfeg==} + engines: {node: '>=0.10.0'} + dependencies: + async: 2.6.4 + gaze: 1.1.3 + lodash: 4.17.21 + tiny-lr: 1.1.1 + transitivePeerDependencies: + - supports-color + dev: true + + /grunt-jsdoc@2.4.1: + resolution: {integrity: sha512-S0zxU0wDewRu7z+vijEItOWe/UttxWVmvz0qz2ZVcAYR2GpXjsiski2CAVN0b18t2qeVLdmxZkJaEWCOsKzcAw==} + engines: {node: '>= 8.12.0'} + hasBin: true + dependencies: + cross-spawn: 7.0.3 + jsdoc: 3.6.11 + dev: true + + /grunt-karma@4.0.2(grunt@1.6.1)(karma@6.4.2): + resolution: {integrity: sha512-4+iBBkXZjHHMDAG5kpHCdDUqlSEBJ6sqouLMRf0p+QB8wGMs300DtaCQphHqd7pM3gpXoGVT3yRRsT7KOZpJMA==} + peerDependencies: + grunt: '>=0.4.x' + karma: ^4.0.0 || ^5.0.0 || ^6.0.0 + dependencies: + grunt: 1.6.1 + karma: 6.4.2 + lodash: 4.17.21 + dev: true + + /grunt-known-options@2.0.0: + resolution: {integrity: sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==} + engines: {node: '>=0.10.0'} + dev: true + + /grunt-legacy-log-utils@2.1.0: + resolution: {integrity: sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==} + engines: {node: '>=10'} + dependencies: + chalk: 4.1.2 + lodash: 4.17.21 + dev: true + + /grunt-legacy-log@3.0.0: + resolution: {integrity: sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==} + engines: {node: '>= 0.10.0'} + dependencies: + colors: 1.1.2 + grunt-legacy-log-utils: 2.1.0 + hooker: 0.2.3 + lodash: 4.17.21 + dev: true + + /grunt-legacy-util@2.0.1: + resolution: {integrity: sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==} + engines: {node: '>=10'} + dependencies: + async: 3.2.5 + exit: 0.1.2 + getobject: 1.0.2 + hooker: 0.2.3 + lodash: 4.17.21 + underscore.string: 3.3.6 + which: 2.0.2 + dev: true + + /grunt-mocha-test@0.13.3(mocha@10.2.0): + resolution: {integrity: sha512-zQGEsi3d+ViPPi7/4jcj78afKKAKiAA5n61pknQYi25Ugik+aNOuRmiOkmb8mN2CeG8YxT+YdT1H1Q7B/eNkoQ==} + engines: {node: '>= 0.10.4'} + peerDependencies: + mocha: '>=1.20.0' + dependencies: + hooker: 0.2.3 + mkdirp: 0.5.6 + mocha: 10.2.0 + dev: true + + /grunt-shell@4.0.0(grunt@1.6.1): + resolution: {integrity: sha512-dHFy8VZDfWGYLTeNvIHze4PKXGvIlDWuN0UE7hUZstTQeiEyv1VmW1MaDYQ3X5tE3bCi3bEia1gGKH8z/f1czQ==} + engines: {node: '>=12'} + peerDependencies: + grunt: '>=1' + dependencies: + chalk: 3.0.0 + grunt: 1.6.1 + npm-run-path: 2.0.2 + strip-ansi: 6.0.1 + dev: true + + /grunt@1.6.1: + resolution: {integrity: sha512-/ABUy3gYWu5iBmrUSRBP97JLpQUm0GgVveDCp6t3yRNIoltIYw7rEj3g5y1o2PGPR2vfTRGa7WC/LZHLTXnEzA==} + engines: {node: '>=16'} + hasBin: true + dependencies: + dateformat: 4.6.3 + eventemitter2: 0.4.14 + exit: 0.1.2 + findup-sync: 5.0.0 + glob: 7.1.7 + grunt-cli: 1.4.3 + grunt-known-options: 2.0.0 + grunt-legacy-log: 3.0.0 + grunt-legacy-util: 2.0.1 + iconv-lite: 0.6.3 + js-yaml: 3.14.1 + minimatch: 3.0.8 + nopt: 3.0.6 + dev: true + + /gzip-size@5.1.1: + resolution: {integrity: sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==} + engines: {node: '>=6'} + dependencies: + duplexer: 0.1.2 + pify: 4.0.1 + dev: true + + /has-ansi@2.0.0: + resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} + engines: {node: '>=0.10.0'} + dependencies: + ansi-regex: 2.1.1 + dev: true + + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true + + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + /has-property-descriptors@1.0.1: + resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + + /has-proto@1.0.1: + resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + engines: {node: '>= 0.4'} + dev: true + + /has-symbols@1.0.3: + resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} + engines: {node: '>= 0.4'} + dev: true + + /has-tostringtag@1.0.0: + resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /has@1.0.4: + resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} + engines: {node: '>= 0.4.0'} + dev: true + + /hash-base@3.1.0: + resolution: {integrity: sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==} + engines: {node: '>=4'} + dependencies: + inherits: 2.0.4 + readable-stream: 3.6.2 + safe-buffer: 5.2.1 + dev: true + + /hash.js@1.1.7: + resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + dev: true + + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + + /he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + dev: true + + /hmac-drbg@1.0.1: + resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} + dependencies: + hash.js: 1.1.7 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + + /homedir-polyfill@1.0.3: + resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} + engines: {node: '>=0.10.0'} + dependencies: + parse-passwd: 1.0.0 + dev: true + + /hooker@0.2.3: + resolution: {integrity: sha512-t+UerCsQviSymAInD01Pw+Dn/usmz1sRO+3Zk1+lx8eg+WKpD2ulcwWqHHL0+aseRBr+3+vIhiG1K1JTwaIcTA==} + dev: true + + /htmlescape@1.1.1: + resolution: {integrity: sha512-eVcrzgbR4tim7c7soKQKtxa/kQM4TzjnlU83rcZ9bHU6t31ehfV7SktN6McWgwPWg+JYMA/O3qpGxBvFq1z2Jg==} + engines: {node: '>=0.10'} + dev: true + + /htmlparser2@3.8.3: + resolution: {integrity: sha512-hBxEg3CYXe+rPIua8ETe7tmG3XDn9B0edOE/e9wH2nLczxzgdu0m0aNHY+5wFZiviLWLdANPJTssa92dMcXQ5Q==} + dependencies: + domelementtype: 1.3.1 + domhandler: 2.3.0 + domutils: 1.5.1 + entities: 1.0.0 + readable-stream: 1.1.14 + dev: true + + /http-errors@2.0.0: + resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} + engines: {node: '>= 0.8'} + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.1 + toidentifier: 1.0.1 + dev: true + + /http-parser-js@0.5.8: + resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} + dev: true + + /http-proxy-agent@7.0.0: + resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.0 + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + + /http-proxy@1.18.1: + resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} + engines: {node: '>=8.0.0'} + dependencies: + eventemitter3: 4.0.7 + follow-redirects: 1.15.3 + requires-port: 1.0.0 + transitivePeerDependencies: + - debug + dev: true + + /https-browserify@1.0.0: + resolution: {integrity: sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==} + dev: true + + /https-proxy-agent@7.0.2: + resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.0 + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + + /iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true + + /iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true + + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: true + + /import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + dev: true + + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true + + /inherits@2.0.3: + resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} + dev: true + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true + + /ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + dev: true + + /inline-source-map@0.6.2: + resolution: {integrity: sha512-0mVWSSbNDvedDWIN4wxLsdPM4a7cIPcpyMxj3QZ406QRwQ6ePGB1YIHxVPjqpcUGbWQ5C+nHTwGNWAGvt7ggVA==} + dependencies: + source-map: 0.5.7 + dev: true + + /insert-module-globals@7.2.1: + resolution: {integrity: sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==} + hasBin: true + dependencies: + JSONStream: 1.3.5 + acorn-node: 1.8.2 + combine-source-map: 0.8.0 + concat-stream: 1.6.2 + is-buffer: 1.1.6 + path-is-absolute: 1.0.1 + process: 0.11.10 + through2: 2.0.5 + undeclared-identifiers: 1.1.3 + xtend: 4.0.2 + dev: true + + /interpret@1.1.0: + resolution: {integrity: sha512-CLM8SNMDu7C5psFCn6Wg/tgpj/bKAg7hc2gWqcuR9OD5Ft9PhBpIu8PLicPeis+xDd6YX2ncI8MCA64I9tftIA==} + dev: true + + /ip@1.1.8: + resolution: {integrity: sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==} + dev: true + + /ip@2.0.0: + resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} + dev: true + + /is-absolute@1.0.0: + resolution: {integrity: sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==} + engines: {node: '>=0.10.0'} + dependencies: + is-relative: 1.0.0 + is-windows: 1.0.2 + dev: true + + /is-arguments@1.1.1: + resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + dev: true + + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + + /is-buffer@1.1.6: + resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} + dev: true + + /is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + dev: true + + /is-core-module@2.13.1: + resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} + dependencies: + hasown: 2.0.0 + dev: true + + /is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + dev: true + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-finite@1.1.0: + resolution: {integrity: sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==} + engines: {node: '>=0.10.0'} + dev: true + + /is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + dev: true + + /is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + + /is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + dev: true + + /is-plain-object@2.0.4: + resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} + engines: {node: '>=0.10.0'} + dependencies: + isobject: 3.0.1 + dev: true + + /is-relative@1.0.0: + resolution: {integrity: sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==} + engines: {node: '>=0.10.0'} + dependencies: + is-unc-path: 1.0.0 + dev: true + + /is-typed-array@1.1.12: + resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.13 + dev: true + + /is-unc-path@1.0.0: + resolution: {integrity: sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==} + engines: {node: '>=0.10.0'} + dependencies: + unc-path-regex: 0.1.2 + dev: true + + /is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + dev: true + + /is-windows@1.0.2: + resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} + engines: {node: '>=0.10.0'} + dev: true + + /is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + dependencies: + is-docker: 2.2.1 + dev: true + + /isarray@0.0.1: + resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} + dev: true + + /isarray@1.0.0: + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + dev: true + + /isbinaryfile@4.0.10: + resolution: {integrity: sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==} + engines: {node: '>= 8.0.0'} + dev: true + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + + /isobject@3.0.1: + resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} + engines: {node: '>=0.10.0'} + dev: true + + /js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + dev: true + + /js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + + /js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + dependencies: + argparse: 2.0.1 + dev: true + + /js2xmlparser@4.0.2: + resolution: {integrity: sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==} + dependencies: + xmlcreate: 2.0.4 + dev: true + + /jsdoc@3.6.11: + resolution: {integrity: sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==} + engines: {node: '>=12.0.0'} + hasBin: true + dependencies: + '@babel/parser': 7.23.3 + '@types/markdown-it': 12.2.3 + bluebird: 3.7.2 + catharsis: 0.9.0 + escape-string-regexp: 2.0.0 + js2xmlparser: 4.0.2 + klaw: 3.0.0 + markdown-it: 12.3.2 + markdown-it-anchor: 8.6.7(@types/markdown-it@12.2.3)(markdown-it@12.3.2) + marked: 4.3.0 + mkdirp: 1.0.4 + requizzle: 0.2.4 + strip-json-comments: 3.1.1 + taffydb: 2.6.2 + underscore: 1.13.6 + dev: true + + /jshint@2.13.6: + resolution: {integrity: sha512-IVdB4G0NTTeQZrBoM8C5JFVLjV2KtZ9APgybDA1MK73xb09qFs0jCXyQLnCOp1cSZZZbvhq/6mfXHUTaDkffuQ==} + hasBin: true + dependencies: + cli: 1.0.1 + console-browserify: 1.1.0 + exit: 0.1.2 + htmlparser2: 3.8.3 + lodash: 4.17.21 + minimatch: 3.0.8 + strip-json-comments: 1.0.4 + dev: true + + /json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + dev: true + + /jsonfile@4.0.0: + resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} + optionalDependencies: + graceful-fs: 4.2.11 + dev: true + + /jsonparse@0.0.5: + resolution: {integrity: sha512-fw7Q/8gFR8iSekUi9I+HqWIap6mywuoe7hQIg3buTVjuZgALKj4HAmm0X6f+TaL4c9NJbvyFQdaI2ppr5p6dnQ==} + engines: {'0': node >= 0.2.0} + dev: true + + /jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + dev: true + + /karma-chai@0.1.0(chai@4.3.10)(karma@6.4.2): + resolution: {integrity: sha512-mqKCkHwzPMhgTYca10S90aCEX9+HjVjjrBFAsw36Zj7BlQNbokXXCAe6Ji04VUMsxcY5RLP7YphpfO06XOubdg==} + peerDependencies: + chai: '*' + karma: '>=0.10.9' + dependencies: + chai: 4.3.10 + karma: 6.4.2 + dev: true + + /karma-chrome-launcher@3.2.0: + resolution: {integrity: sha512-rE9RkUPI7I9mAxByQWkGJFXfFD6lE4gC5nPuZdobf/QdTEJI6EU4yIay/cfU/xV4ZxlM5JiTv7zWYgA64NpS5Q==} + dependencies: + which: 1.3.1 + dev: true + + /karma-firefox-launcher@2.1.2: + resolution: {integrity: sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==} + dependencies: + is-wsl: 2.2.0 + which: 2.0.2 + dev: true + + /karma-mocha@2.0.1: + resolution: {integrity: sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==} + dependencies: + minimist: 1.2.8 + dev: true + + /karma@6.4.2: + resolution: {integrity: sha512-C6SU/53LB31BEgRg+omznBEMY4SjHU3ricV6zBcAe1EeILKkeScr+fZXtaI5WyDbkVowJxxAI6h73NcFPmXolQ==} + engines: {node: '>= 10'} + hasBin: true + dependencies: + '@colors/colors': 1.5.0 + body-parser: 1.20.2 + braces: 3.0.2 + chokidar: 3.5.3 + connect: 3.7.0 + di: 0.0.1 + dom-serialize: 2.2.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + http-proxy: 1.18.1 + isbinaryfile: 4.0.10 + lodash: 4.17.21 + log4js: 6.9.1 + mime: 2.6.0 + minimatch: 3.1.2 + mkdirp: 0.5.6 + qjobs: 1.2.0 + range-parser: 1.2.1 + rimraf: 3.0.2 + socket.io: 4.7.2 + source-map: 0.6.1 + tmp: 0.2.1 + ua-parser-js: 0.7.37 + yargs: 16.2.0 + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - utf-8-validate + dev: true + + /kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + dev: true + + /klaw@3.0.0: + resolution: {integrity: sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==} + dependencies: + graceful-fs: 4.2.11 + dev: true + + /labeled-stream-splicer@2.0.2: + resolution: {integrity: sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==} + dependencies: + inherits: 2.0.4 + stream-splicer: 2.0.1 + dev: true + + /liftup@3.0.1: + resolution: {integrity: sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==} + engines: {node: '>=10'} + dependencies: + extend: 3.0.2 + findup-sync: 4.0.0 + fined: 1.2.0 + flagged-respawn: 1.0.1 + is-plain-object: 2.0.4 + object.map: 1.0.1 + rechoir: 0.7.1 + resolve: 1.22.8 + dev: true + + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true + + /linkify-it@3.0.3: + resolution: {integrity: sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==} + dependencies: + uc.micro: 1.0.6 + dev: true + + /livereload-js@2.4.0: + resolution: {integrity: sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==} + dev: true + + /load-grunt-tasks@5.1.0(grunt@1.6.1): + resolution: {integrity: sha512-oNj0Jlka1TsfDe+9He0kcA1cRln+TMoTsEByW7ij6kyktNLxBKJtslCFEvFrLC2Dj0S19IWJh3fOCIjLby2Xrg==} + engines: {node: '>=8'} + peerDependencies: + grunt: '>=1' + dependencies: + arrify: 2.0.1 + grunt: 1.6.1 + multimatch: 4.0.0 + pkg-up: 3.1.0 + resolve-pkg: 2.0.0 + dev: true + + /locate-path@3.0.0: + resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} + engines: {node: '>=6'} + dependencies: + p-locate: 3.0.0 + path-exists: 3.0.0 + dev: true + + /locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + dependencies: + p-locate: 5.0.0 + dev: true + + /lodash.memoize@3.0.4: + resolution: {integrity: sha512-eDn9kqrAmVUC1wmZvlQ6Uhde44n+tXpqPrN8olQJbttgh0oKclk+SF54P47VEGE9CEiMeRwAP8BaM7UHvBkz2A==} + dev: true + + /lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true + + /log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + dev: true + + /log4js@6.9.1: + resolution: {integrity: sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==} + engines: {node: '>=8.0'} + dependencies: + date-format: 4.0.14 + debug: 4.3.4(supports-color@8.1.1) + flatted: 3.2.9 + rfdc: 1.3.0 + streamroller: 3.1.5 + transitivePeerDependencies: + - supports-color + dev: true + + /loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /lru-cache@7.18.3: + resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} + engines: {node: '>=12'} + dev: true + + /make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true + + /make-iterator@1.0.1: + resolution: {integrity: sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==} + engines: {node: '>=0.10.0'} + dependencies: + kind-of: 6.0.3 + dev: true + + /map-cache@0.2.2: + resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==} + engines: {node: '>=0.10.0'} + dev: true + + /markdown-it-anchor@8.6.7(@types/markdown-it@12.2.3)(markdown-it@12.3.2): + resolution: {integrity: sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==} + peerDependencies: + '@types/markdown-it': '*' + markdown-it: '*' + dependencies: + '@types/markdown-it': 12.2.3 + markdown-it: 12.3.2 + dev: true + + /markdown-it@12.3.2: + resolution: {integrity: sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==} + hasBin: true + dependencies: + argparse: 2.0.1 + entities: 2.1.0 + linkify-it: 3.0.3 + mdurl: 1.0.1 + uc.micro: 1.0.6 + dev: true + + /marked@4.3.0: + resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} + engines: {node: '>= 12'} + hasBin: true + dev: true + + /maxmin@3.0.0: + resolution: {integrity: sha512-wcahMInmGtg/7c6a75fr21Ch/Ks1Tb+Jtoan5Ft4bAI0ZvJqyOw8kkM7e7p8hDSzY805vmxwHT50KcjGwKyJ0g==} + engines: {node: '>=10'} + dependencies: + chalk: 4.1.2 + figures: 3.2.0 + gzip-size: 5.1.1 + pretty-bytes: 5.6.0 + dev: true + + /md5.js@1.3.5: + resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} + dependencies: + hash-base: 3.1.0 + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: true + + /mdurl@1.0.1: + resolution: {integrity: sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==} + dev: true + + /media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + dev: true + + /micromatch@4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.2 + picomatch: 2.3.1 + dev: true + + /miller-rabin@4.0.1: + resolution: {integrity: sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==} + hasBin: true + dependencies: + bn.js: 4.12.0 + brorand: 1.1.0 + dev: true + + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + + /mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + dev: true + + /minimalistic-assert@1.0.1: + resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + dev: true + + /minimalistic-crypto-utils@1.0.1: + resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} + dev: true + + /minimatch@3.0.8: + resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /minimatch@5.0.1: + resolution: {integrity: sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + + /minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + + /mitt@3.0.1: + resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + dev: true + + /mkdirp-classic@0.5.3: + resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + dev: true + + /mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: true + + /mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + dev: true + + /mocha@10.2.0: + resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} + engines: {node: '>= 14.0.0'} + hasBin: true + dependencies: + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4(supports-color@8.1.1) + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + nanoid: 3.3.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + dev: true + + /module-deps@6.2.3: + resolution: {integrity: sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==} + engines: {node: '>= 0.8.0'} + hasBin: true + dependencies: + JSONStream: 1.3.5 + browser-resolve: 2.0.0 + cached-path-relative: 1.1.0 + concat-stream: 1.6.2 + defined: 1.0.1 + detective: 5.2.1 + duplexer2: 0.1.4 + inherits: 2.0.4 + parents: 1.0.1 + readable-stream: 2.3.8 + resolve: 1.22.8 + stream-combiner2: 1.1.1 + subarg: 1.0.0 + through2: 2.0.5 + xtend: 4.0.2 + dev: true + + /ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + dev: true + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + /ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: true + + /multimatch@4.0.0: + resolution: {integrity: sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==} + engines: {node: '>=8'} + dependencies: + '@types/minimatch': 3.0.5 + array-differ: 3.0.0 + array-union: 2.1.0 + arrify: 2.0.1 + minimatch: 3.1.2 + dev: true + + /nanoid@3.3.3: + resolution: {integrity: sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /negotiator@0.6.3: + resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} + engines: {node: '>= 0.6'} + + /netmask@2.0.2: + resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} + engines: {node: '>= 0.4.0'} + dev: true + + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + + /nopt@3.0.6: + resolution: {integrity: sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: true + + /nopt@4.0.3: + resolution: {integrity: sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==} + hasBin: true + dependencies: + abbrev: 1.1.1 + osenv: 0.1.5 + dev: true + + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + + /npm-run-path@2.0.2: + resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} + engines: {node: '>=4'} + dependencies: + path-key: 2.0.1 + dev: true + + /number-is-nan@1.0.1: + resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} + engines: {node: '>=0.10.0'} + dev: true + + /object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true + + /object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + dev: true + + /object.assign@4.1.4: + resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + + /object.defaults@1.1.0: + resolution: {integrity: sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==} + engines: {node: '>=0.10.0'} + dependencies: + array-each: 1.0.1 + array-slice: 1.1.0 + for-own: 1.0.0 + isobject: 3.0.1 + dev: true + + /object.map@1.0.1: + resolution: {integrity: sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==} + engines: {node: '>=0.10.0'} + dependencies: + for-own: 1.0.0 + make-iterator: 1.0.1 + dev: true + + /object.pick@1.3.0: + resolution: {integrity: sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==} + engines: {node: '>=0.10.0'} + dependencies: + isobject: 3.0.1 + dev: true + + /on-finished@2.3.0: + resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} + engines: {node: '>= 0.8'} + dependencies: + ee-first: 1.1.1 + dev: true + + /on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + dependencies: + ee-first: 1.1.1 + dev: true + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true + + /os-browserify@0.3.0: + resolution: {integrity: sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==} + dev: true + + /os-homedir@1.0.2: + resolution: {integrity: sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==} + engines: {node: '>=0.10.0'} + dev: true + + /os-tmpdir@1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + dev: true + + /osenv@0.1.5: + resolution: {integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==} + dependencies: + os-homedir: 1.0.2 + os-tmpdir: 1.0.2 + dev: true + + /outpipe@1.1.1: + resolution: {integrity: sha512-BnNY/RwnDrkmQdUa9U+OfN/Y7AWmKuUPCCd+hbRclZnnANvYpO72zp/a6Q4n829hPbdqEac31XCcsvlEvb+rtA==} + dependencies: + shell-quote: 1.8.1 + dev: true + + /p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + dependencies: + p-try: 2.2.0 + dev: true + + /p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + dependencies: + yocto-queue: 0.1.0 + dev: true + + /p-locate@3.0.0: + resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} + engines: {node: '>=6'} + dependencies: + p-limit: 2.3.0 + dev: true + + /p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + dependencies: + p-limit: 3.1.0 + dev: true + + /p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + dev: true + + /pac-proxy-agent@7.0.1: + resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==} + engines: {node: '>= 14'} + dependencies: + '@tootallnate/quickjs-emscripten': 0.23.0 + agent-base: 7.1.0 + debug: 4.3.4(supports-color@8.1.1) + get-uri: 6.0.2 + http-proxy-agent: 7.0.0 + https-proxy-agent: 7.0.2 + pac-resolver: 7.0.0 + socks-proxy-agent: 8.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /pac-resolver@7.0.0: + resolution: {integrity: sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==} + engines: {node: '>= 14'} + dependencies: + degenerator: 5.0.1 + ip: 1.1.8 + netmask: 2.0.2 + dev: true + + /pako@1.0.11: + resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} + dev: true + + /parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + dependencies: + callsites: 3.1.0 + dev: true + + /parents@1.0.1: + resolution: {integrity: sha512-mXKF3xkoUt5td2DoxpLmtOmZvko9VfFpwRwkKDHSNvgmpLAeBo18YDhcPbBzJq+QLCHMbGOfzia2cX4U+0v9Mg==} + dependencies: + path-platform: 0.11.15 + dev: true + + /parse-asn1@5.1.6: + resolution: {integrity: sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==} + dependencies: + asn1.js: 5.4.1 + browserify-aes: 1.2.0 + evp_bytestokey: 1.0.3 + pbkdf2: 3.1.2 + safe-buffer: 5.2.1 + dev: true + + /parse-filepath@1.0.2: + resolution: {integrity: sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==} + engines: {node: '>=0.8'} + dependencies: + is-absolute: 1.0.0 + map-cache: 0.2.2 + path-root: 0.1.1 + dev: true + + /parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + dependencies: + '@babel/code-frame': 7.22.13 + error-ex: 1.3.2 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + dev: true + + /parse-ms@1.0.1: + resolution: {integrity: sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==} + engines: {node: '>=0.10.0'} + dev: true + + /parse-passwd@1.0.0: + resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} + engines: {node: '>=0.10.0'} + dev: true + + /parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + dev: true + + /path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + dev: true + + /path-exists@3.0.0: + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} + engines: {node: '>=4'} + dev: true + + /path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + dev: true + + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: true + + /path-key@2.0.1: + resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} + engines: {node: '>=4'} + dev: true + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true + + /path-platform@0.11.15: + resolution: {integrity: sha512-Y30dB6rab1A/nfEKsZxmr01nUotHX0c/ZiIAsCTatEe1CmS5Pm5He7fZ195bPT7RdquoaL8lLxFCMQi/bS7IJg==} + engines: {node: '>= 0.8.0'} + dev: true + + /path-root-regex@0.1.2: + resolution: {integrity: sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==} + engines: {node: '>=0.10.0'} + dev: true + + /path-root@0.1.1: + resolution: {integrity: sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==} + engines: {node: '>=0.10.0'} + dependencies: + path-root-regex: 0.1.2 + dev: true + + /path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + dev: true + + /pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true + + /pbkdf2@3.1.2: + resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==} + engines: {node: '>=0.12'} + dependencies: + create-hash: 1.2.0 + create-hmac: 1.1.7 + ripemd160: 2.0.2 + safe-buffer: 5.2.1 + sha.js: 2.4.11 + dev: true + + /pend@1.2.0: + resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} + dev: true + + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + + /pify@4.0.1: + resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} + engines: {node: '>=6'} + dev: true + + /pkg-up@3.1.0: + resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} + engines: {node: '>=8'} + dependencies: + find-up: 3.0.0 + dev: true + + /plur@1.0.0: + resolution: {integrity: sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==} + engines: {node: '>=0.10.0'} + dev: true + + /pngparse@2.0.1: + resolution: {integrity: sha512-RyB1P0BBwt3CNIZ5wT53lR1dT3CUtopnMOuP8xZdHjPhI/uXNNRnkx1yQb/3MMMyyMeo6p19fiIRHcLopWIkxA==} + dev: false + + /pretty-bytes@5.6.0: + resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} + engines: {node: '>=6'} + dev: true + + /pretty-ms@2.1.0: + resolution: {integrity: sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==} + engines: {node: '>=0.10.0'} + dependencies: + is-finite: 1.1.0 + parse-ms: 1.0.1 + plur: 1.0.0 + dev: true + + /process-nextick-args@2.0.1: + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + dev: true + + /process@0.11.10: + resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} + engines: {node: '>= 0.6.0'} + dev: true + + /progress@2.0.3: + resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} + engines: {node: '>=0.4.0'} + dev: true + + /proxy-agent@6.3.1: + resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.0 + debug: 4.3.4(supports-color@8.1.1) + http-proxy-agent: 7.0.0 + https-proxy-agent: 7.0.2 + lru-cache: 7.18.3 + pac-proxy-agent: 7.0.1 + proxy-from-env: 1.1.0 + socks-proxy-agent: 8.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + dev: true + + /public-encrypt@4.0.3: + resolution: {integrity: sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==} + dependencies: + bn.js: 4.12.0 + browserify-rsa: 4.1.0 + create-hash: 1.2.0 + parse-asn1: 5.1.6 + randombytes: 2.1.0 + safe-buffer: 5.2.1 + dev: true + + /pump@3.0.0: + resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} + dependencies: + end-of-stream: 1.4.4 + once: 1.4.0 + dev: true + + /punycode@1.4.1: + resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} + dev: true + + /puppeteer-core@21.5.2: + resolution: {integrity: sha512-v4T0cWnujSKs+iEfmb8ccd7u4/x8oblEyKqplqKnJ582Kw8PewYAWvkH4qUWhitN3O2q9RF7dzkvjyK5HbzjLA==} + engines: {node: '>=16.13.2'} + dependencies: + '@puppeteer/browsers': 1.8.0 + chromium-bidi: 0.4.33(devtools-protocol@0.0.1203626) + cross-fetch: 4.0.0 + debug: 4.3.4(supports-color@8.1.1) + devtools-protocol: 0.0.1203626 + ws: 8.14.2 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: true + + /puppeteer@21.5.2(typescript@5.2.2): + resolution: {integrity: sha512-BaAGJOq8Fl6/cck6obmwaNLksuY0Bg/lIahCLhJPGXBFUD2mCffypa4A592MaWnDcye7eaHmSK9yot0pxctY8A==} + engines: {node: '>=16.13.2'} + requiresBuild: true + dependencies: + '@puppeteer/browsers': 1.8.0 + cosmiconfig: 8.3.6(typescript@5.2.2) + puppeteer-core: 21.5.2 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - typescript + - utf-8-validate + dev: true + + /qjobs@1.2.0: + resolution: {integrity: sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==} + engines: {node: '>=0.9'} + dev: true + + /qs@6.11.0: + resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.4 + dev: true + + /qs@6.11.2: + resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.4 + dev: true + + /querystring-es3@0.2.1: + resolution: {integrity: sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==} + engines: {node: '>=0.4.x'} + dev: true + + /queue-tick@1.0.1: + resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + dev: true + + /randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + dependencies: + safe-buffer: 5.2.1 + dev: true + + /randomfill@1.0.4: + resolution: {integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==} + dependencies: + randombytes: 2.1.0 + safe-buffer: 5.2.1 + dev: true + + /range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + dev: true + + /raw-body@1.1.7: + resolution: {integrity: sha512-WmJJU2e9Y6M5UzTOkHaM7xJGAPQD8PNzx3bAd2+uhZAim6wDk6dAZxPVYLF67XhbR4hmKGh33Lpmh4XWrCH5Mg==} + engines: {node: '>= 0.8.0'} + dependencies: + bytes: 1.0.0 + string_decoder: 0.10.31 + dev: true + + /raw-body@2.5.2: + resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} + engines: {node: '>= 0.8'} + dependencies: + bytes: 3.1.2 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + dev: true + + /read-only-stream@2.0.0: + resolution: {integrity: sha512-3ALe0bjBVZtkdWKIcThYpQCLbBMd/+Tbh2CDSrAIDO3UsZ4Xs+tnyjv2MjCOMMgBG+AsUOeuP1cgtY1INISc8w==} + dependencies: + readable-stream: 2.3.8 + dev: true + + /readable-stream@1.1.14: + resolution: {integrity: sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==} + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 0.0.1 + string_decoder: 0.10.31 + dev: true + + /readable-stream@2.3.8: + resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + dev: true + + /readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + dev: true + + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + + /rechoir@0.7.1: + resolution: {integrity: sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==} + engines: {node: '>= 0.10'} + dependencies: + resolve: 1.22.8 + dev: true + + /require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + dev: true + + /requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + dev: true + + /requizzle@0.2.4: + resolution: {integrity: sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==} + dependencies: + lodash: 4.17.21 + dev: true + + /resolve-dir@1.0.1: + resolution: {integrity: sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==} + engines: {node: '>=0.10.0'} + dependencies: + expand-tilde: 2.0.2 + global-modules: 1.0.0 + dev: true + + /resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + dev: true + + /resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + dev: true + + /resolve-pkg@2.0.0: + resolution: {integrity: sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ==} + engines: {node: '>=8'} + dependencies: + resolve-from: 5.0.0 + dev: true + + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + dependencies: + is-core-module: 2.13.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true + + /rfdc@1.3.0: + resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} + dev: true + + /rimraf@2.7.1: + resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} + hasBin: true + dependencies: + glob: 7.2.3 + dev: true + + /rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + hasBin: true + dependencies: + glob: 7.2.3 + dev: true + + /ripemd160@2.0.2: + resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} + dependencies: + hash-base: 3.1.0 + inherits: 2.0.4 + dev: true + + /safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + dev: true + + /safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + dev: true + + /safe-json-parse@1.0.1: + resolution: {integrity: sha512-o0JmTu17WGUaUOHa1l0FPGXKBfijbxK6qoHzlkihsDXxzBHvJcA7zgviKR92Xs841rX9pK16unfphLq0/KqX7A==} + dev: true + + /safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true + + /serialize-javascript@6.0.0: + resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + dependencies: + randombytes: 2.1.0 + dev: true + + /set-function-length@1.1.1: + resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + + /setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + dev: true + + /sha.js@2.4.11: + resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==} + hasBin: true + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: true + + /shasum-object@1.0.0: + resolution: {integrity: sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==} + dependencies: + fast-safe-stringify: 2.1.1 + dev: true + + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + + /shell-quote@1.8.1: + resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} + dev: true + + /side-channel@1.0.4: + resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + object-inspect: 1.13.1 + dev: true + + /simple-concat@1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + dev: true + + /smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + dev: true + + /socket.io-adapter@2.5.2: + resolution: {integrity: sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==} + dependencies: + ws: 8.11.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + /socket.io-parser@4.2.4: + resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} + engines: {node: '>=10.0.0'} + dependencies: + '@socket.io/component-emitter': 3.1.0 + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + + /socket.io@4.7.2: + resolution: {integrity: sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==} + engines: {node: '>=10.2.0'} + dependencies: + accepts: 1.3.8 + base64id: 2.0.0 + cors: 2.8.5 + debug: 4.3.4(supports-color@8.1.1) + engine.io: 6.5.4 + socket.io-adapter: 2.5.2 + socket.io-parser: 4.2.4 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + /socks-proxy-agent@8.0.2: + resolution: {integrity: sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.0 + debug: 4.3.4(supports-color@8.1.1) + socks: 2.7.1 + transitivePeerDependencies: + - supports-color + dev: true + + /socks@2.7.1: + resolution: {integrity: sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==} + engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} + dependencies: + ip: 2.0.0 + smart-buffer: 4.2.0 + dev: true + + /source-map@0.5.7: + resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==} + engines: {node: '>=0.10.0'} + dev: true + + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + + /sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true + + /sprintf-js@1.1.3: + resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + dev: true + + /statuses@1.5.0: + resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} + engines: {node: '>= 0.6'} + dev: true + + /statuses@2.0.1: + resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} + engines: {node: '>= 0.8'} + dev: true + + /stream-browserify@3.0.0: + resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} + dependencies: + inherits: 2.0.4 + readable-stream: 3.6.2 + dev: true + + /stream-combiner2@1.1.1: + resolution: {integrity: sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==} + dependencies: + duplexer2: 0.1.4 + readable-stream: 2.3.8 + dev: true + + /stream-http@3.2.0: + resolution: {integrity: sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==} + dependencies: + builtin-status-codes: 3.0.0 + inherits: 2.0.4 + readable-stream: 3.6.2 + xtend: 4.0.2 + dev: true + + /stream-splicer@2.0.1: + resolution: {integrity: sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==} + dependencies: + inherits: 2.0.4 + readable-stream: 2.3.8 + dev: true + + /streamroller@3.1.5: + resolution: {integrity: sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==} + engines: {node: '>=8.0'} + dependencies: + date-format: 4.0.14 + debug: 4.3.4(supports-color@8.1.1) + fs-extra: 8.1.0 + transitivePeerDependencies: + - supports-color + dev: true + + /streamx@2.15.5: + resolution: {integrity: sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==} + dependencies: + fast-fifo: 1.3.2 + queue-tick: 1.0.1 + dev: true + + /string-template@0.2.1: + resolution: {integrity: sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==} + dev: true + + /string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + dev: true + + /string_decoder@0.10.31: + resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} + dev: true + + /string_decoder@1.1.1: + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} + dependencies: + safe-buffer: 5.1.2 + dev: true + + /string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + dependencies: + safe-buffer: 5.2.1 + dev: true + + /strip-ansi@3.0.1: + resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} + engines: {node: '>=0.10.0'} + dependencies: + ansi-regex: 2.1.1 + dev: true + + /strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + dependencies: + ansi-regex: 5.0.1 + dev: true + + /strip-json-comments@1.0.4: + resolution: {integrity: sha512-AOPG8EBc5wAikaG1/7uFCNFJwnKOuQwFTpYBdTW6OvWHeZBQBrAA/amefHGrEiOnCPcLFZK6FUPtWVKpQVIRgg==} + engines: {node: '>=0.8.0'} + hasBin: true + dev: true + + /strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + dev: true + + /subarg@1.0.0: + resolution: {integrity: sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==} + dependencies: + minimist: 1.2.8 + dev: true + + /supports-color@2.0.0: + resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} + engines: {node: '>=0.8.0'} + dev: true + + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + + /supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + dev: true + + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + dependencies: + has-flag: 4.0.0 + + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true + + /syntax-error@1.4.0: + resolution: {integrity: sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==} + dependencies: + acorn-node: 1.8.2 + dev: true + + /taffydb@2.6.2: + resolution: {integrity: sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==} + dev: true + + /tar-fs@3.0.4: + resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} + dependencies: + mkdirp-classic: 0.5.3 + pump: 3.0.0 + tar-stream: 3.1.6 + dev: true + + /tar-stream@3.1.6: + resolution: {integrity: sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==} + dependencies: + b4a: 1.6.4 + fast-fifo: 1.3.2 + streamx: 2.15.5 + dev: true + + /text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + dev: true + + /through2@2.0.5: + resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==} + dependencies: + readable-stream: 2.3.8 + xtend: 4.0.2 + dev: true + + /through2@4.0.2: + resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} + dependencies: + readable-stream: 3.6.2 + dev: true + + /through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + dev: true + + /time-grunt@2.0.0: + resolution: {integrity: sha512-iQD2AeDYCAJrsPC/eUsfYZD9UT7TuBOmUIgFV5zeTQgRk6yLJKoc3aYR0gusJ0m+bG13B6qrDZ0SwPLe0/htHw==} + engines: {node: '>=0.10.0'} + deprecated: Deprecated because Grunt is practically unmaintained. Move on to something better. This package will continue to work with Grunt v1, but it will not receive any updates. + dependencies: + chalk: 1.1.3 + date-time: 1.1.0 + figures: 1.7.0 + hooker: 0.2.3 + number-is-nan: 1.0.1 + pretty-ms: 2.1.0 + text-table: 0.2.0 + dev: true + + /time-zone@0.1.0: + resolution: {integrity: sha512-S5CjtVIkeBTnlsaZP3gjsTb78ClBe74sEcgEoBwAVUKnTRDAGqUtLLIZHMsIyqOWjt9DGQpLMMoD8ZKIfP2ddQ==} + engines: {node: '>=0.10.0'} + dev: true + + /timers-browserify@1.4.2: + resolution: {integrity: sha512-PIxwAupJZiYU4JmVZYwXp9FKsHMXb5h0ZEFyuXTAn8WLHOlcij+FEcbrvDsom1o5dr1YggEtFbECvGCW2sT53Q==} + engines: {node: '>=0.6.0'} + dependencies: + process: 0.11.10 + dev: true + + /tiny-lr@1.1.1: + resolution: {integrity: sha512-44yhA3tsaRoMOjQQ+5v5mVdqef+kH6Qze9jTpqtVufgYjYt08zyZAwNwwVBj3i1rJMnR52IxOW0LK0vBzgAkuA==} + dependencies: + body: 5.1.0 + debug: 3.2.7 + faye-websocket: 0.10.0 + livereload-js: 2.4.0 + object-assign: 4.1.1 + qs: 6.11.2 + transitivePeerDependencies: + - supports-color + dev: true + + /tmp@0.2.1: + resolution: {integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==} + engines: {node: '>=8.17.0'} + dependencies: + rimraf: 3.0.2 + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true + + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + + /toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + dev: true + + /tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: true + + /ts-node@10.9.2(@types/node@20.9.2)(typescript@5.2.2): + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 20.9.2 + acorn: 8.11.2 + acorn-walk: 8.3.1 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.2.2 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: true + + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + + /tty-browserify@0.0.1: + resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==} + dev: true + + /type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + dev: true + + /type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} + dependencies: + media-typer: 0.3.0 + mime-types: 2.1.35 + dev: true + + /typedarray@0.0.6: + resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} + dev: true + + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /ua-parser-js@0.7.37: + resolution: {integrity: sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==} + dev: true + + /uc.micro@1.0.6: + resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==} + dev: true + + /uglify-js@3.17.4: + resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} + engines: {node: '>=0.8.0'} + hasBin: true + dev: true + + /umd@3.0.3: + resolution: {integrity: sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==} + hasBin: true + dev: true + + /unbzip2-stream@1.4.3: + resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==} + dependencies: + buffer: 5.7.1 + through: 2.3.8 + dev: true + + /unc-path-regex@0.1.2: + resolution: {integrity: sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==} + engines: {node: '>=0.10.0'} + dev: true + + /undeclared-identifiers@1.1.3: + resolution: {integrity: sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==} + hasBin: true + dependencies: + acorn-node: 1.8.2 + dash-ast: 1.0.0 + get-assigned-identifiers: 1.2.0 + simple-concat: 1.0.1 + xtend: 4.0.2 + dev: true + + /underscore.string@3.3.6: + resolution: {integrity: sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==} + dependencies: + sprintf-js: 1.1.3 + util-deprecate: 1.0.2 + dev: true + + /underscore@1.13.6: + resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==} + dev: true + + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + /universalify@0.1.2: + resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} + engines: {node: '>= 4.0.0'} + dev: true + + /unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + dev: true + + /uri-path@1.0.0: + resolution: {integrity: sha512-8pMuAn4KacYdGMkFaoQARicp4HSw24/DHOVKWqVRJ8LhhAwPPFpdGvdL9184JVmUwe7vz7Z9n6IqI6t5n2ELdg==} + engines: {node: '>= 0.10'} + dev: true + + /url@0.11.3: + resolution: {integrity: sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==} + dependencies: + punycode: 1.4.1 + qs: 6.11.2 + dev: true + + /urlpattern-polyfill@9.0.0: + resolution: {integrity: sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==} + dev: true + + /util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + dev: true + + /util@0.10.4: + resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==} + dependencies: + inherits: 2.0.3 + dev: true + + /util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + dependencies: + inherits: 2.0.4 + is-arguments: 1.1.1 + is-generator-function: 1.0.10 + is-typed-array: 1.1.12 + which-typed-array: 1.1.13 + dev: true + + /utils-merge@1.0.1: + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + engines: {node: '>= 0.4.0'} + dev: true + + /v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + dev: true + + /v8flags@3.2.0: + resolution: {integrity: sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==} + engines: {node: '>= 0.10'} + dependencies: + homedir-polyfill: 1.0.3 + dev: true + + /vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + /vm-browserify@1.1.2: + resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==} + dev: true + + /void-elements@2.0.1: + resolution: {integrity: sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==} + engines: {node: '>=0.10.0'} + dev: true + + /watchify@4.0.0: + resolution: {integrity: sha512-2Z04dxwoOeNxa11qzWumBTgSAohTC0+ScuY7XMenPnH+W2lhTcpEOJP4g2EIG/SWeLadPk47x++Yh+8BqPM/lA==} + engines: {node: '>= 8.10.0'} + hasBin: true + dependencies: + anymatch: 3.1.3 + browserify: 17.0.0 + chokidar: 3.5.3 + defined: 1.0.1 + outpipe: 1.1.1 + through2: 4.0.2 + xtend: 4.0.2 + dev: true + + /webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: true + + /websocket-driver@0.7.4: + resolution: {integrity: sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==} + engines: {node: '>=0.8.0'} + dependencies: + http-parser-js: 0.5.8 + safe-buffer: 5.2.1 + websocket-extensions: 0.1.4 + dev: true + + /websocket-extensions@0.1.4: + resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} + engines: {node: '>=0.8.0'} + dev: true + + /webworkify-webpack@2.1.5: + resolution: {integrity: sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==} + dev: false + + /webworkify@1.5.0: + resolution: {integrity: sha512-AMcUeyXAhbACL8S2hqqdqOLqvJ8ylmIbNwUIqQujRSouf4+eUFaXbG6F1Rbu+srlJMmxQWsiU7mOJi0nMBfM1g==} + dev: false + + /whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: true + + /which-typed-array@1.1.13: + resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + + /which@1.3.1: + resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /workerpool@6.2.1: + resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} + dev: true + + /wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + dev: true + + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true + + /ws@8.11.0: + resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + /ws@8.14.2: + resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + /xmlcreate@2.0.4: + resolution: {integrity: sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==} + dev: true + + /xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + dev: true + + /y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + dev: true + + /yargs-parser@20.2.4: + resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + engines: {node: '>=10'} + dev: true + + /yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + dev: true + + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true + + /yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + dev: true + + /yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + dependencies: + cliui: 7.0.4 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + dev: true + + /yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + dependencies: + cliui: 8.0.1 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + dev: true + + /yauzl@2.10.0: + resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==} + dependencies: + buffer-crc32: 0.2.13 + fd-slicer: 1.1.0 + dev: true + + /yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + dev: true + + /yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + dev: true diff --git a/src/core/Action.js b/src/core/Action.js index a23314771..d8a2b18df 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -33,7 +33,7 @@ class Action extends EventEmitter2 { /** * @callback sendGoalResultCallback - * @param {TResult} result - The result from the action. + * @param {TResult} result - The result from the action. */ /** * @callback sendGoalFeedbackCallback @@ -104,24 +104,28 @@ class Action extends EventEmitter2 { } /** - * @callback advertiseCallback + * @callback advertiseActionCallback * @param {TGoal} goal - The action goal. - * @param {Object} response - An empty dictionary. Take care not to overwrite this. Instead, only modify the values within. - * It should return true if the action has finished successfully, - * i.e., without any fatal errors. + * @param {string} id - The ID of the action goal to execute. + */ + /** + * @callback advertiseCancelCallback + * @param {string} id - The ID of the action goal to cancel. */ /** * Advertise the action. This turns the Action object from a client * into a server. The callback will be called with every goal sent to this action. * - * @param {advertiseCallback} callback - This works similarly to the callback for a C++ action. + * @param {advertiseActionCallback} actionCallback - This works similarly to the callback for a C++ action. + * @param {advertiseCancelCallback} cancelCallback - A callback function to execute when the action is canceled. */ - advertise(callback) { - if (this.isAdvertised || typeof callback !== 'function') { + advertise(actionCallback, cancelCallback) { + if (this.isAdvertised || typeof actionCallback !== 'function') { return; } - this._actionCallback = callback; + this._actionCallback = actionCallback; + this._cancelCallback = cancelCallback; this.ros.on(this.name, this._executeAction.bind(this)); this.ros.callOnConnection({ op: 'advertise_action', @@ -159,6 +163,16 @@ class Action extends EventEmitter2 { id = rosbridgeRequest.id; } + // If a cancellation callback exists, call it when a cancellation event is emitted. + if (typeof id === 'string') { + this.ros.on(id, (message) => { + if (message.op === 'cancel_action_goal' && typeof this._cancelCallback === 'function') { + this._cancelCallback(id); + } + }); + } + + // Call the goal execution function provided. // @ts-expect-error -- possibly null this._actionCallback(rosbridgeRequest.args, id); } From b8343d8477d94c13d64f0d8c7f138ac62c5fecf2 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 13 Dec 2023 17:23:43 -0500 Subject: [PATCH 60/66] Add cancel callback to action server example --- examples/ros2_action_server.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/ros2_action_server.html b/examples/ros2_action_server.html index aa99738f6..e74625405 100644 --- a/examples/ros2_action_server.html +++ b/examples/ros2_action_server.html @@ -25,7 +25,7 @@ actionType : 'action_tutorials_interfaces/Fibonacci' }); - fibonacciServer.advertise(function(goal, id) { + var actionCallback = function(goal, id) { console.log('Received action goal on ' + fibonacciServer.name + ', order: ' + goal.order); console.log('ID: ' + id); fibonacciSequence = []; @@ -40,7 +40,7 @@ } // publish feedback - for (var i = 1; i < goal.order; i++ ) { + for (var i = 1; i < goal.order; i++) { fibonacciSequence.push( fibonacciSequence[i] + fibonacciSequence[i-1] ); console.log('Sending feedback: ' + fibonacciSequence); fibonacciServer.sendFeedback(id, { partial_sequence : fibonacciSequence }); @@ -49,7 +49,12 @@ // send result console.log('Sending result: ' + fibonacciSequence); fibonacciServer.setSucceeded(id, { sequence: fibonacciSequence }); - }); + }; + var cancelCallback = function(id) { + console.log('Canceled action with goal ID ' + id); + }; + + fibonacciServer.advertise(actionCallback, cancelCallback); From 80072724686cbac6d22d4f6f203d8cd054709483 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 14 Dec 2023 09:30:05 -0700 Subject: [PATCH 61/66] remove extraneous templated tsconfig settings --- tsconfig.json | 92 --------------------------------------------------- 1 file changed, 92 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index e5939c36c..8a4e559e1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,109 +1,17 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ "module": "commonjs" /* Specify what module code is generated. */, "rootDir": "./src" /* Specify the root folder within your source files. */, - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ - // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ - // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */, "checkJs": true /* Enable error reporting in type-checked JavaScript files. */, - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "./tsbuild" /* Specify an output folder for all emitted files. */, - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ "declarationDir": "./build" /* Specify the output directory for generated declaration files. */, - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - - /* Type Checking */ "strict": true /* Enable all strict type-checking options. */, "noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */, - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "include": ["src"] From 53bc461521f60cd42fde0a9379cdeb6195eb9bfd Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 14 Dec 2023 11:44:21 -0500 Subject: [PATCH 62/66] Remove lockfile --- pnpm-lock.yaml | 4309 ------------------------------------------------ 1 file changed, 4309 deletions(-) delete mode 100644 pnpm-lock.yaml diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 99c7e0071..000000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,4309 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -dependencies: - '@xmldom/xmldom': - specifier: ^0.8.0 - version: 0.8.10 - cbor-js: - specifier: ^0.1.0 - version: 0.1.0 - eventemitter2: - specifier: ^6.4.0 - version: 6.4.9 - object-assign: - specifier: ^4.0.0 - version: 4.1.1 - pngparse: - specifier: ^2.0.0 - version: 2.0.1 - socket.io: - specifier: ^4.0.0 - version: 4.7.2 - webworkify: - specifier: ^1.5.0 - version: 1.5.0 - webworkify-webpack: - specifier: ^2.1.5 - version: 2.1.5 - ws: - specifier: ^8.0.0 - version: 8.14.2 - -devDependencies: - '@types/mocha': - specifier: ^10.0.6 - version: 10.0.6 - chai: - specifier: '*' - version: 4.3.10 - grunt: - specifier: ^1.0.0 - version: 1.6.1 - grunt-browserify: - specifier: ^6.0.0 - version: 6.0.0 - grunt-cli: - specifier: ^1.2.0 - version: 1.4.3 - grunt-contrib-clean: - specifier: ^2.0.0 - version: 2.0.1(grunt@1.6.1) - grunt-contrib-jshint: - specifier: ^3.0.0 - version: 3.2.0 - grunt-contrib-uglify: - specifier: ^5.0.0 - version: 5.2.2 - grunt-contrib-watch: - specifier: ^1.0.0 - version: 1.1.0 - grunt-jsdoc: - specifier: ^2.1.0 - version: 2.4.1 - grunt-karma: - specifier: ^4.0.0 - version: 4.0.2(grunt@1.6.1)(karma@6.4.2) - grunt-mocha-test: - specifier: ^0.13.0 - version: 0.13.3(mocha@10.2.0) - grunt-shell: - specifier: ^4.0.0 - version: 4.0.0(grunt@1.6.1) - karma: - specifier: ^6.3.0 - version: 6.4.2 - karma-chai: - specifier: ^0.1.0 - version: 0.1.0(chai@4.3.10)(karma@6.4.2) - karma-chrome-launcher: - specifier: ^3.1.1 - version: 3.2.0 - karma-firefox-launcher: - specifier: ^2.1.0 - version: 2.1.2 - karma-mocha: - specifier: ^2.0.0 - version: 2.0.1 - load-grunt-tasks: - specifier: ^5.1.0 - version: 5.1.0(grunt@1.6.1) - mocha: - specifier: ^10.0.0 - version: 10.2.0 - puppeteer: - specifier: ^21.0.1 - version: 21.5.2(typescript@5.2.2) - time-grunt: - specifier: ^2.0.0 - version: 2.0.0 - ts-node: - specifier: ^10.9.1 - version: 10.9.2(@types/node@20.9.2)(typescript@5.2.2) - typescript: - specifier: ^5.2.2 - version: 5.2.2 - -packages: - - /@babel/code-frame@7.22.13: - resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/highlight': 7.22.20 - chalk: 2.4.2 - dev: true - - /@babel/helper-string-parser@7.22.5: - resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-validator-identifier@7.22.20: - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/highlight@7.22.20: - resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - chalk: 2.4.2 - js-tokens: 4.0.0 - dev: true - - /@babel/parser@7.23.3: - resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==} - engines: {node: '>=6.0.0'} - hasBin: true - dependencies: - '@babel/types': 7.23.3 - dev: true - - /@babel/types@7.23.3: - resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-string-parser': 7.22.5 - '@babel/helper-validator-identifier': 7.22.20 - to-fast-properties: 2.0.0 - dev: true - - /@colors/colors@1.5.0: - resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} - engines: {node: '>=0.1.90'} - dev: true - - /@cspotcode/source-map-support@0.8.1: - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: true - - /@jridgewell/resolve-uri@3.1.1: - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} - dev: true - - /@jridgewell/sourcemap-codec@1.4.15: - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true - - /@jridgewell/trace-mapping@0.3.9: - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - - /@puppeteer/browsers@1.8.0: - resolution: {integrity: sha512-TkRHIV6k2D8OlUe8RtG+5jgOF/H98Myx0M6AOafC8DdNVOFiBSFa5cpRDtpm8LXOa9sVwe0+e6Q3FC56X/DZfg==} - engines: {node: '>=16.3.0'} - hasBin: true - dependencies: - debug: 4.3.4(supports-color@8.1.1) - extract-zip: 2.0.1 - progress: 2.0.3 - proxy-agent: 6.3.1 - tar-fs: 3.0.4 - unbzip2-stream: 1.4.3 - yargs: 17.7.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@socket.io/component-emitter@3.1.0: - resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==} - - /@tootallnate/quickjs-emscripten@0.23.0: - resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} - dev: true - - /@tsconfig/node10@1.0.9: - resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} - dev: true - - /@tsconfig/node12@1.0.11: - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: true - - /@tsconfig/node14@1.0.3: - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: true - - /@tsconfig/node16@1.0.4: - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: true - - /@types/cookie@0.4.1: - resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==} - - /@types/cors@2.8.16: - resolution: {integrity: sha512-Trx5or1Nyg1Fq138PCuWqoApzvoSLWzZ25ORBiHMbbUT42g578lH1GT4TwYDbiUOLFuDsCkfLneT2105fsFWGg==} - dependencies: - '@types/node': 20.9.2 - - /@types/linkify-it@3.0.5: - resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==} - dev: true - - /@types/markdown-it@12.2.3: - resolution: {integrity: sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==} - dependencies: - '@types/linkify-it': 3.0.5 - '@types/mdurl': 1.0.5 - dev: true - - /@types/mdurl@1.0.5: - resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==} - dev: true - - /@types/minimatch@3.0.5: - resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} - dev: true - - /@types/mocha@10.0.6: - resolution: {integrity: sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==} - dev: true - - /@types/node@20.9.2: - resolution: {integrity: sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==} - dependencies: - undici-types: 5.26.5 - - /@types/yauzl@2.10.3: - resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} - requiresBuild: true - dependencies: - '@types/node': 20.9.2 - dev: true - optional: true - - /@xmldom/xmldom@0.8.10: - resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==} - engines: {node: '>=10.0.0'} - dev: false - - /JSONStream@0.10.0: - resolution: {integrity: sha512-8XbSFFd43EG+1thjLNFIzCBlwXti0yKa7L+ak/f0T/pkC+31b7G41DXL/JzYpAoYWZ2eCPiu4IIqzijM8N0a/w==} - hasBin: true - dependencies: - jsonparse: 0.0.5 - through: 2.3.8 - dev: true - - /JSONStream@1.3.5: - resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} - hasBin: true - dependencies: - jsonparse: 1.3.1 - through: 2.3.8 - dev: true - - /abbrev@1.1.1: - resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} - dev: true - - /accepts@1.3.8: - resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} - engines: {node: '>= 0.6'} - dependencies: - mime-types: 2.1.35 - negotiator: 0.6.3 - - /acorn-node@1.8.2: - resolution: {integrity: sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==} - dependencies: - acorn: 7.4.1 - acorn-walk: 7.2.0 - xtend: 4.0.2 - dev: true - - /acorn-walk@7.2.0: - resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn-walk@8.3.1: - resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn@7.4.1: - resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /acorn@8.11.2: - resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /agent-base@7.1.0: - resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} - engines: {node: '>= 14'} - dependencies: - debug: 4.3.4(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - dev: true - - /ansi-colors@4.1.1: - resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} - engines: {node: '>=6'} - dev: true - - /ansi-regex@2.1.1: - resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} - engines: {node: '>=0.10.0'} - dev: true - - /ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - dev: true - - /ansi-styles@2.2.1: - resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} - engines: {node: '>=0.10.0'} - dev: true - - /ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - dependencies: - color-convert: 1.9.3 - dev: true - - /ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - dependencies: - color-convert: 2.0.1 - dev: true - - /anymatch@3.1.3: - resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} - engines: {node: '>= 8'} - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - - /arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: true - - /argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - dependencies: - sprintf-js: 1.0.3 - dev: true - - /argparse@2.0.1: - resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: true - - /array-differ@3.0.0: - resolution: {integrity: sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==} - engines: {node: '>=8'} - dev: true - - /array-each@1.0.1: - resolution: {integrity: sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==} - engines: {node: '>=0.10.0'} - dev: true - - /array-slice@1.1.0: - resolution: {integrity: sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==} - engines: {node: '>=0.10.0'} - dev: true - - /array-union@2.1.0: - resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} - engines: {node: '>=8'} - dev: true - - /arrify@2.0.1: - resolution: {integrity: sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==} - engines: {node: '>=8'} - dev: true - - /asn1.js@5.4.1: - resolution: {integrity: sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==} - dependencies: - bn.js: 4.12.0 - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - safer-buffer: 2.1.2 - dev: true - - /assert@1.5.1: - resolution: {integrity: sha512-zzw1uCAgLbsKwBfFc8CX78DDg+xZeBksSO3vwVIDDN5i94eOrPsSSyiVhmsSABFDM/OcpE2aagCat9dnWQLG1A==} - dependencies: - object.assign: 4.1.4 - util: 0.10.4 - dev: true - - /assertion-error@1.1.0: - resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} - dev: true - - /ast-types@0.13.4: - resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} - engines: {node: '>=4'} - dependencies: - tslib: 2.6.2 - dev: true - - /async@2.6.4: - resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==} - dependencies: - lodash: 4.17.21 - dev: true - - /async@3.2.5: - resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} - dev: true - - /available-typed-arrays@1.0.5: - resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} - engines: {node: '>= 0.4'} - dev: true - - /b4a@1.6.4: - resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} - dev: true - - /balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: true - - /base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: true - - /base64id@2.0.0: - resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==} - engines: {node: ^4.5.0 || >= 5.9} - - /basic-ftp@5.0.3: - resolution: {integrity: sha512-QHX8HLlncOLpy54mh+k/sWIFd0ThmRqwe9ZjELybGZK+tZ8rUb9VO0saKJUROTbE+KhzDUT7xziGpGrW8Kmd+g==} - engines: {node: '>=10.0.0'} - dev: true - - /binary-extensions@2.2.0: - resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} - engines: {node: '>=8'} - dev: true - - /bluebird@3.7.2: - resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} - dev: true - - /bn.js@4.12.0: - resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} - dev: true - - /bn.js@5.2.1: - resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} - dev: true - - /body-parser@1.20.2: - resolution: {integrity: sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} - dependencies: - bytes: 3.1.2 - content-type: 1.0.5 - debug: 2.6.9 - depd: 2.0.0 - destroy: 1.2.0 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - on-finished: 2.4.1 - qs: 6.11.0 - raw-body: 2.5.2 - type-is: 1.6.18 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /body@5.1.0: - resolution: {integrity: sha512-chUsBxGRtuElD6fmw1gHLpvnKdVLK302peeFa9ZqAEk8TyzZ3fygLyUEDDPTJvL9+Bor0dIwn6ePOsRM2y0zQQ==} - dependencies: - continuable-cache: 0.3.1 - error: 7.2.1 - raw-body: 1.1.7 - safe-json-parse: 1.0.1 - dev: true - - /brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - dev: true - - /brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - dependencies: - balanced-match: 1.0.2 - dev: true - - /braces@3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} - engines: {node: '>=8'} - dependencies: - fill-range: 7.0.1 - dev: true - - /brorand@1.1.0: - resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} - dev: true - - /browser-pack@6.1.0: - resolution: {integrity: sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==} - hasBin: true - dependencies: - JSONStream: 1.3.5 - combine-source-map: 0.8.0 - defined: 1.0.1 - safe-buffer: 5.2.1 - through2: 2.0.5 - umd: 3.0.3 - dev: true - - /browser-resolve@2.0.0: - resolution: {integrity: sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==} - dependencies: - resolve: 1.22.8 - dev: true - - /browser-stdout@1.3.1: - resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} - dev: true - - /browserify-aes@1.2.0: - resolution: {integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==} - dependencies: - buffer-xor: 1.0.3 - cipher-base: 1.0.4 - create-hash: 1.2.0 - evp_bytestokey: 1.0.3 - inherits: 2.0.4 - safe-buffer: 5.2.1 - dev: true - - /browserify-cache-api@3.0.2: - resolution: {integrity: sha512-14YNbboSgSHY5QNZSLwlGYB7OuBuXS7gMyR2gfBjdS4JYcWB9BqyKhraQG/VW2W5ZhjkC/C8LZ38sP3bmbmeNA==} - dependencies: - async: 2.6.4 - through2: 2.0.5 - xtend: 4.0.2 - dev: true - - /browserify-cipher@1.0.1: - resolution: {integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==} - dependencies: - browserify-aes: 1.2.0 - browserify-des: 1.0.2 - evp_bytestokey: 1.0.3 - dev: true - - /browserify-des@1.0.2: - resolution: {integrity: sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==} - dependencies: - cipher-base: 1.0.4 - des.js: 1.1.0 - inherits: 2.0.4 - safe-buffer: 5.2.1 - dev: true - - /browserify-incremental@3.1.1(browserify@17.0.0): - resolution: {integrity: sha512-PrFwOzLEdy27VRXK2uGjmjLq1aROBG7QoQq3eKanmm6Q8vuzT0ZNFCORHh3yJgNQQooXA9tOizGv4vCOmhrvRQ==} - hasBin: true - peerDependencies: - browserify: '*' - dependencies: - JSONStream: 0.10.0 - browserify: 17.0.0 - browserify-cache-api: 3.0.2 - through2: 2.0.5 - xtend: 4.0.2 - dev: true - - /browserify-rsa@4.1.0: - resolution: {integrity: sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==} - dependencies: - bn.js: 5.2.1 - randombytes: 2.1.0 - dev: true - - /browserify-sign@4.2.2: - resolution: {integrity: sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==} - engines: {node: '>= 4'} - dependencies: - bn.js: 5.2.1 - browserify-rsa: 4.1.0 - create-hash: 1.2.0 - create-hmac: 1.1.7 - elliptic: 6.5.4 - inherits: 2.0.4 - parse-asn1: 5.1.6 - readable-stream: 3.6.2 - safe-buffer: 5.2.1 - dev: true - - /browserify-zlib@0.2.0: - resolution: {integrity: sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==} - dependencies: - pako: 1.0.11 - dev: true - - /browserify@17.0.0: - resolution: {integrity: sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w==} - engines: {node: '>= 0.8'} - hasBin: true - dependencies: - JSONStream: 1.3.5 - assert: 1.5.1 - browser-pack: 6.1.0 - browser-resolve: 2.0.0 - browserify-zlib: 0.2.0 - buffer: 5.2.1 - cached-path-relative: 1.1.0 - concat-stream: 1.6.2 - console-browserify: 1.2.0 - constants-browserify: 1.0.0 - crypto-browserify: 3.12.0 - defined: 1.0.1 - deps-sort: 2.0.1 - domain-browser: 1.2.0 - duplexer2: 0.1.4 - events: 3.3.0 - glob: 7.2.3 - has: 1.0.4 - htmlescape: 1.1.1 - https-browserify: 1.0.0 - inherits: 2.0.4 - insert-module-globals: 7.2.1 - labeled-stream-splicer: 2.0.2 - mkdirp-classic: 0.5.3 - module-deps: 6.2.3 - os-browserify: 0.3.0 - parents: 1.0.1 - path-browserify: 1.0.1 - process: 0.11.10 - punycode: 1.4.1 - querystring-es3: 0.2.1 - read-only-stream: 2.0.0 - readable-stream: 2.3.8 - resolve: 1.22.8 - shasum-object: 1.0.0 - shell-quote: 1.8.1 - stream-browserify: 3.0.0 - stream-http: 3.2.0 - string_decoder: 1.3.0 - subarg: 1.0.0 - syntax-error: 1.4.0 - through2: 2.0.5 - timers-browserify: 1.4.2 - tty-browserify: 0.0.1 - url: 0.11.3 - util: 0.12.5 - vm-browserify: 1.1.2 - xtend: 4.0.2 - dev: true - - /buffer-crc32@0.2.13: - resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} - dev: true - - /buffer-from@1.1.2: - resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - dev: true - - /buffer-xor@1.0.3: - resolution: {integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==} - dev: true - - /buffer@5.2.1: - resolution: {integrity: sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: true - - /buffer@5.7.1: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: true - - /builtin-status-codes@3.0.0: - resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==} - dev: true - - /bytes@1.0.0: - resolution: {integrity: sha512-/x68VkHLeTl3/Ll8IvxdwzhrT+IyKc52e/oyHhA2RwqPqswSnjVbSddfPRwAsJtbilMAPSRWwAlpxdYsSWOTKQ==} - dev: true - - /bytes@3.1.2: - resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} - engines: {node: '>= 0.8'} - dev: true - - /cached-path-relative@1.1.0: - resolution: {integrity: sha512-WF0LihfemtesFcJgO7xfOoOcnWzY/QHR4qeDqV44jPU3HTI54+LnfXK3SA27AVVGCdZFgjjFFaqUA9Jx7dMJZA==} - dev: true - - /call-bind@1.0.5: - resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} - dependencies: - function-bind: 1.1.2 - get-intrinsic: 1.2.2 - set-function-length: 1.1.1 - dev: true - - /callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - dev: true - - /camelcase@6.3.0: - resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} - engines: {node: '>=10'} - dev: true - - /catharsis@0.9.0: - resolution: {integrity: sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==} - engines: {node: '>= 10'} - dependencies: - lodash: 4.17.21 - dev: true - - /cbor-js@0.1.0: - resolution: {integrity: sha512-7sQ/TvDZPl7csT1Sif9G0+MA0I0JOVah8+wWlJVQdVEgIbCzlN/ab3x+uvMNsc34TUvO6osQTAmB2ls80JX6tw==} - dev: false - - /chai@4.3.10: - resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} - engines: {node: '>=4'} - dependencies: - assertion-error: 1.1.0 - check-error: 1.0.3 - deep-eql: 4.1.3 - get-func-name: 2.0.2 - loupe: 2.3.7 - pathval: 1.1.1 - type-detect: 4.0.8 - dev: true - - /chalk@1.1.3: - resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==} - engines: {node: '>=0.10.0'} - dependencies: - ansi-styles: 2.2.1 - escape-string-regexp: 1.0.5 - has-ansi: 2.0.0 - strip-ansi: 3.0.1 - supports-color: 2.0.0 - dev: true - - /chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - dev: true - - /chalk@3.0.0: - resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} - engines: {node: '>=8'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: true - - /chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: true - - /check-error@1.0.3: - resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} - dependencies: - get-func-name: 2.0.2 - dev: true - - /chokidar@3.5.3: - resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} - engines: {node: '>= 8.10.0'} - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /chromium-bidi@0.4.33(devtools-protocol@0.0.1203626): - resolution: {integrity: sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==} - peerDependencies: - devtools-protocol: '*' - dependencies: - devtools-protocol: 0.0.1203626 - mitt: 3.0.1 - urlpattern-polyfill: 9.0.0 - dev: true - - /cipher-base@1.0.4: - resolution: {integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==} - dependencies: - inherits: 2.0.4 - safe-buffer: 5.2.1 - dev: true - - /cli@1.0.1: - resolution: {integrity: sha512-41U72MB56TfUMGndAKK8vJ78eooOD4Z5NOL4xEfjc0c23s+6EYKXlXsmACBVclLP1yOfWCgEganVzddVrSNoTg==} - engines: {node: '>=0.2.5'} - dependencies: - exit: 0.1.2 - glob: 7.2.3 - dev: true - - /cliui@7.0.4: - resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - dependencies: - color-name: 1.1.3 - dev: true - - /color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - dependencies: - color-name: 1.1.4 - dev: true - - /color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: true - - /color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: true - - /colors@1.1.2: - resolution: {integrity: sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==} - engines: {node: '>=0.1.90'} - dev: true - - /combine-source-map@0.8.0: - resolution: {integrity: sha512-UlxQ9Vw0b/Bt/KYwCFqdEwsQ1eL8d1gibiFb7lxQJFdvTgc2hIZi6ugsg+kyhzhPV+QEpUiEIwInIAIrgoEkrg==} - dependencies: - convert-source-map: 1.1.3 - inline-source-map: 0.6.2 - lodash.memoize: 3.0.4 - source-map: 0.5.7 - dev: true - - /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: true - - /concat-stream@1.6.2: - resolution: {integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==} - engines: {'0': node >= 0.8} - dependencies: - buffer-from: 1.1.2 - inherits: 2.0.4 - readable-stream: 2.3.8 - typedarray: 0.0.6 - dev: true - - /connect@3.7.0: - resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} - engines: {node: '>= 0.10.0'} - dependencies: - debug: 2.6.9 - finalhandler: 1.1.2 - parseurl: 1.3.3 - utils-merge: 1.0.1 - transitivePeerDependencies: - - supports-color - dev: true - - /console-browserify@1.1.0: - resolution: {integrity: sha512-duS7VP5pvfsNLDvL1O4VOEbw37AI3A4ZUQYemvDlnpGrNu9tprR7BYWpDYwC0Xia0Zxz5ZupdiIrUp0GH1aXfg==} - dependencies: - date-now: 0.1.4 - dev: true - - /console-browserify@1.2.0: - resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==} - dev: true - - /constants-browserify@1.0.0: - resolution: {integrity: sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==} - dev: true - - /content-type@1.0.5: - resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} - engines: {node: '>= 0.6'} - dev: true - - /continuable-cache@0.3.1: - resolution: {integrity: sha512-TF30kpKhTH8AGCG3dut0rdd/19B7Z+qCnrMoBLpyQu/2drZdNrrpcjPEoJeSVsQM+8KmWG5O56oPDjSSUsuTyA==} - dev: true - - /convert-source-map@1.1.3: - resolution: {integrity: sha512-Y8L5rp6jo+g9VEPgvqNfEopjTR4OTYct8lXlS8iVQdmnjDvbdbzYe9rjtFCB9egC86JoNCU61WRY+ScjkZpnIg==} - dev: true - - /cookie@0.4.2: - resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} - engines: {node: '>= 0.6'} - - /core-util-is@1.0.3: - resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - dev: true - - /cors@2.8.5: - resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} - engines: {node: '>= 0.10'} - dependencies: - object-assign: 4.1.1 - vary: 1.1.2 - - /cosmiconfig@8.3.6(typescript@5.2.2): - resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} - engines: {node: '>=14'} - peerDependencies: - typescript: '>=4.9.5' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - import-fresh: 3.3.0 - js-yaml: 4.1.0 - parse-json: 5.2.0 - path-type: 4.0.0 - typescript: 5.2.2 - dev: true - - /create-ecdh@4.0.4: - resolution: {integrity: sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==} - dependencies: - bn.js: 4.12.0 - elliptic: 6.5.4 - dev: true - - /create-hash@1.2.0: - resolution: {integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==} - dependencies: - cipher-base: 1.0.4 - inherits: 2.0.4 - md5.js: 1.3.5 - ripemd160: 2.0.2 - sha.js: 2.4.11 - dev: true - - /create-hmac@1.1.7: - resolution: {integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==} - dependencies: - cipher-base: 1.0.4 - create-hash: 1.2.0 - inherits: 2.0.4 - ripemd160: 2.0.2 - safe-buffer: 5.2.1 - sha.js: 2.4.11 - dev: true - - /create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: true - - /cross-fetch@4.0.0: - resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==} - dependencies: - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - dev: true - - /cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - dev: true - - /crypto-browserify@3.12.0: - resolution: {integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==} - dependencies: - browserify-cipher: 1.0.1 - browserify-sign: 4.2.2 - create-ecdh: 4.0.4 - create-hash: 1.2.0 - create-hmac: 1.1.7 - diffie-hellman: 5.0.3 - inherits: 2.0.4 - pbkdf2: 3.1.2 - public-encrypt: 4.0.3 - randombytes: 2.1.0 - randomfill: 1.0.4 - dev: true - - /custom-event@1.0.1: - resolution: {integrity: sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==} - dev: true - - /dash-ast@1.0.0: - resolution: {integrity: sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==} - dev: true - - /data-uri-to-buffer@6.0.1: - resolution: {integrity: sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==} - engines: {node: '>= 14'} - dev: true - - /date-format@4.0.14: - resolution: {integrity: sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==} - engines: {node: '>=4.0'} - dev: true - - /date-now@0.1.4: - resolution: {integrity: sha512-AsElvov3LoNB7tf5k37H2jYSB+ZZPMT5sG2QjJCcdlV5chIv6htBUBUui2IKRjgtKAKtCBN7Zbwa+MtwLjSeNw==} - dev: true - - /date-time@1.1.0: - resolution: {integrity: sha512-RrxZQ06cdKe7YQ5oqIxs3GMc7W3vXscy7Ds+aZIqmxA59QnVtTiCseA4jbzVUub9xCbo9GuYVZo0OrZLYXnnmw==} - engines: {node: '>=0.10.0'} - dependencies: - time-zone: 0.1.0 - dev: true - - /dateformat@4.6.3: - resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} - dev: true - - /debug@2.6.9: - resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.0.0 - dev: true - - /debug@3.2.7: - resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.3 - dev: true - - /debug@4.3.4(supports-color@8.1.1): - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - supports-color: 8.1.1 - - /decamelize@4.0.0: - resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} - engines: {node: '>=10'} - dev: true - - /deep-eql@4.1.3: - resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} - engines: {node: '>=6'} - dependencies: - type-detect: 4.0.8 - dev: true - - /define-data-property@1.1.1: - resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - dev: true - - /define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - has-property-descriptors: 1.0.1 - object-keys: 1.1.1 - dev: true - - /defined@1.0.1: - resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==} - dev: true - - /degenerator@5.0.1: - resolution: {integrity: sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==} - engines: {node: '>= 14'} - dependencies: - ast-types: 0.13.4 - escodegen: 2.1.0 - esprima: 4.0.1 - dev: true - - /depd@2.0.0: - resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} - engines: {node: '>= 0.8'} - dev: true - - /deps-sort@2.0.1: - resolution: {integrity: sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==} - hasBin: true - dependencies: - JSONStream: 1.3.5 - shasum-object: 1.0.0 - subarg: 1.0.0 - through2: 2.0.5 - dev: true - - /des.js@1.1.0: - resolution: {integrity: sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==} - dependencies: - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - dev: true - - /destroy@1.2.0: - resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} - dev: true - - /detect-file@1.0.0: - resolution: {integrity: sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==} - engines: {node: '>=0.10.0'} - dev: true - - /detective@5.2.1: - resolution: {integrity: sha512-v9XE1zRnz1wRtgurGu0Bs8uHKFSTdteYZNbIPFVhUZ39L/S79ppMpdmVOZAnoz1jfEFodc48n6MX483Xo3t1yw==} - engines: {node: '>=0.8.0'} - hasBin: true - dependencies: - acorn-node: 1.8.2 - defined: 1.0.1 - minimist: 1.2.8 - dev: true - - /devtools-protocol@0.0.1203626: - resolution: {integrity: sha512-nEzHZteIUZfGCZtTiS1fRpC8UZmsfD1SiyPvaUNvS13dvKf666OAm8YTi0+Ca3n1nLEyu49Cy4+dPWpaHFJk9g==} - dev: true - - /di@0.0.1: - resolution: {integrity: sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==} - dev: true - - /diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dev: true - - /diff@5.0.0: - resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} - engines: {node: '>=0.3.1'} - dev: true - - /diffie-hellman@5.0.3: - resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} - dependencies: - bn.js: 4.12.0 - miller-rabin: 4.0.1 - randombytes: 2.1.0 - dev: true - - /dom-serialize@2.2.1: - resolution: {integrity: sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ==} - dependencies: - custom-event: 1.0.1 - ent: 2.2.0 - extend: 3.0.2 - void-elements: 2.0.1 - dev: true - - /dom-serializer@0.2.2: - resolution: {integrity: sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==} - dependencies: - domelementtype: 2.3.0 - entities: 2.2.0 - dev: true - - /domain-browser@1.2.0: - resolution: {integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==} - engines: {node: '>=0.4', npm: '>=1.2'} - dev: true - - /domelementtype@1.3.1: - resolution: {integrity: sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==} - dev: true - - /domelementtype@2.3.0: - resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} - dev: true - - /domhandler@2.3.0: - resolution: {integrity: sha512-q9bUwjfp7Eif8jWxxxPSykdRZAb6GkguBGSgvvCrhI9wB71W2K/Kvv4E61CF/mcCfnVJDeDWx/Vb/uAqbDj6UQ==} - dependencies: - domelementtype: 1.3.1 - dev: true - - /domutils@1.5.1: - resolution: {integrity: sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==} - dependencies: - dom-serializer: 0.2.2 - domelementtype: 1.3.1 - dev: true - - /duplexer2@0.1.4: - resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==} - dependencies: - readable-stream: 2.3.8 - dev: true - - /duplexer@0.1.2: - resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} - dev: true - - /ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - dev: true - - /elliptic@6.5.4: - resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} - dependencies: - bn.js: 4.12.0 - brorand: 1.1.0 - hash.js: 1.1.7 - hmac-drbg: 1.0.1 - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - minimalistic-crypto-utils: 1.0.1 - dev: true - - /emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true - - /encodeurl@1.0.2: - resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} - engines: {node: '>= 0.8'} - dev: true - - /end-of-stream@1.4.4: - resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} - dependencies: - once: 1.4.0 - dev: true - - /engine.io-parser@5.2.1: - resolution: {integrity: sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==} - engines: {node: '>=10.0.0'} - - /engine.io@6.5.4: - resolution: {integrity: sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==} - engines: {node: '>=10.2.0'} - dependencies: - '@types/cookie': 0.4.1 - '@types/cors': 2.8.16 - '@types/node': 20.9.2 - accepts: 1.3.8 - base64id: 2.0.0 - cookie: 0.4.2 - cors: 2.8.5 - debug: 4.3.4(supports-color@8.1.1) - engine.io-parser: 5.2.1 - ws: 8.11.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /ent@2.2.0: - resolution: {integrity: sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==} - dev: true - - /entities@1.0.0: - resolution: {integrity: sha512-LbLqfXgJMmy81t+7c14mnulFHJ170cM6E+0vMXR9k/ZiZwgX8i5pNgjTCX3SO4VeUsFLV+8InixoretwU+MjBQ==} - dev: true - - /entities@2.1.0: - resolution: {integrity: sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==} - dev: true - - /entities@2.2.0: - resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} - dev: true - - /error-ex@1.3.2: - resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} - dependencies: - is-arrayish: 0.2.1 - dev: true - - /error@7.2.1: - resolution: {integrity: sha512-fo9HBvWnx3NGUKMvMwB/CBCMMrfEJgbDTVDEkPygA3Bdd3lM1OyCd+rbQ8BwnpF6GdVeOLDNmyL4N5Bg80ZvdA==} - dependencies: - string-template: 0.2.1 - dev: true - - /escalade@3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - dev: true - - /escape-html@1.0.3: - resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - dev: true - - /escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - dev: true - - /escape-string-regexp@2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - dev: true - - /escape-string-regexp@4.0.0: - resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} - engines: {node: '>=10'} - dev: true - - /escodegen@2.1.0: - resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} - engines: {node: '>=6.0'} - hasBin: true - dependencies: - esprima: 4.0.1 - estraverse: 5.3.0 - esutils: 2.0.3 - optionalDependencies: - source-map: 0.6.1 - dev: true - - /esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - - /estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - dev: true - - /esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: true - - /eventemitter2@0.4.14: - resolution: {integrity: sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==} - dev: true - - /eventemitter2@6.4.9: - resolution: {integrity: sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==} - dev: false - - /eventemitter3@4.0.7: - resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} - dev: true - - /events@3.3.0: - resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} - engines: {node: '>=0.8.x'} - dev: true - - /evp_bytestokey@1.0.3: - resolution: {integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==} - dependencies: - md5.js: 1.3.5 - safe-buffer: 5.2.1 - dev: true - - /exit@0.1.2: - resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} - engines: {node: '>= 0.8.0'} - dev: true - - /expand-tilde@2.0.2: - resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} - engines: {node: '>=0.10.0'} - dependencies: - homedir-polyfill: 1.0.3 - dev: true - - /extend@3.0.2: - resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} - dev: true - - /extract-zip@2.0.1: - resolution: {integrity: sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==} - engines: {node: '>= 10.17.0'} - hasBin: true - dependencies: - debug: 4.3.4(supports-color@8.1.1) - get-stream: 5.2.0 - yauzl: 2.10.0 - optionalDependencies: - '@types/yauzl': 2.10.3 - transitivePeerDependencies: - - supports-color - dev: true - - /fast-fifo@1.3.2: - resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==} - dev: true - - /fast-safe-stringify@2.1.1: - resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} - dev: true - - /faye-websocket@0.10.0: - resolution: {integrity: sha512-Xhj93RXbMSq8urNCUq4p9l0P6hnySJ/7YNRhYNug0bLOuii7pKO7xQFb5mx9xZXWCar88pLPb805PvUkwrLZpQ==} - engines: {node: '>=0.4.0'} - dependencies: - websocket-driver: 0.7.4 - dev: true - - /fd-slicer@1.1.0: - resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} - dependencies: - pend: 1.2.0 - dev: true - - /figures@1.7.0: - resolution: {integrity: sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==} - engines: {node: '>=0.10.0'} - dependencies: - escape-string-regexp: 1.0.5 - object-assign: 4.1.1 - dev: true - - /figures@3.2.0: - resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} - engines: {node: '>=8'} - dependencies: - escape-string-regexp: 1.0.5 - dev: true - - /fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} - dependencies: - to-regex-range: 5.0.1 - dev: true - - /finalhandler@1.1.2: - resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} - engines: {node: '>= 0.8'} - dependencies: - debug: 2.6.9 - encodeurl: 1.0.2 - escape-html: 1.0.3 - on-finished: 2.3.0 - parseurl: 1.3.3 - statuses: 1.5.0 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /find-up@3.0.0: - resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} - engines: {node: '>=6'} - dependencies: - locate-path: 3.0.0 - dev: true - - /find-up@5.0.0: - resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} - engines: {node: '>=10'} - dependencies: - locate-path: 6.0.0 - path-exists: 4.0.0 - dev: true - - /findup-sync@4.0.0: - resolution: {integrity: sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==} - engines: {node: '>= 8'} - dependencies: - detect-file: 1.0.0 - is-glob: 4.0.3 - micromatch: 4.0.5 - resolve-dir: 1.0.1 - dev: true - - /findup-sync@5.0.0: - resolution: {integrity: sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==} - engines: {node: '>= 10.13.0'} - dependencies: - detect-file: 1.0.0 - is-glob: 4.0.3 - micromatch: 4.0.5 - resolve-dir: 1.0.1 - dev: true - - /fined@1.2.0: - resolution: {integrity: sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==} - engines: {node: '>= 0.10'} - dependencies: - expand-tilde: 2.0.2 - is-plain-object: 2.0.4 - object.defaults: 1.1.0 - object.pick: 1.3.0 - parse-filepath: 1.0.2 - dev: true - - /flagged-respawn@1.0.1: - resolution: {integrity: sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==} - engines: {node: '>= 0.10'} - dev: true - - /flat@5.0.2: - resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} - hasBin: true - dev: true - - /flatted@3.2.9: - resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} - dev: true - - /follow-redirects@1.15.3: - resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: true - - /for-each@0.3.3: - resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - dependencies: - is-callable: 1.2.7 - dev: true - - /for-in@1.0.2: - resolution: {integrity: sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==} - engines: {node: '>=0.10.0'} - dev: true - - /for-own@1.0.0: - resolution: {integrity: sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==} - engines: {node: '>=0.10.0'} - dependencies: - for-in: 1.0.2 - dev: true - - /fs-extra@8.1.0: - resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} - engines: {node: '>=6 <7 || >=8'} - dependencies: - graceful-fs: 4.2.11 - jsonfile: 4.0.0 - universalify: 0.1.2 - dev: true - - /fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: true - - /fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - dev: true - - /gaze@1.1.3: - resolution: {integrity: sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==} - engines: {node: '>= 4.0.0'} - dependencies: - globule: 1.3.4 - dev: true - - /get-assigned-identifiers@1.2.0: - resolution: {integrity: sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==} - dev: true - - /get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - dev: true - - /get-func-name@2.0.2: - resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} - dev: true - - /get-intrinsic@1.2.2: - resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} - dependencies: - function-bind: 1.1.2 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - dev: true - - /get-stream@5.2.0: - resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} - engines: {node: '>=8'} - dependencies: - pump: 3.0.0 - dev: true - - /get-uri@6.0.2: - resolution: {integrity: sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==} - engines: {node: '>= 14'} - dependencies: - basic-ftp: 5.0.3 - data-uri-to-buffer: 6.0.1 - debug: 4.3.4(supports-color@8.1.1) - fs-extra: 8.1.0 - transitivePeerDependencies: - - supports-color - dev: true - - /getobject@1.0.2: - resolution: {integrity: sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==} - engines: {node: '>=10'} - dev: true - - /glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - dependencies: - is-glob: 4.0.3 - dev: true - - /glob@7.1.7: - resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.0.8 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - - /glob@7.2.0: - resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - - /glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - - /global-modules@1.0.0: - resolution: {integrity: sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==} - engines: {node: '>=0.10.0'} - dependencies: - global-prefix: 1.0.2 - is-windows: 1.0.2 - resolve-dir: 1.0.1 - dev: true - - /global-prefix@1.0.2: - resolution: {integrity: sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==} - engines: {node: '>=0.10.0'} - dependencies: - expand-tilde: 2.0.2 - homedir-polyfill: 1.0.3 - ini: 1.3.8 - is-windows: 1.0.2 - which: 1.3.1 - dev: true - - /globule@1.3.4: - resolution: {integrity: sha512-OPTIfhMBh7JbBYDpa5b+Q5ptmMWKwcNcFSR/0c6t8V4f3ZAVBEsKNY37QdVqmLRYSMhOUGYrY0QhSoEpzGr/Eg==} - engines: {node: '>= 0.10'} - dependencies: - glob: 7.1.7 - lodash: 4.17.21 - minimatch: 3.0.8 - dev: true - - /gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - dependencies: - get-intrinsic: 1.2.2 - dev: true - - /graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true - - /grunt-browserify@6.0.0: - resolution: {integrity: sha512-m130pTVFEsxQZ+dJQd287TrnUI5VvEKJ+MmPjMF/7bVJBTBRWhJlYVFgBOYLZMUykfk1RWXfQ2sAQu5NuXumvg==} - engines: {node: '>= 8.10.x'} - dependencies: - async: 2.6.4 - browserify: 17.0.0 - browserify-incremental: 3.1.1(browserify@17.0.0) - glob: 7.2.3 - lodash: 4.17.21 - resolve: 1.22.8 - watchify: 4.0.0 - dev: true - - /grunt-cli@1.4.3: - resolution: {integrity: sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==} - engines: {node: '>=10'} - hasBin: true - dependencies: - grunt-known-options: 2.0.0 - interpret: 1.1.0 - liftup: 3.0.1 - nopt: 4.0.3 - v8flags: 3.2.0 - dev: true - - /grunt-contrib-clean@2.0.1(grunt@1.6.1): - resolution: {integrity: sha512-uRvnXfhiZt8akb/ZRDHJpQQtkkVkqc/opWO4Po/9ehC2hPxgptB9S6JHDC/Nxswo4CJSM0iFPT/Iym3cEMWzKA==} - engines: {node: '>=12'} - peerDependencies: - grunt: '>=0.4.5' - dependencies: - async: 3.2.5 - grunt: 1.6.1 - rimraf: 2.7.1 - dev: true - - /grunt-contrib-jshint@3.2.0: - resolution: {integrity: sha512-pcXWCSZWfoMSvcV4BwH21TUtLtcX0Ms8IGuOPIcLeXK3fud9KclY7iqMKY94jFx8TxZzh028YYtpR+io8DiEaQ==} - engines: {node: '>=10'} - dependencies: - chalk: 4.1.2 - hooker: 0.2.3 - jshint: 2.13.6 - dev: true - - /grunt-contrib-uglify@5.2.2: - resolution: {integrity: sha512-ITxiWxrjjP+RZu/aJ5GLvdele+sxlznh+6fK9Qckio5ma8f7Iv8woZjRkGfafvpuygxNefOJNc+hfjjBayRn2Q==} - engines: {node: '>=12'} - dependencies: - chalk: 4.1.2 - maxmin: 3.0.0 - uglify-js: 3.17.4 - uri-path: 1.0.0 - dev: true - - /grunt-contrib-watch@1.1.0: - resolution: {integrity: sha512-yGweN+0DW5yM+oo58fRu/XIRrPcn3r4tQx+nL7eMRwjpvk+rQY6R8o94BPK0i2UhTg9FN21hS+m8vR8v9vXfeg==} - engines: {node: '>=0.10.0'} - dependencies: - async: 2.6.4 - gaze: 1.1.3 - lodash: 4.17.21 - tiny-lr: 1.1.1 - transitivePeerDependencies: - - supports-color - dev: true - - /grunt-jsdoc@2.4.1: - resolution: {integrity: sha512-S0zxU0wDewRu7z+vijEItOWe/UttxWVmvz0qz2ZVcAYR2GpXjsiski2CAVN0b18t2qeVLdmxZkJaEWCOsKzcAw==} - engines: {node: '>= 8.12.0'} - hasBin: true - dependencies: - cross-spawn: 7.0.3 - jsdoc: 3.6.11 - dev: true - - /grunt-karma@4.0.2(grunt@1.6.1)(karma@6.4.2): - resolution: {integrity: sha512-4+iBBkXZjHHMDAG5kpHCdDUqlSEBJ6sqouLMRf0p+QB8wGMs300DtaCQphHqd7pM3gpXoGVT3yRRsT7KOZpJMA==} - peerDependencies: - grunt: '>=0.4.x' - karma: ^4.0.0 || ^5.0.0 || ^6.0.0 - dependencies: - grunt: 1.6.1 - karma: 6.4.2 - lodash: 4.17.21 - dev: true - - /grunt-known-options@2.0.0: - resolution: {integrity: sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==} - engines: {node: '>=0.10.0'} - dev: true - - /grunt-legacy-log-utils@2.1.0: - resolution: {integrity: sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==} - engines: {node: '>=10'} - dependencies: - chalk: 4.1.2 - lodash: 4.17.21 - dev: true - - /grunt-legacy-log@3.0.0: - resolution: {integrity: sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==} - engines: {node: '>= 0.10.0'} - dependencies: - colors: 1.1.2 - grunt-legacy-log-utils: 2.1.0 - hooker: 0.2.3 - lodash: 4.17.21 - dev: true - - /grunt-legacy-util@2.0.1: - resolution: {integrity: sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==} - engines: {node: '>=10'} - dependencies: - async: 3.2.5 - exit: 0.1.2 - getobject: 1.0.2 - hooker: 0.2.3 - lodash: 4.17.21 - underscore.string: 3.3.6 - which: 2.0.2 - dev: true - - /grunt-mocha-test@0.13.3(mocha@10.2.0): - resolution: {integrity: sha512-zQGEsi3d+ViPPi7/4jcj78afKKAKiAA5n61pknQYi25Ugik+aNOuRmiOkmb8mN2CeG8YxT+YdT1H1Q7B/eNkoQ==} - engines: {node: '>= 0.10.4'} - peerDependencies: - mocha: '>=1.20.0' - dependencies: - hooker: 0.2.3 - mkdirp: 0.5.6 - mocha: 10.2.0 - dev: true - - /grunt-shell@4.0.0(grunt@1.6.1): - resolution: {integrity: sha512-dHFy8VZDfWGYLTeNvIHze4PKXGvIlDWuN0UE7hUZstTQeiEyv1VmW1MaDYQ3X5tE3bCi3bEia1gGKH8z/f1czQ==} - engines: {node: '>=12'} - peerDependencies: - grunt: '>=1' - dependencies: - chalk: 3.0.0 - grunt: 1.6.1 - npm-run-path: 2.0.2 - strip-ansi: 6.0.1 - dev: true - - /grunt@1.6.1: - resolution: {integrity: sha512-/ABUy3gYWu5iBmrUSRBP97JLpQUm0GgVveDCp6t3yRNIoltIYw7rEj3g5y1o2PGPR2vfTRGa7WC/LZHLTXnEzA==} - engines: {node: '>=16'} - hasBin: true - dependencies: - dateformat: 4.6.3 - eventemitter2: 0.4.14 - exit: 0.1.2 - findup-sync: 5.0.0 - glob: 7.1.7 - grunt-cli: 1.4.3 - grunt-known-options: 2.0.0 - grunt-legacy-log: 3.0.0 - grunt-legacy-util: 2.0.1 - iconv-lite: 0.6.3 - js-yaml: 3.14.1 - minimatch: 3.0.8 - nopt: 3.0.6 - dev: true - - /gzip-size@5.1.1: - resolution: {integrity: sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==} - engines: {node: '>=6'} - dependencies: - duplexer: 0.1.2 - pify: 4.0.1 - dev: true - - /has-ansi@2.0.0: - resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} - engines: {node: '>=0.10.0'} - dependencies: - ansi-regex: 2.1.1 - dev: true - - /has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - dev: true - - /has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - - /has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} - dependencies: - get-intrinsic: 1.2.2 - dev: true - - /has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - dev: true - - /has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - dev: true - - /has-tostringtag@1.0.0: - resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.0.3 - dev: true - - /has@1.0.4: - resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} - engines: {node: '>= 0.4.0'} - dev: true - - /hash-base@3.1.0: - resolution: {integrity: sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==} - engines: {node: '>=4'} - dependencies: - inherits: 2.0.4 - readable-stream: 3.6.2 - safe-buffer: 5.2.1 - dev: true - - /hash.js@1.1.7: - resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} - dependencies: - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - dev: true - - /hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} - engines: {node: '>= 0.4'} - dependencies: - function-bind: 1.1.2 - dev: true - - /he@1.2.0: - resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} - hasBin: true - dev: true - - /hmac-drbg@1.0.1: - resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} - dependencies: - hash.js: 1.1.7 - minimalistic-assert: 1.0.1 - minimalistic-crypto-utils: 1.0.1 - dev: true - - /homedir-polyfill@1.0.3: - resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} - engines: {node: '>=0.10.0'} - dependencies: - parse-passwd: 1.0.0 - dev: true - - /hooker@0.2.3: - resolution: {integrity: sha512-t+UerCsQviSymAInD01Pw+Dn/usmz1sRO+3Zk1+lx8eg+WKpD2ulcwWqHHL0+aseRBr+3+vIhiG1K1JTwaIcTA==} - dev: true - - /htmlescape@1.1.1: - resolution: {integrity: sha512-eVcrzgbR4tim7c7soKQKtxa/kQM4TzjnlU83rcZ9bHU6t31ehfV7SktN6McWgwPWg+JYMA/O3qpGxBvFq1z2Jg==} - engines: {node: '>=0.10'} - dev: true - - /htmlparser2@3.8.3: - resolution: {integrity: sha512-hBxEg3CYXe+rPIua8ETe7tmG3XDn9B0edOE/e9wH2nLczxzgdu0m0aNHY+5wFZiviLWLdANPJTssa92dMcXQ5Q==} - dependencies: - domelementtype: 1.3.1 - domhandler: 2.3.0 - domutils: 1.5.1 - entities: 1.0.0 - readable-stream: 1.1.14 - dev: true - - /http-errors@2.0.0: - resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} - engines: {node: '>= 0.8'} - dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.1 - toidentifier: 1.0.1 - dev: true - - /http-parser-js@0.5.8: - resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} - dev: true - - /http-proxy-agent@7.0.0: - resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - dev: true - - /http-proxy@1.18.1: - resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} - engines: {node: '>=8.0.0'} - dependencies: - eventemitter3: 4.0.7 - follow-redirects: 1.15.3 - requires-port: 1.0.0 - transitivePeerDependencies: - - debug - dev: true - - /https-browserify@1.0.0: - resolution: {integrity: sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==} - dev: true - - /https-proxy-agent@7.0.2: - resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - dev: true - - /iconv-lite@0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: true - - /iconv-lite@0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: true - - /ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: true - - /import-fresh@3.3.0: - resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} - engines: {node: '>=6'} - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - dev: true - - /inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - dev: true - - /inherits@2.0.3: - resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} - dev: true - - /inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true - - /ini@1.3.8: - resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} - dev: true - - /inline-source-map@0.6.2: - resolution: {integrity: sha512-0mVWSSbNDvedDWIN4wxLsdPM4a7cIPcpyMxj3QZ406QRwQ6ePGB1YIHxVPjqpcUGbWQ5C+nHTwGNWAGvt7ggVA==} - dependencies: - source-map: 0.5.7 - dev: true - - /insert-module-globals@7.2.1: - resolution: {integrity: sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==} - hasBin: true - dependencies: - JSONStream: 1.3.5 - acorn-node: 1.8.2 - combine-source-map: 0.8.0 - concat-stream: 1.6.2 - is-buffer: 1.1.6 - path-is-absolute: 1.0.1 - process: 0.11.10 - through2: 2.0.5 - undeclared-identifiers: 1.1.3 - xtend: 4.0.2 - dev: true - - /interpret@1.1.0: - resolution: {integrity: sha512-CLM8SNMDu7C5psFCn6Wg/tgpj/bKAg7hc2gWqcuR9OD5Ft9PhBpIu8PLicPeis+xDd6YX2ncI8MCA64I9tftIA==} - dev: true - - /ip@1.1.8: - resolution: {integrity: sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==} - dev: true - - /ip@2.0.0: - resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==} - dev: true - - /is-absolute@1.0.0: - resolution: {integrity: sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==} - engines: {node: '>=0.10.0'} - dependencies: - is-relative: 1.0.0 - is-windows: 1.0.2 - dev: true - - /is-arguments@1.1.1: - resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true - - /is-arrayish@0.2.1: - resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - dev: true - - /is-binary-path@2.1.0: - resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} - engines: {node: '>=8'} - dependencies: - binary-extensions: 2.2.0 - dev: true - - /is-buffer@1.1.6: - resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} - dev: true - - /is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - dev: true - - /is-core-module@2.13.1: - resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} - dependencies: - hasown: 2.0.0 - dev: true - - /is-docker@2.2.1: - resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} - engines: {node: '>=8'} - hasBin: true - dev: true - - /is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: true - - /is-finite@1.1.0: - resolution: {integrity: sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==} - engines: {node: '>=0.10.0'} - dev: true - - /is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - dev: true - - /is-generator-function@1.0.10: - resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: true - - /is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - dev: true - - /is-plain-obj@2.1.0: - resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} - engines: {node: '>=8'} - dev: true - - /is-plain-object@2.0.4: - resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} - engines: {node: '>=0.10.0'} - dependencies: - isobject: 3.0.1 - dev: true - - /is-relative@1.0.0: - resolution: {integrity: sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==} - engines: {node: '>=0.10.0'} - dependencies: - is-unc-path: 1.0.0 - dev: true - - /is-typed-array@1.1.12: - resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} - engines: {node: '>= 0.4'} - dependencies: - which-typed-array: 1.1.13 - dev: true - - /is-unc-path@1.0.0: - resolution: {integrity: sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==} - engines: {node: '>=0.10.0'} - dependencies: - unc-path-regex: 0.1.2 - dev: true - - /is-unicode-supported@0.1.0: - resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} - engines: {node: '>=10'} - dev: true - - /is-windows@1.0.2: - resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} - engines: {node: '>=0.10.0'} - dev: true - - /is-wsl@2.2.0: - resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} - engines: {node: '>=8'} - dependencies: - is-docker: 2.2.1 - dev: true - - /isarray@0.0.1: - resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} - dev: true - - /isarray@1.0.0: - resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - dev: true - - /isbinaryfile@4.0.10: - resolution: {integrity: sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==} - engines: {node: '>= 8.0.0'} - dev: true - - /isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - dev: true - - /isobject@3.0.1: - resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} - engines: {node: '>=0.10.0'} - dev: true - - /js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: true - - /js-yaml@3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - dev: true - - /js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - dependencies: - argparse: 2.0.1 - dev: true - - /js2xmlparser@4.0.2: - resolution: {integrity: sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==} - dependencies: - xmlcreate: 2.0.4 - dev: true - - /jsdoc@3.6.11: - resolution: {integrity: sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==} - engines: {node: '>=12.0.0'} - hasBin: true - dependencies: - '@babel/parser': 7.23.3 - '@types/markdown-it': 12.2.3 - bluebird: 3.7.2 - catharsis: 0.9.0 - escape-string-regexp: 2.0.0 - js2xmlparser: 4.0.2 - klaw: 3.0.0 - markdown-it: 12.3.2 - markdown-it-anchor: 8.6.7(@types/markdown-it@12.2.3)(markdown-it@12.3.2) - marked: 4.3.0 - mkdirp: 1.0.4 - requizzle: 0.2.4 - strip-json-comments: 3.1.1 - taffydb: 2.6.2 - underscore: 1.13.6 - dev: true - - /jshint@2.13.6: - resolution: {integrity: sha512-IVdB4G0NTTeQZrBoM8C5JFVLjV2KtZ9APgybDA1MK73xb09qFs0jCXyQLnCOp1cSZZZbvhq/6mfXHUTaDkffuQ==} - hasBin: true - dependencies: - cli: 1.0.1 - console-browserify: 1.1.0 - exit: 0.1.2 - htmlparser2: 3.8.3 - lodash: 4.17.21 - minimatch: 3.0.8 - strip-json-comments: 1.0.4 - dev: true - - /json-parse-even-better-errors@2.3.1: - resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - dev: true - - /jsonfile@4.0.0: - resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} - optionalDependencies: - graceful-fs: 4.2.11 - dev: true - - /jsonparse@0.0.5: - resolution: {integrity: sha512-fw7Q/8gFR8iSekUi9I+HqWIap6mywuoe7hQIg3buTVjuZgALKj4HAmm0X6f+TaL4c9NJbvyFQdaI2ppr5p6dnQ==} - engines: {'0': node >= 0.2.0} - dev: true - - /jsonparse@1.3.1: - resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} - engines: {'0': node >= 0.2.0} - dev: true - - /karma-chai@0.1.0(chai@4.3.10)(karma@6.4.2): - resolution: {integrity: sha512-mqKCkHwzPMhgTYca10S90aCEX9+HjVjjrBFAsw36Zj7BlQNbokXXCAe6Ji04VUMsxcY5RLP7YphpfO06XOubdg==} - peerDependencies: - chai: '*' - karma: '>=0.10.9' - dependencies: - chai: 4.3.10 - karma: 6.4.2 - dev: true - - /karma-chrome-launcher@3.2.0: - resolution: {integrity: sha512-rE9RkUPI7I9mAxByQWkGJFXfFD6lE4gC5nPuZdobf/QdTEJI6EU4yIay/cfU/xV4ZxlM5JiTv7zWYgA64NpS5Q==} - dependencies: - which: 1.3.1 - dev: true - - /karma-firefox-launcher@2.1.2: - resolution: {integrity: sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==} - dependencies: - is-wsl: 2.2.0 - which: 2.0.2 - dev: true - - /karma-mocha@2.0.1: - resolution: {integrity: sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==} - dependencies: - minimist: 1.2.8 - dev: true - - /karma@6.4.2: - resolution: {integrity: sha512-C6SU/53LB31BEgRg+omznBEMY4SjHU3ricV6zBcAe1EeILKkeScr+fZXtaI5WyDbkVowJxxAI6h73NcFPmXolQ==} - engines: {node: '>= 10'} - hasBin: true - dependencies: - '@colors/colors': 1.5.0 - body-parser: 1.20.2 - braces: 3.0.2 - chokidar: 3.5.3 - connect: 3.7.0 - di: 0.0.1 - dom-serialize: 2.2.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - http-proxy: 1.18.1 - isbinaryfile: 4.0.10 - lodash: 4.17.21 - log4js: 6.9.1 - mime: 2.6.0 - minimatch: 3.1.2 - mkdirp: 0.5.6 - qjobs: 1.2.0 - range-parser: 1.2.1 - rimraf: 3.0.2 - socket.io: 4.7.2 - source-map: 0.6.1 - tmp: 0.2.1 - ua-parser-js: 0.7.37 - yargs: 16.2.0 - transitivePeerDependencies: - - bufferutil - - debug - - supports-color - - utf-8-validate - dev: true - - /kind-of@6.0.3: - resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} - engines: {node: '>=0.10.0'} - dev: true - - /klaw@3.0.0: - resolution: {integrity: sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==} - dependencies: - graceful-fs: 4.2.11 - dev: true - - /labeled-stream-splicer@2.0.2: - resolution: {integrity: sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==} - dependencies: - inherits: 2.0.4 - stream-splicer: 2.0.1 - dev: true - - /liftup@3.0.1: - resolution: {integrity: sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==} - engines: {node: '>=10'} - dependencies: - extend: 3.0.2 - findup-sync: 4.0.0 - fined: 1.2.0 - flagged-respawn: 1.0.1 - is-plain-object: 2.0.4 - object.map: 1.0.1 - rechoir: 0.7.1 - resolve: 1.22.8 - dev: true - - /lines-and-columns@1.2.4: - resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - dev: true - - /linkify-it@3.0.3: - resolution: {integrity: sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==} - dependencies: - uc.micro: 1.0.6 - dev: true - - /livereload-js@2.4.0: - resolution: {integrity: sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==} - dev: true - - /load-grunt-tasks@5.1.0(grunt@1.6.1): - resolution: {integrity: sha512-oNj0Jlka1TsfDe+9He0kcA1cRln+TMoTsEByW7ij6kyktNLxBKJtslCFEvFrLC2Dj0S19IWJh3fOCIjLby2Xrg==} - engines: {node: '>=8'} - peerDependencies: - grunt: '>=1' - dependencies: - arrify: 2.0.1 - grunt: 1.6.1 - multimatch: 4.0.0 - pkg-up: 3.1.0 - resolve-pkg: 2.0.0 - dev: true - - /locate-path@3.0.0: - resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} - engines: {node: '>=6'} - dependencies: - p-locate: 3.0.0 - path-exists: 3.0.0 - dev: true - - /locate-path@6.0.0: - resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} - engines: {node: '>=10'} - dependencies: - p-locate: 5.0.0 - dev: true - - /lodash.memoize@3.0.4: - resolution: {integrity: sha512-eDn9kqrAmVUC1wmZvlQ6Uhde44n+tXpqPrN8olQJbttgh0oKclk+SF54P47VEGE9CEiMeRwAP8BaM7UHvBkz2A==} - dev: true - - /lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true - - /log-symbols@4.1.0: - resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} - engines: {node: '>=10'} - dependencies: - chalk: 4.1.2 - is-unicode-supported: 0.1.0 - dev: true - - /log4js@6.9.1: - resolution: {integrity: sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==} - engines: {node: '>=8.0'} - dependencies: - date-format: 4.0.14 - debug: 4.3.4(supports-color@8.1.1) - flatted: 3.2.9 - rfdc: 1.3.0 - streamroller: 3.1.5 - transitivePeerDependencies: - - supports-color - dev: true - - /loupe@2.3.7: - resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} - dependencies: - get-func-name: 2.0.2 - dev: true - - /lru-cache@7.18.3: - resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} - engines: {node: '>=12'} - dev: true - - /make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: true - - /make-iterator@1.0.1: - resolution: {integrity: sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==} - engines: {node: '>=0.10.0'} - dependencies: - kind-of: 6.0.3 - dev: true - - /map-cache@0.2.2: - resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==} - engines: {node: '>=0.10.0'} - dev: true - - /markdown-it-anchor@8.6.7(@types/markdown-it@12.2.3)(markdown-it@12.3.2): - resolution: {integrity: sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==} - peerDependencies: - '@types/markdown-it': '*' - markdown-it: '*' - dependencies: - '@types/markdown-it': 12.2.3 - markdown-it: 12.3.2 - dev: true - - /markdown-it@12.3.2: - resolution: {integrity: sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==} - hasBin: true - dependencies: - argparse: 2.0.1 - entities: 2.1.0 - linkify-it: 3.0.3 - mdurl: 1.0.1 - uc.micro: 1.0.6 - dev: true - - /marked@4.3.0: - resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} - engines: {node: '>= 12'} - hasBin: true - dev: true - - /maxmin@3.0.0: - resolution: {integrity: sha512-wcahMInmGtg/7c6a75fr21Ch/Ks1Tb+Jtoan5Ft4bAI0ZvJqyOw8kkM7e7p8hDSzY805vmxwHT50KcjGwKyJ0g==} - engines: {node: '>=10'} - dependencies: - chalk: 4.1.2 - figures: 3.2.0 - gzip-size: 5.1.1 - pretty-bytes: 5.6.0 - dev: true - - /md5.js@1.3.5: - resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} - dependencies: - hash-base: 3.1.0 - inherits: 2.0.4 - safe-buffer: 5.2.1 - dev: true - - /mdurl@1.0.1: - resolution: {integrity: sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==} - dev: true - - /media-typer@0.3.0: - resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} - engines: {node: '>= 0.6'} - dev: true - - /micromatch@4.0.5: - resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} - engines: {node: '>=8.6'} - dependencies: - braces: 3.0.2 - picomatch: 2.3.1 - dev: true - - /miller-rabin@4.0.1: - resolution: {integrity: sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==} - hasBin: true - dependencies: - bn.js: 4.12.0 - brorand: 1.1.0 - dev: true - - /mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - /mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - - /mime@2.6.0: - resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} - engines: {node: '>=4.0.0'} - hasBin: true - dev: true - - /minimalistic-assert@1.0.1: - resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} - dev: true - - /minimalistic-crypto-utils@1.0.1: - resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} - dev: true - - /minimatch@3.0.8: - resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} - dependencies: - brace-expansion: 1.1.11 - dev: true - - /minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - dependencies: - brace-expansion: 1.1.11 - dev: true - - /minimatch@5.0.1: - resolution: {integrity: sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==} - engines: {node: '>=10'} - dependencies: - brace-expansion: 2.0.1 - dev: true - - /minimist@1.2.8: - resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: true - - /mitt@3.0.1: - resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} - dev: true - - /mkdirp-classic@0.5.3: - resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} - dev: true - - /mkdirp@0.5.6: - resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} - hasBin: true - dependencies: - minimist: 1.2.8 - dev: true - - /mkdirp@1.0.4: - resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} - engines: {node: '>=10'} - hasBin: true - dev: true - - /mocha@10.2.0: - resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} - engines: {node: '>= 14.0.0'} - hasBin: true - dependencies: - ansi-colors: 4.1.1 - browser-stdout: 1.3.1 - chokidar: 3.5.3 - debug: 4.3.4(supports-color@8.1.1) - diff: 5.0.0 - escape-string-regexp: 4.0.0 - find-up: 5.0.0 - glob: 7.2.0 - he: 1.2.0 - js-yaml: 4.1.0 - log-symbols: 4.1.0 - minimatch: 5.0.1 - ms: 2.1.3 - nanoid: 3.3.3 - serialize-javascript: 6.0.0 - strip-json-comments: 3.1.1 - supports-color: 8.1.1 - workerpool: 6.2.1 - yargs: 16.2.0 - yargs-parser: 20.2.4 - yargs-unparser: 2.0.0 - dev: true - - /module-deps@6.2.3: - resolution: {integrity: sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==} - engines: {node: '>= 0.8.0'} - hasBin: true - dependencies: - JSONStream: 1.3.5 - browser-resolve: 2.0.0 - cached-path-relative: 1.1.0 - concat-stream: 1.6.2 - defined: 1.0.1 - detective: 5.2.1 - duplexer2: 0.1.4 - inherits: 2.0.4 - parents: 1.0.1 - readable-stream: 2.3.8 - resolve: 1.22.8 - stream-combiner2: 1.1.1 - subarg: 1.0.0 - through2: 2.0.5 - xtend: 4.0.2 - dev: true - - /ms@2.0.0: - resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} - dev: true - - /ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - - /ms@2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true - - /multimatch@4.0.0: - resolution: {integrity: sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==} - engines: {node: '>=8'} - dependencies: - '@types/minimatch': 3.0.5 - array-differ: 3.0.0 - array-union: 2.1.0 - arrify: 2.0.1 - minimatch: 3.1.2 - dev: true - - /nanoid@3.3.3: - resolution: {integrity: sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - dev: true - - /negotiator@0.6.3: - resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} - engines: {node: '>= 0.6'} - - /netmask@2.0.2: - resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} - engines: {node: '>= 0.4.0'} - dev: true - - /node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - dependencies: - whatwg-url: 5.0.0 - dev: true - - /nopt@3.0.6: - resolution: {integrity: sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==} - hasBin: true - dependencies: - abbrev: 1.1.1 - dev: true - - /nopt@4.0.3: - resolution: {integrity: sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==} - hasBin: true - dependencies: - abbrev: 1.1.1 - osenv: 0.1.5 - dev: true - - /normalize-path@3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - dev: true - - /npm-run-path@2.0.2: - resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} - engines: {node: '>=4'} - dependencies: - path-key: 2.0.1 - dev: true - - /number-is-nan@1.0.1: - resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} - engines: {node: '>=0.10.0'} - dev: true - - /object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - - /object-inspect@1.13.1: - resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - dev: true - - /object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - dev: true - - /object.assign@4.1.4: - resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - has-symbols: 1.0.3 - object-keys: 1.1.1 - dev: true - - /object.defaults@1.1.0: - resolution: {integrity: sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==} - engines: {node: '>=0.10.0'} - dependencies: - array-each: 1.0.1 - array-slice: 1.1.0 - for-own: 1.0.0 - isobject: 3.0.1 - dev: true - - /object.map@1.0.1: - resolution: {integrity: sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==} - engines: {node: '>=0.10.0'} - dependencies: - for-own: 1.0.0 - make-iterator: 1.0.1 - dev: true - - /object.pick@1.3.0: - resolution: {integrity: sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==} - engines: {node: '>=0.10.0'} - dependencies: - isobject: 3.0.1 - dev: true - - /on-finished@2.3.0: - resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} - engines: {node: '>= 0.8'} - dependencies: - ee-first: 1.1.1 - dev: true - - /on-finished@2.4.1: - resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} - engines: {node: '>= 0.8'} - dependencies: - ee-first: 1.1.1 - dev: true - - /once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - dependencies: - wrappy: 1.0.2 - dev: true - - /os-browserify@0.3.0: - resolution: {integrity: sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==} - dev: true - - /os-homedir@1.0.2: - resolution: {integrity: sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==} - engines: {node: '>=0.10.0'} - dev: true - - /os-tmpdir@1.0.2: - resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} - engines: {node: '>=0.10.0'} - dev: true - - /osenv@0.1.5: - resolution: {integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==} - dependencies: - os-homedir: 1.0.2 - os-tmpdir: 1.0.2 - dev: true - - /outpipe@1.1.1: - resolution: {integrity: sha512-BnNY/RwnDrkmQdUa9U+OfN/Y7AWmKuUPCCd+hbRclZnnANvYpO72zp/a6Q4n829hPbdqEac31XCcsvlEvb+rtA==} - dependencies: - shell-quote: 1.8.1 - dev: true - - /p-limit@2.3.0: - resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} - engines: {node: '>=6'} - dependencies: - p-try: 2.2.0 - dev: true - - /p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} - dependencies: - yocto-queue: 0.1.0 - dev: true - - /p-locate@3.0.0: - resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} - engines: {node: '>=6'} - dependencies: - p-limit: 2.3.0 - dev: true - - /p-locate@5.0.0: - resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} - engines: {node: '>=10'} - dependencies: - p-limit: 3.1.0 - dev: true - - /p-try@2.2.0: - resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} - engines: {node: '>=6'} - dev: true - - /pac-proxy-agent@7.0.1: - resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==} - engines: {node: '>= 14'} - dependencies: - '@tootallnate/quickjs-emscripten': 0.23.0 - agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) - get-uri: 6.0.2 - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 - pac-resolver: 7.0.0 - socks-proxy-agent: 8.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /pac-resolver@7.0.0: - resolution: {integrity: sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==} - engines: {node: '>= 14'} - dependencies: - degenerator: 5.0.1 - ip: 1.1.8 - netmask: 2.0.2 - dev: true - - /pako@1.0.11: - resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} - dev: true - - /parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} - dependencies: - callsites: 3.1.0 - dev: true - - /parents@1.0.1: - resolution: {integrity: sha512-mXKF3xkoUt5td2DoxpLmtOmZvko9VfFpwRwkKDHSNvgmpLAeBo18YDhcPbBzJq+QLCHMbGOfzia2cX4U+0v9Mg==} - dependencies: - path-platform: 0.11.15 - dev: true - - /parse-asn1@5.1.6: - resolution: {integrity: sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==} - dependencies: - asn1.js: 5.4.1 - browserify-aes: 1.2.0 - evp_bytestokey: 1.0.3 - pbkdf2: 3.1.2 - safe-buffer: 5.2.1 - dev: true - - /parse-filepath@1.0.2: - resolution: {integrity: sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==} - engines: {node: '>=0.8'} - dependencies: - is-absolute: 1.0.0 - map-cache: 0.2.2 - path-root: 0.1.1 - dev: true - - /parse-json@5.2.0: - resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} - engines: {node: '>=8'} - dependencies: - '@babel/code-frame': 7.22.13 - error-ex: 1.3.2 - json-parse-even-better-errors: 2.3.1 - lines-and-columns: 1.2.4 - dev: true - - /parse-ms@1.0.1: - resolution: {integrity: sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==} - engines: {node: '>=0.10.0'} - dev: true - - /parse-passwd@1.0.0: - resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} - engines: {node: '>=0.10.0'} - dev: true - - /parseurl@1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - dev: true - - /path-browserify@1.0.1: - resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} - dev: true - - /path-exists@3.0.0: - resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} - engines: {node: '>=4'} - dev: true - - /path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - dev: true - - /path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - dev: true - - /path-key@2.0.1: - resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} - engines: {node: '>=4'} - dev: true - - /path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - dev: true - - /path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - dev: true - - /path-platform@0.11.15: - resolution: {integrity: sha512-Y30dB6rab1A/nfEKsZxmr01nUotHX0c/ZiIAsCTatEe1CmS5Pm5He7fZ195bPT7RdquoaL8lLxFCMQi/bS7IJg==} - engines: {node: '>= 0.8.0'} - dev: true - - /path-root-regex@0.1.2: - resolution: {integrity: sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==} - engines: {node: '>=0.10.0'} - dev: true - - /path-root@0.1.1: - resolution: {integrity: sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==} - engines: {node: '>=0.10.0'} - dependencies: - path-root-regex: 0.1.2 - dev: true - - /path-type@4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - dev: true - - /pathval@1.1.1: - resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} - dev: true - - /pbkdf2@3.1.2: - resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==} - engines: {node: '>=0.12'} - dependencies: - create-hash: 1.2.0 - create-hmac: 1.1.7 - ripemd160: 2.0.2 - safe-buffer: 5.2.1 - sha.js: 2.4.11 - dev: true - - /pend@1.2.0: - resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} - dev: true - - /picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - dev: true - - /pify@4.0.1: - resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} - engines: {node: '>=6'} - dev: true - - /pkg-up@3.1.0: - resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} - engines: {node: '>=8'} - dependencies: - find-up: 3.0.0 - dev: true - - /plur@1.0.0: - resolution: {integrity: sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==} - engines: {node: '>=0.10.0'} - dev: true - - /pngparse@2.0.1: - resolution: {integrity: sha512-RyB1P0BBwt3CNIZ5wT53lR1dT3CUtopnMOuP8xZdHjPhI/uXNNRnkx1yQb/3MMMyyMeo6p19fiIRHcLopWIkxA==} - dev: false - - /pretty-bytes@5.6.0: - resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} - engines: {node: '>=6'} - dev: true - - /pretty-ms@2.1.0: - resolution: {integrity: sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==} - engines: {node: '>=0.10.0'} - dependencies: - is-finite: 1.1.0 - parse-ms: 1.0.1 - plur: 1.0.0 - dev: true - - /process-nextick-args@2.0.1: - resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - dev: true - - /process@0.11.10: - resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} - engines: {node: '>= 0.6.0'} - dev: true - - /progress@2.0.3: - resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} - engines: {node: '>=0.4.0'} - dev: true - - /proxy-agent@6.3.1: - resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 - lru-cache: 7.18.3 - pac-proxy-agent: 7.0.1 - proxy-from-env: 1.1.0 - socks-proxy-agent: 8.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: true - - /public-encrypt@4.0.3: - resolution: {integrity: sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==} - dependencies: - bn.js: 4.12.0 - browserify-rsa: 4.1.0 - create-hash: 1.2.0 - parse-asn1: 5.1.6 - randombytes: 2.1.0 - safe-buffer: 5.2.1 - dev: true - - /pump@3.0.0: - resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} - dependencies: - end-of-stream: 1.4.4 - once: 1.4.0 - dev: true - - /punycode@1.4.1: - resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} - dev: true - - /puppeteer-core@21.5.2: - resolution: {integrity: sha512-v4T0cWnujSKs+iEfmb8ccd7u4/x8oblEyKqplqKnJ582Kw8PewYAWvkH4qUWhitN3O2q9RF7dzkvjyK5HbzjLA==} - engines: {node: '>=16.13.2'} - dependencies: - '@puppeteer/browsers': 1.8.0 - chromium-bidi: 0.4.33(devtools-protocol@0.0.1203626) - cross-fetch: 4.0.0 - debug: 4.3.4(supports-color@8.1.1) - devtools-protocol: 0.0.1203626 - ws: 8.14.2 - transitivePeerDependencies: - - bufferutil - - encoding - - supports-color - - utf-8-validate - dev: true - - /puppeteer@21.5.2(typescript@5.2.2): - resolution: {integrity: sha512-BaAGJOq8Fl6/cck6obmwaNLksuY0Bg/lIahCLhJPGXBFUD2mCffypa4A592MaWnDcye7eaHmSK9yot0pxctY8A==} - engines: {node: '>=16.13.2'} - requiresBuild: true - dependencies: - '@puppeteer/browsers': 1.8.0 - cosmiconfig: 8.3.6(typescript@5.2.2) - puppeteer-core: 21.5.2 - transitivePeerDependencies: - - bufferutil - - encoding - - supports-color - - typescript - - utf-8-validate - dev: true - - /qjobs@1.2.0: - resolution: {integrity: sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==} - engines: {node: '>=0.9'} - dev: true - - /qs@6.11.0: - resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} - engines: {node: '>=0.6'} - dependencies: - side-channel: 1.0.4 - dev: true - - /qs@6.11.2: - resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} - engines: {node: '>=0.6'} - dependencies: - side-channel: 1.0.4 - dev: true - - /querystring-es3@0.2.1: - resolution: {integrity: sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==} - engines: {node: '>=0.4.x'} - dev: true - - /queue-tick@1.0.1: - resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} - dev: true - - /randombytes@2.1.0: - resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} - dependencies: - safe-buffer: 5.2.1 - dev: true - - /randomfill@1.0.4: - resolution: {integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==} - dependencies: - randombytes: 2.1.0 - safe-buffer: 5.2.1 - dev: true - - /range-parser@1.2.1: - resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} - engines: {node: '>= 0.6'} - dev: true - - /raw-body@1.1.7: - resolution: {integrity: sha512-WmJJU2e9Y6M5UzTOkHaM7xJGAPQD8PNzx3bAd2+uhZAim6wDk6dAZxPVYLF67XhbR4hmKGh33Lpmh4XWrCH5Mg==} - engines: {node: '>= 0.8.0'} - dependencies: - bytes: 1.0.0 - string_decoder: 0.10.31 - dev: true - - /raw-body@2.5.2: - resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} - engines: {node: '>= 0.8'} - dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - dev: true - - /read-only-stream@2.0.0: - resolution: {integrity: sha512-3ALe0bjBVZtkdWKIcThYpQCLbBMd/+Tbh2CDSrAIDO3UsZ4Xs+tnyjv2MjCOMMgBG+AsUOeuP1cgtY1INISc8w==} - dependencies: - readable-stream: 2.3.8 - dev: true - - /readable-stream@1.1.14: - resolution: {integrity: sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==} - dependencies: - core-util-is: 1.0.3 - inherits: 2.0.4 - isarray: 0.0.1 - string_decoder: 0.10.31 - dev: true - - /readable-stream@2.3.8: - resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} - dependencies: - core-util-is: 1.0.3 - inherits: 2.0.4 - isarray: 1.0.0 - process-nextick-args: 2.0.1 - safe-buffer: 5.1.2 - string_decoder: 1.1.1 - util-deprecate: 1.0.2 - dev: true - - /readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - dev: true - - /readdirp@3.6.0: - resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} - engines: {node: '>=8.10.0'} - dependencies: - picomatch: 2.3.1 - dev: true - - /rechoir@0.7.1: - resolution: {integrity: sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==} - engines: {node: '>= 0.10'} - dependencies: - resolve: 1.22.8 - dev: true - - /require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - dev: true - - /requires-port@1.0.0: - resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} - dev: true - - /requizzle@0.2.4: - resolution: {integrity: sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==} - dependencies: - lodash: 4.17.21 - dev: true - - /resolve-dir@1.0.1: - resolution: {integrity: sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==} - engines: {node: '>=0.10.0'} - dependencies: - expand-tilde: 2.0.2 - global-modules: 1.0.0 - dev: true - - /resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - dev: true - - /resolve-from@5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - dev: true - - /resolve-pkg@2.0.0: - resolution: {integrity: sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ==} - engines: {node: '>=8'} - dependencies: - resolve-from: 5.0.0 - dev: true - - /resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - - /rfdc@1.3.0: - resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} - dev: true - - /rimraf@2.7.1: - resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} - hasBin: true - dependencies: - glob: 7.2.3 - dev: true - - /rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - hasBin: true - dependencies: - glob: 7.2.3 - dev: true - - /ripemd160@2.0.2: - resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} - dependencies: - hash-base: 3.1.0 - inherits: 2.0.4 - dev: true - - /safe-buffer@5.1.2: - resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - dev: true - - /safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - dev: true - - /safe-json-parse@1.0.1: - resolution: {integrity: sha512-o0JmTu17WGUaUOHa1l0FPGXKBfijbxK6qoHzlkihsDXxzBHvJcA7zgviKR92Xs841rX9pK16unfphLq0/KqX7A==} - dev: true - - /safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true - - /serialize-javascript@6.0.0: - resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} - dependencies: - randombytes: 2.1.0 - dev: true - - /set-function-length@1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - dev: true - - /setprototypeof@1.2.0: - resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} - dev: true - - /sha.js@2.4.11: - resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==} - hasBin: true - dependencies: - inherits: 2.0.4 - safe-buffer: 5.2.1 - dev: true - - /shasum-object@1.0.0: - resolution: {integrity: sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==} - dependencies: - fast-safe-stringify: 2.1.1 - dev: true - - /shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - dependencies: - shebang-regex: 3.0.0 - dev: true - - /shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - dev: true - - /shell-quote@1.8.1: - resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} - dev: true - - /side-channel@1.0.4: - resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - object-inspect: 1.13.1 - dev: true - - /simple-concat@1.0.1: - resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} - dev: true - - /smart-buffer@4.2.0: - resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} - engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - dev: true - - /socket.io-adapter@2.5.2: - resolution: {integrity: sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==} - dependencies: - ws: 8.11.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - /socket.io-parser@4.2.4: - resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} - engines: {node: '>=10.0.0'} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - - /socket.io@4.7.2: - resolution: {integrity: sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==} - engines: {node: '>=10.2.0'} - dependencies: - accepts: 1.3.8 - base64id: 2.0.0 - cors: 2.8.5 - debug: 4.3.4(supports-color@8.1.1) - engine.io: 6.5.4 - socket.io-adapter: 2.5.2 - socket.io-parser: 4.2.4 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /socks-proxy-agent@8.0.2: - resolution: {integrity: sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==} - engines: {node: '>= 14'} - dependencies: - agent-base: 7.1.0 - debug: 4.3.4(supports-color@8.1.1) - socks: 2.7.1 - transitivePeerDependencies: - - supports-color - dev: true - - /socks@2.7.1: - resolution: {integrity: sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==} - engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} - dependencies: - ip: 2.0.0 - smart-buffer: 4.2.0 - dev: true - - /source-map@0.5.7: - resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==} - engines: {node: '>=0.10.0'} - dev: true - - /source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - dev: true - - /sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: true - - /sprintf-js@1.1.3: - resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} - dev: true - - /statuses@1.5.0: - resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} - engines: {node: '>= 0.6'} - dev: true - - /statuses@2.0.1: - resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} - engines: {node: '>= 0.8'} - dev: true - - /stream-browserify@3.0.0: - resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} - dependencies: - inherits: 2.0.4 - readable-stream: 3.6.2 - dev: true - - /stream-combiner2@1.1.1: - resolution: {integrity: sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==} - dependencies: - duplexer2: 0.1.4 - readable-stream: 2.3.8 - dev: true - - /stream-http@3.2.0: - resolution: {integrity: sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==} - dependencies: - builtin-status-codes: 3.0.0 - inherits: 2.0.4 - readable-stream: 3.6.2 - xtend: 4.0.2 - dev: true - - /stream-splicer@2.0.1: - resolution: {integrity: sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==} - dependencies: - inherits: 2.0.4 - readable-stream: 2.3.8 - dev: true - - /streamroller@3.1.5: - resolution: {integrity: sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==} - engines: {node: '>=8.0'} - dependencies: - date-format: 4.0.14 - debug: 4.3.4(supports-color@8.1.1) - fs-extra: 8.1.0 - transitivePeerDependencies: - - supports-color - dev: true - - /streamx@2.15.5: - resolution: {integrity: sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==} - dependencies: - fast-fifo: 1.3.2 - queue-tick: 1.0.1 - dev: true - - /string-template@0.2.1: - resolution: {integrity: sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==} - dev: true - - /string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 - dev: true - - /string_decoder@0.10.31: - resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} - dev: true - - /string_decoder@1.1.1: - resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} - dependencies: - safe-buffer: 5.1.2 - dev: true - - /string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - dependencies: - safe-buffer: 5.2.1 - dev: true - - /strip-ansi@3.0.1: - resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} - engines: {node: '>=0.10.0'} - dependencies: - ansi-regex: 2.1.1 - dev: true - - /strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - dependencies: - ansi-regex: 5.0.1 - dev: true - - /strip-json-comments@1.0.4: - resolution: {integrity: sha512-AOPG8EBc5wAikaG1/7uFCNFJwnKOuQwFTpYBdTW6OvWHeZBQBrAA/amefHGrEiOnCPcLFZK6FUPtWVKpQVIRgg==} - engines: {node: '>=0.8.0'} - hasBin: true - dev: true - - /strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - dev: true - - /subarg@1.0.0: - resolution: {integrity: sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==} - dependencies: - minimist: 1.2.8 - dev: true - - /supports-color@2.0.0: - resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} - engines: {node: '>=0.8.0'} - dev: true - - /supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - dependencies: - has-flag: 3.0.0 - dev: true - - /supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - dependencies: - has-flag: 4.0.0 - dev: true - - /supports-color@8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} - dependencies: - has-flag: 4.0.0 - - /supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - dev: true - - /syntax-error@1.4.0: - resolution: {integrity: sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==} - dependencies: - acorn-node: 1.8.2 - dev: true - - /taffydb@2.6.2: - resolution: {integrity: sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==} - dev: true - - /tar-fs@3.0.4: - resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} - dependencies: - mkdirp-classic: 0.5.3 - pump: 3.0.0 - tar-stream: 3.1.6 - dev: true - - /tar-stream@3.1.6: - resolution: {integrity: sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==} - dependencies: - b4a: 1.6.4 - fast-fifo: 1.3.2 - streamx: 2.15.5 - dev: true - - /text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: true - - /through2@2.0.5: - resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==} - dependencies: - readable-stream: 2.3.8 - xtend: 4.0.2 - dev: true - - /through2@4.0.2: - resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} - dependencies: - readable-stream: 3.6.2 - dev: true - - /through@2.3.8: - resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - dev: true - - /time-grunt@2.0.0: - resolution: {integrity: sha512-iQD2AeDYCAJrsPC/eUsfYZD9UT7TuBOmUIgFV5zeTQgRk6yLJKoc3aYR0gusJ0m+bG13B6qrDZ0SwPLe0/htHw==} - engines: {node: '>=0.10.0'} - deprecated: Deprecated because Grunt is practically unmaintained. Move on to something better. This package will continue to work with Grunt v1, but it will not receive any updates. - dependencies: - chalk: 1.1.3 - date-time: 1.1.0 - figures: 1.7.0 - hooker: 0.2.3 - number-is-nan: 1.0.1 - pretty-ms: 2.1.0 - text-table: 0.2.0 - dev: true - - /time-zone@0.1.0: - resolution: {integrity: sha512-S5CjtVIkeBTnlsaZP3gjsTb78ClBe74sEcgEoBwAVUKnTRDAGqUtLLIZHMsIyqOWjt9DGQpLMMoD8ZKIfP2ddQ==} - engines: {node: '>=0.10.0'} - dev: true - - /timers-browserify@1.4.2: - resolution: {integrity: sha512-PIxwAupJZiYU4JmVZYwXp9FKsHMXb5h0ZEFyuXTAn8WLHOlcij+FEcbrvDsom1o5dr1YggEtFbECvGCW2sT53Q==} - engines: {node: '>=0.6.0'} - dependencies: - process: 0.11.10 - dev: true - - /tiny-lr@1.1.1: - resolution: {integrity: sha512-44yhA3tsaRoMOjQQ+5v5mVdqef+kH6Qze9jTpqtVufgYjYt08zyZAwNwwVBj3i1rJMnR52IxOW0LK0vBzgAkuA==} - dependencies: - body: 5.1.0 - debug: 3.2.7 - faye-websocket: 0.10.0 - livereload-js: 2.4.0 - object-assign: 4.1.1 - qs: 6.11.2 - transitivePeerDependencies: - - supports-color - dev: true - - /tmp@0.2.1: - resolution: {integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==} - engines: {node: '>=8.17.0'} - dependencies: - rimraf: 3.0.2 - dev: true - - /to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - dev: true - - /to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - dependencies: - is-number: 7.0.0 - dev: true - - /toidentifier@1.0.1: - resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} - engines: {node: '>=0.6'} - dev: true - - /tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: true - - /ts-node@10.9.2(@types/node@20.9.2)(typescript@5.2.2): - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.9.2 - acorn: 8.11.2 - acorn-walk: 8.3.1 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.2.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: true - - /tslib@2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: true - - /tty-browserify@0.0.1: - resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==} - dev: true - - /type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} - engines: {node: '>=4'} - dev: true - - /type-is@1.6.18: - resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} - engines: {node: '>= 0.6'} - dependencies: - media-typer: 0.3.0 - mime-types: 2.1.35 - dev: true - - /typedarray@0.0.6: - resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} - dev: true - - /typescript@5.2.2: - resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - - /ua-parser-js@0.7.37: - resolution: {integrity: sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==} - dev: true - - /uc.micro@1.0.6: - resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==} - dev: true - - /uglify-js@3.17.4: - resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} - engines: {node: '>=0.8.0'} - hasBin: true - dev: true - - /umd@3.0.3: - resolution: {integrity: sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==} - hasBin: true - dev: true - - /unbzip2-stream@1.4.3: - resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==} - dependencies: - buffer: 5.7.1 - through: 2.3.8 - dev: true - - /unc-path-regex@0.1.2: - resolution: {integrity: sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==} - engines: {node: '>=0.10.0'} - dev: true - - /undeclared-identifiers@1.1.3: - resolution: {integrity: sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==} - hasBin: true - dependencies: - acorn-node: 1.8.2 - dash-ast: 1.0.0 - get-assigned-identifiers: 1.2.0 - simple-concat: 1.0.1 - xtend: 4.0.2 - dev: true - - /underscore.string@3.3.6: - resolution: {integrity: sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==} - dependencies: - sprintf-js: 1.1.3 - util-deprecate: 1.0.2 - dev: true - - /underscore@1.13.6: - resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==} - dev: true - - /undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - - /universalify@0.1.2: - resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} - engines: {node: '>= 4.0.0'} - dev: true - - /unpipe@1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} - dev: true - - /uri-path@1.0.0: - resolution: {integrity: sha512-8pMuAn4KacYdGMkFaoQARicp4HSw24/DHOVKWqVRJ8LhhAwPPFpdGvdL9184JVmUwe7vz7Z9n6IqI6t5n2ELdg==} - engines: {node: '>= 0.10'} - dev: true - - /url@0.11.3: - resolution: {integrity: sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==} - dependencies: - punycode: 1.4.1 - qs: 6.11.2 - dev: true - - /urlpattern-polyfill@9.0.0: - resolution: {integrity: sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==} - dev: true - - /util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true - - /util@0.10.4: - resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==} - dependencies: - inherits: 2.0.3 - dev: true - - /util@0.12.5: - resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} - dependencies: - inherits: 2.0.4 - is-arguments: 1.1.1 - is-generator-function: 1.0.10 - is-typed-array: 1.1.12 - which-typed-array: 1.1.13 - dev: true - - /utils-merge@1.0.1: - resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} - engines: {node: '>= 0.4.0'} - dev: true - - /v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: true - - /v8flags@3.2.0: - resolution: {integrity: sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==} - engines: {node: '>= 0.10'} - dependencies: - homedir-polyfill: 1.0.3 - dev: true - - /vary@1.1.2: - resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} - engines: {node: '>= 0.8'} - - /vm-browserify@1.1.2: - resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==} - dev: true - - /void-elements@2.0.1: - resolution: {integrity: sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==} - engines: {node: '>=0.10.0'} - dev: true - - /watchify@4.0.0: - resolution: {integrity: sha512-2Z04dxwoOeNxa11qzWumBTgSAohTC0+ScuY7XMenPnH+W2lhTcpEOJP4g2EIG/SWeLadPk47x++Yh+8BqPM/lA==} - engines: {node: '>= 8.10.0'} - hasBin: true - dependencies: - anymatch: 3.1.3 - browserify: 17.0.0 - chokidar: 3.5.3 - defined: 1.0.1 - outpipe: 1.1.1 - through2: 4.0.2 - xtend: 4.0.2 - dev: true - - /webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: true - - /websocket-driver@0.7.4: - resolution: {integrity: sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==} - engines: {node: '>=0.8.0'} - dependencies: - http-parser-js: 0.5.8 - safe-buffer: 5.2.1 - websocket-extensions: 0.1.4 - dev: true - - /websocket-extensions@0.1.4: - resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} - engines: {node: '>=0.8.0'} - dev: true - - /webworkify-webpack@2.1.5: - resolution: {integrity: sha512-2akF8FIyUvbiBBdD+RoHpoTbHMQF2HwjcxfDvgztAX5YwbZNyrtfUMgvfgFVsgDhDPVTlkbb5vyasqDHfIDPQw==} - dev: false - - /webworkify@1.5.0: - resolution: {integrity: sha512-AMcUeyXAhbACL8S2hqqdqOLqvJ8ylmIbNwUIqQujRSouf4+eUFaXbG6F1Rbu+srlJMmxQWsiU7mOJi0nMBfM1g==} - dev: false - - /whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - dev: true - - /which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - dev: true - - /which@1.3.1: - resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} - hasBin: true - dependencies: - isexe: 2.0.0 - dev: true - - /which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - dependencies: - isexe: 2.0.0 - dev: true - - /workerpool@6.2.1: - resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} - dev: true - - /wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - dev: true - - /wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true - - /ws@8.11.0: - resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - /ws@8.14.2: - resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - /xmlcreate@2.0.4: - resolution: {integrity: sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==} - dev: true - - /xtend@4.0.2: - resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} - engines: {node: '>=0.4'} - dev: true - - /y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - dev: true - - /yargs-parser@20.2.4: - resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} - engines: {node: '>=10'} - dev: true - - /yargs-parser@20.2.9: - resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} - engines: {node: '>=10'} - dev: true - - /yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - dev: true - - /yargs-unparser@2.0.0: - resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} - engines: {node: '>=10'} - dependencies: - camelcase: 6.3.0 - decamelize: 4.0.0 - flat: 5.0.2 - is-plain-obj: 2.1.0 - dev: true - - /yargs@16.2.0: - resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} - engines: {node: '>=10'} - dependencies: - cliui: 7.0.4 - escalade: 3.1.1 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 20.2.9 - dev: true - - /yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - dependencies: - cliui: 8.0.1 - escalade: 3.1.1 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - dev: true - - /yauzl@2.10.0: - resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==} - dependencies: - buffer-crc32: 0.2.13 - fd-slicer: 1.1.0 - dev: true - - /yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: true - - /yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - dev: true From 9f3d91c752829937c1a5c45d4a3a82f4c0f94567 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 14 Dec 2023 11:48:49 -0500 Subject: [PATCH 63/66] Small changes --- src/actionlib/SimpleActionServer.js | 2 +- src/core/ActionFeedback.js | 4 ++-- src/core/ActionGoal.js | 4 ++-- src/core/ActionResult.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index 39d1370eb..311e4ffd3 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -241,4 +241,4 @@ class SimpleActionServer extends EventEmitter2 { } } -module.exports = SimpleActionServer; \ No newline at end of file +module.exports = SimpleActionServer; diff --git a/src/core/ActionFeedback.js b/src/core/ActionFeedback.js index 69b0ff68d..055de45b0 100644 --- a/src/core/ActionFeedback.js +++ b/src/core/ActionFeedback.js @@ -9,11 +9,11 @@ var assign = require('object-assign'); * An ActionFeedback is periodically returned during an in-progress ROS 2 action. * * @constructor - * @template T + * @template TFeedback */ class ActionFeedback { /** - * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + * @param {TFeedback} [values={}] - Object matching the fields defined in the .action definition file. */ constructor(values) { assign(this, values || {}); diff --git a/src/core/ActionGoal.js b/src/core/ActionGoal.js index 9f5ccdc0a..159f746b3 100644 --- a/src/core/ActionGoal.js +++ b/src/core/ActionGoal.js @@ -9,11 +9,11 @@ var assign = require('object-assign'); * An ActionGoal is passed into a ROS 2 action goal request. * * @constructor - * @template T + * @template TGoal */ class ActionGoal { /** - * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + * @param {TGoal} [values={}] - Object matching the fields defined in the .action definition file. */ constructor(values) { assign(this, values || {}); diff --git a/src/core/ActionResult.js b/src/core/ActionResult.js index 7d6a810de..bef710481 100644 --- a/src/core/ActionResult.js +++ b/src/core/ActionResult.js @@ -9,11 +9,11 @@ var assign = require('object-assign'); * An ActionResult is returned from sending a ROS 2 action goal. * * @constructor - * @template T + * @template TResult */ class ActionResult { /** - * @param {T} [values={}] - Object matching the fields defined in the .action definition file. + * @param {TResult} [values={}] - Object matching the fields defined in the .action definition file. */ constructor(values) { assign(this, values || {}); From f6225a2de057e7d44d49f986b27248203d938db3 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 14 Dec 2023 11:49:37 -0500 Subject: [PATCH 64/66] Remove extraneous HTML lines post merge --- examples/action_client.html | 1 - examples/action_server.html | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/action_client.html b/examples/action_client.html index ca595c85d..463acc4b0 100644 --- a/examples/action_client.html +++ b/examples/action_client.html @@ -2,7 +2,6 @@ -