├── .travis.yml ├── .editorconfig ├── .gitignore ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── CONTRIBUTING.md ├── CHANGELOG.md ├── docs ├── README.md ├── developer-guide.md └── user-guide.md ├── LICENSE ├── internals └── webpack │ └── webpack.config.js ├── .gitattributes ├── CODE_OF_CONDUCT.md ├── README.md ├── src ├── index.js └── tests │ └── test.index.js ├── package.json └── dist ├── ethjs-util.min.js └── ethjs-util.js.map /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | language: node_js 3 | node_js: 4 | - "6" 5 | after_success: npm run coveralls 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = false 6 | indent_style = space 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Don't check auto-generated stuff into git 2 | node_modules 3 | coverage 4 | lib 5 | 6 | # Cruft 7 | .DS_Store 8 | npm-debug.log 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # ethjs-util 2 | 3 | Before opening a new issue, please take a moment to review our [**community guidelines**](https://github.com/ethjs/ethjs-util/blob/master/.github/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved. 4 | 5 | **Before opening a new issue, you may find an answer in already closed issues**: 6 | https://github.com/ethjs/ethjs-util/issues?q=is%3Aissue+is%3Aclosed 7 | 8 | ## Issue Type 9 | 10 | - [ ] Bug (https://github.com/ethjs/ethjs-util/blob/master/.github/CONTRIBUTING.md#bug-reports) 11 | - [ ] Feature (https://github.com/ethjs/ethjs-util/blob/master/.github/CONTRIBUTING.md#feature-requests) 12 | 13 | ## Description 14 | 15 | (Add images if possible) 16 | 17 | ## Steps to reproduce 18 | 19 | (Add link to a demo on https://jsfiddle.net or similar if possible) 20 | 21 | # Versions 22 | 23 | - Node/NPM: 24 | - Browser: 25 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.3 -- less dependencies 2 | 3 | 1. Less dependencies 4 | 2. Smaller build size 5 | 3. More docs 6 | 7 | # 0.1.2 -- config fixes 8 | 9 | 1. webpack config updates 10 | 2. build config updates 11 | 12 | # 0.1.1 -- less dependencies 13 | 14 | 1. Less dependencies, same functionality 15 | 2. More tests 16 | 3. More docs 17 | 18 | # 0.0.5 -- more config 19 | 20 | 1. Module configuration for es5, webpack and dist builds 21 | 22 | # 0.0.4 -- remove unused deps 23 | 24 | 1. Removed one unused dep 25 | 26 | # 0.0.3 -- added `some` property to arrayContainsArray 27 | 28 | 1. added `some` property to arrayContainsArray, allows some array in another 29 | 30 | # 0.0.2 -- added isHexString and getKeys 31 | 32 | 1. added `isHexString` method 33 | 2. added `getKeys` method util 34 | 35 | # 0.0.1 -- ethjs-util 36 | 37 | 1. Basic testing 38 | 2. Basic docs 39 | 3. License 40 | 4. linting 41 | 5. basic exports 42 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | ## Table of Contents 4 | 5 | - [General](general) 6 | - [**Developer Guide**](developer-guide.md) 7 | - [**User Guide**](user-guide.md) 8 | 9 | ## Overview 10 | 11 | ### Structure 12 | 13 | The [`src/`](../../../tree/master/src) directory contains your entire application code, including JavaScript, and tests. 14 | 15 | The rest of the folders and files only exist to make your life easier, and 16 | should not need to be touched. 17 | 18 | For more in-depth structure, see the developer-guide.md. 19 | 20 | *(If they do have to be changed, please [submit an issue](https://github.com/ethjs/ethjs-util/issues)!)* 21 | 22 | ### Testing 23 | 24 | For a thorough explanation of the testing procedure, see the 25 | [testing documentation](./developer-guide/README.md)! 26 | 27 | #### Unit testing 28 | 29 | Unit tests live in `src/tests/` directories right next to the components being tested 30 | and are run with `npm test`. 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016 Nick Dodson. nickdodson.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## ethjs-util 2 | 3 | Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/ethjs/ethjs-util/blob/master/.github/CONTRIBUTING.md) 4 | to make the process easy and effective for everyone involved. 5 | 6 | **Please open an issue** before embarking on any significant pull request, especially those that 7 | add a new library or change existing tests, otherwise you risk spending a lot of time working 8 | on something that might not end up being merged into the project. 9 | 10 | Before opening a pull request, please ensure: 11 | 12 | - [ ] You have followed our [**contributing guidelines**](https://github.com/ethjs/ethjs-util/blob/master/.github/CONTRIBUTING.md) 13 | - [ ] Pull request has tests (we are going for 100% coverage!) 14 | - [ ] Code is well-commented, linted and follows project conventions 15 | - [ ] Documentation is updated (if necessary) 16 | - [ ] Internal code generators and templates are updated (if necessary) 17 | - [ ] Description explains the issue/use-case resolved and auto-closes related issues 18 | 19 | Be kind to code reviewers, please try to keep pull requests as small and focused as possible :) 20 | 21 | **IMPORTANT**: By submitting a patch, you agree to allow the project 22 | owners to license your work under the terms of the [MIT License](https://github.com/ethjs/ethjs-util/blob/master/LICENSE.md). 23 | -------------------------------------------------------------------------------- /internals/webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); // eslint-disable-line 2 | 3 | var env = process.env.NODE_ENV; // eslint-disable-line 4 | var filename = 'ethjs-util'; // eslint-disable-line 5 | var library = 'ethUtil'; // eslint-disable-line 6 | var config = { // eslint-disable-line 7 | module: { 8 | loaders: [ 9 | { 10 | test: /\.js$/, 11 | loaders: ['babel-loader'], 12 | exclude: /node_modules/, 13 | }, 14 | { 15 | test: /\.json$/, 16 | loader: 'json', 17 | }, 18 | ], 19 | }, 20 | devtool: 'cheap-module-source-map', 21 | output: { 22 | path: 'dist', 23 | filename: filename + '.js', // eslint-disable-line 24 | library: library, // eslint-disable-line 25 | libraryTarget: 'umd', 26 | umdNamedDefine: true, 27 | }, 28 | plugins: [ 29 | new webpack.BannerPlugin({ banner: ' /* eslint-disable */ ', raw: true, entryOnly: true }), 30 | new webpack.optimize.OccurrenceOrderPlugin(), 31 | new webpack.DefinePlugin({ 32 | 'process.env.NODE_ENV': JSON.stringify(env), 33 | }), 34 | ], 35 | }; 36 | 37 | if (env === 'production') { 38 | config.output.filename = filename + '.min.js'; // eslint-disable-line 39 | config.plugins 40 | .push(new webpack.optimize.UglifyJsPlugin({ 41 | compressor: { 42 | pure_getters: true, 43 | unsafe: true, 44 | unsafe_comps: true, 45 | warnings: false, 46 | screw_ie8: false, 47 | }, 48 | mangle: { 49 | screw_ie8: false, 50 | }, 51 | output: { 52 | screw_ie8: false, 53 | }, 54 | })); 55 | config.plugins.push(new webpack.optimize.DedupePlugin()); 56 | } 57 | 58 | module.exports = config; 59 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes 2 | 3 | # Handle line endings automatically for files detected as text 4 | # and leave all files detected as binary untouched. 5 | * text=auto 6 | 7 | # 8 | # The above will handle all files NOT found below 9 | # 10 | 11 | # 12 | ## These files are text and should be normalized (Convert crlf => lf) 13 | # 14 | 15 | # source code 16 | *.php text 17 | *.css text 18 | *.sass text 19 | *.scss text 20 | *.less text 21 | *.styl text 22 | *.js text eol=lf 23 | *.coffee text 24 | *.json text 25 | *.htm text 26 | *.html text 27 | *.xml text 28 | *.svg text 29 | *.txt text 30 | *.ini text 31 | *.inc text 32 | *.pl text 33 | *.rb text 34 | *.py text 35 | *.scm text 36 | *.sql text 37 | *.sh text 38 | *.bat text 39 | 40 | # templates 41 | *.ejs text 42 | *.hbt text 43 | *.jade text 44 | *.haml text 45 | *.hbs text 46 | *.dot text 47 | *.tmpl text 48 | *.phtml text 49 | 50 | # server config 51 | .htaccess text 52 | 53 | # git config 54 | .gitattributes text 55 | .gitignore text 56 | .gitconfig text 57 | 58 | # code analysis config 59 | .jshintrc text 60 | .jscsrc text 61 | .jshintignore text 62 | .csslintrc text 63 | 64 | # misc config 65 | *.yaml text 66 | *.yml text 67 | .editorconfig text 68 | 69 | # build config 70 | *.npmignore text 71 | *.bowerrc text 72 | 73 | # Heroku 74 | Procfile text 75 | .slugignore text 76 | 77 | # Documentation 78 | *.md text 79 | LICENSE text 80 | AUTHORS text 81 | 82 | 83 | # 84 | ## These files are binary and should be left untouched 85 | # 86 | 87 | # (binary is a macro for -text -diff) 88 | *.png binary 89 | *.jpg binary 90 | *.jpeg binary 91 | *.gif binary 92 | *.ico binary 93 | *.mov binary 94 | *.mp4 binary 95 | *.mp3 binary 96 | *.flv binary 97 | *.fla binary 98 | *.swf binary 99 | *.gz binary 100 | *.zip binary 101 | *.7z binary 102 | *.ttf binary 103 | *.eot binary 104 | *.woff binary 105 | *.pyc binary 106 | *.pdf binary 107 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of 4 | fostering an open and welcoming community, we pledge to respect all people who 5 | contribute through reporting issues, posting feature requests, updating 6 | documentation, submitting pull requests or patches, and other activities. 7 | 8 | We are committed to making participation in this project a harassment-free 9 | experience for everyone, regardless of level of experience, gender, gender 10 | identity and expression, sexual orientation, disability, personal appearance, 11 | body size, race, ethnicity, age, religion, or nationality. 12 | 13 | Examples of unacceptable behavior by participants include: 14 | 15 | * The use of sexualized language or imagery 16 | * Personal attacks 17 | * Trolling or insulting/derogatory comments 18 | * Public or private harassment 19 | * Publishing other's private information, such as physical or electronic 20 | addresses, without explicit permission 21 | * Other unethical or unprofessional conduct 22 | 23 | Project maintainers have the right and responsibility to remove, edit, or 24 | reject comments, commits, code, wiki edits, issues, and other contributions 25 | that are not aligned to this Code of Conduct, or to ban temporarily or 26 | permanently any contributor for other behaviors that they deem inappropriate, 27 | threatening, offensive, or harmful. 28 | 29 | By adopting this Code of Conduct, project maintainers commit themselves to 30 | fairly and consistently applying these principles to every aspect of managing 31 | this project. Project maintainers who do not follow or enforce the Code of 32 | Conduct may be permanently removed from the project team. 33 | 34 | This Code of Conduct applies both within project spaces and in public spaces 35 | when an individual is representing the project or its community. 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 38 | reported by contacting the project maintainer at nick.dodson@consensys.net. All 39 | complaints will be reviewed and investigated and will result in a response that 40 | is deemed necessary and appropriate to the circumstances. Maintainers are 41 | obligated to maintain confidentiality with regard to the reporter of an 42 | incident. 43 | 44 | 45 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 46 | version 1.3.0, available at 47 | [http://contributor-covenant.org/version/1/3/0/][version] 48 | 49 | [homepage]: http://contributor-covenant.org 50 | [version]: http://contributor-covenant.org/version/1/3/0/ 51 | -------------------------------------------------------------------------------- /docs/developer-guide.md: -------------------------------------------------------------------------------- 1 | # Developer Guide 2 | 3 | All information regarding contributing to and progressing `ethjs-util` module can be found in this document. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm install --save ethjs-util 9 | ``` 10 | 11 | ## Install from Source 12 | 13 | ``` 14 | git clone http://github.com/ethjs/ethjs-util 15 | npm install 16 | ``` 17 | 18 | ## Test 19 | 20 | ``` 21 | npm test 22 | ``` 23 | 24 | ## Build 25 | 26 | ``` 27 | npm run build 28 | ``` 29 | 30 | ## Linting 31 | 32 | ``` 33 | npm run lint 34 | ``` 35 | 36 | ## Travis-ci and Coveralls Testing 37 | 38 | Note, this will generate a `coveralls` report locally. 39 | 40 | ``` 41 | npm run test-travis 42 | ``` 43 | 44 | You can find the coveralls report and view the percentages and stats, by going to the [index.html](coverage/lcov-report/index.html) file generated after running the `test-travis` script. Open this in Chrome to see the generated report. Travis will run mocha as usual, but collect information about the testing coverage. This report will be sent by TravisCI during the automated build process. 45 | 46 | ## Build Staging 47 | 48 | The build staging for this module is as follows: 49 | 50 | 1. Cleanup 51 | 2. Linting 52 | 3. Testing 53 | 4. Babel processing (output to lib) 54 | 5. Webpack (output to dist) 55 | 6. Webpack production (output to dist) 56 | 7. Retest lib folder for babel processing solidity 57 | 8. Report build stats 58 | 59 | ## Folder Structure 60 | 61 | All module source code is found in the `src` directory. All module helper scripts can be found in the `scripts` folder. These will not need to be touched, and are purely configuration for this repository. 62 | 63 | ``` 64 | ./ethjs-util 65 | ./.github 66 | ./dist 67 | ./lib 68 | ./tests 69 | ./internals 70 | ./webpack 71 | ./coverage 72 | ./docs 73 | ./src 74 | ./tests 75 | ``` 76 | 77 | Note, the `./lib` dir is generated from the babel build staging. `./coverage` is generated from the `npm run test-travis` script. All internals and helper scripts (i.e. `webpack`) are in `./internals`. All distribution builds are in `./dist` (usually a minified and unminified production build of the package). 78 | 79 | ## NPM Practice 80 | 81 | Across all `ethjs-` repos, we enforce version hardening (i.e. "0.0.3" not "^0.0.3"). We want to reduce potential hazardous install changes from dependancies as much as possible to ensure package preformace, testing, security and design. Please make sure all your commits and PR's are version hardend if you are installing or removing new packages. 82 | 83 | After build staging it is the `lib` folder which actually gets published to NPM. This allows for easy inclusion into other modules which may not use babel transpiling or which may not support es2015+. 84 | 85 | ## NPM/Node Version Requirements 86 | 87 | `ethjs` requires you have: 88 | - `nodejs` -v 6.5.0+ 89 | - `npm` -v 3.0+ 90 | 91 | This is a requirement to run, test, lint and build this module. 92 | 93 | ## Changelog 94 | 95 | All relevant changes are notated in the `CHANGELOG.md` file, moniter this file for changes to this repository. 96 | 97 | ## Travis-ci and Coveralls Practice 98 | 99 | Across all `ethjs-` repos, we enforce mandatory travis-ci and coveralls testing. We never `commit to master`. As a general policy, Coveralls.io results must always be above 95% for any `ethjs-` PR or commit. We want to ensure complete coverage across the board. 100 | 101 | ## Contributing 102 | 103 | Please help better the ecosystem by submitting issues and pull requests. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard. Please read more about contributing to `ethjs-util` in the `.github/CONTRIBUTING.md`. 104 | 105 | ## Licence 106 | 107 | This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE. 108 | -------------------------------------------------------------------------------- /docs/user-guide.md: -------------------------------------------------------------------------------- 1 | # User Guide 2 | 3 | All information for developers using `ethjs-util` should consult this document. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm install --save ethjs-util 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | const util = require('ethjs-util'); 15 | 16 | const value = util.intToBuffer(38272); 17 | 18 | // returns 19 | ``` 20 | 21 | ## Available Methods 22 | 23 | ``` 24 | arrayContainsArray 25 | getBinarySize 26 | intToBuffer 27 | isHexPrefixed 28 | stripHexPrefix 29 | padToEven 30 | intToHex 31 | fromAscii, 32 | fromUtf8, 33 | toAscii, 34 | toUtf8, 35 | getKeys, 36 | isHexString, 37 | ``` 38 | 39 | ## Why BN.js? 40 | 41 | `ethjs` has made a policy of using `BN.js` across all of its repositories. Here are some of the reasons why: 42 | 43 | 1. lighter than alternatives (BigNumber.js) 44 | 2. faster than most alternatives, see [benchmarks](https://github.com/indutny/bn.js/issues/89) 45 | 3. used by the Ethereum foundation across all [`ethereumjs`](https://github.com/ethereumjs) repositories 46 | 4. is already used by a critical JS dependency of many ethereum packages, see package [`elliptic`](https://github.com/indutny/elliptic) 47 | 5. purposefully **does not support decimals or floats numbers** (for greater precision), remember, the Ethereum blockchain cannot and will not support float values or decimal numbers. 48 | 49 | ## Browser Builds 50 | 51 | `ethjs` provides production distributions for all of its modules that are ready for use in the browser right away. Simply include either `dist/ethjs-util.js` or `dist/ethjs-util.min.js` directly into an HTML file to start using this module. Note, an `ethUtil` object is made available globally. 52 | 53 | ```html 54 | 55 | 58 | ``` 59 | 60 | Note, even though `ethjs` should have transformed and polyfilled most of the requirements to run this module across most modern browsers. You may want to look at an additional polyfill for extra support. 61 | 62 | Use a polyfill service such as `Polyfill.io` to ensure complete cross-browser support: 63 | https://polyfill.io/ 64 | 65 | ## Latest Webpack Figures 66 | 67 | ``` 68 | Hash: 28b387e39e1016183a78 69 | Version: webpack 2.1.0-beta.15 70 | Time: 734ms 71 | Asset Size Chunks Chunk Names 72 | ethjs-util.js 65.1 kB 0 [emitted] main 73 | ethjs-util.js.map 79.3 kB 0 [emitted] main 74 | + 8 hidden modules 75 | 76 | Hash: 4d26e1d501227158f8ab 77 | Version: webpack 2.1.0-beta.15 78 | Time: 1523ms 79 | Asset Size Chunks Chunk Names 80 | ethjs-util.min.js 25.4 kB 0 [emitted] main 81 | + 8 hidden modules 82 | ``` 83 | 84 | ## Other Awesome Modules, Tools and Frameworks 85 | 86 | - [web3.js](https://github.com/ethereum/web3.js) -- the original Ethereum swiss army knife **Ethereum Foundation** 87 | - [ethereumjs](https://github.com/ethereumjs) -- critical ethereumjs infrastructure **Ethereum Foundation** 88 | - [browser-solidity](https://ethereum.github.io/browser-solidity) -- an in browser Solidity IDE **Ethereum Foundation** 89 | - [wafr](https://github.com/silentcicero/wafr) -- a super simple Solidity testing framework 90 | - [truffle](https://github.com/ConsenSys/truffle) -- a solidity/js dApp framework 91 | - [embark](https://github.com/iurimatias/embark-framework) -- a solidity/js dApp framework 92 | - [dapple](https://github.com/nexusdev/dapple) -- a solidity dApp framework 93 | - [chaitherium](https://github.com/SafeMarket/chaithereum) -- a JS web3 unit testing framework 94 | - [contest](https://github.com/DigixGlobal/contest) -- a JS testing framework for contracts 95 | 96 | ## Our Relationship with Ethereum & EthereumJS 97 | 98 | We would like to mention that we are not in any way affiliated with the Ethereum Foundation or `ethereumjs`. However, we love the work they do and work with them often to make Ethereum great! Our aim is to support the Ethereum ecosystem with a policy of diversity, modularity, simplicity, transparency, clarity, optimization and extensibility. 99 | 100 | Many of our modules use code from `web3.js` and the `ethereumjs-` repositories. We thank the authors where we can in the relevant repositories. We use their code carefully, and make sure all test coverage is ported over and where possible, expanded on. 101 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to ethjs-util 2 | 3 | Love ethjs-util and want to help? Thanks so much, there's something to do for everybody! 4 | 5 | Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. 6 | 7 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. 8 | 9 | ## Using the issue tracker 10 | 11 | The [issue tracker](https://github.com/ethjs/ethjs-util/issues) is 12 | the preferred channel for [bug reports](#bugs), [features requests](#features) 13 | and [submitting pull requests](#pull-requests). 14 | 15 | 16 | ## Bug reports 17 | 18 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 19 | Good bug reports are extremely helpful - thank you! 20 | 21 | Guidelines for bug reports: 22 | 23 | 1. **Use the GitHub issue search** — check if the issue has already been reported. 24 | 25 | 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository. 26 | 27 | 3. **Isolate the problem** — 28 | 29 | A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS 30 | experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs. 31 | 32 | Example: 33 | 34 | > Short and descriptive example bug report title 35 | > 36 | > A summary of the issue and the browser/OS environment in which it occurs. If 37 | > suitable, include the steps required to reproduce the bug. 38 | > 39 | > 1. This is the first step 40 | > 2. This is the second step 41 | > 3. Further steps, etc. 42 | > 43 | > `` - a link to the reduced test case 44 | > 45 | > Any other information you want to share that is relevant to the issue being 46 | > reported. This might include the lines of code that you have identified as 47 | > causing the bug, and potential solutions (and your opinions on their 48 | > merits). 49 | 50 | 51 | 52 | ## Feature requests 53 | 54 | Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. 55 | 56 | 57 | 58 | ## Pull requests 59 | 60 | Good pull requests - patches, improvements, new features - are a fantastic 61 | help. They should remain focused in scope and avoid containing unrelated 62 | commits. 63 | 64 | **Please ask first** before embarking on any significant pull request (e.g. 65 | implementing features, refactoring code, porting to a different language), 66 | otherwise you risk spending a lot of time working on something that the 67 | project's developers might not want to merge into the project. 68 | 69 | Please adhere to the coding conventions used throughout a project (indentation, 70 | accurate comments, etc.) and any other requirements (such as test coverage). 71 | 72 | Adhering to the following process is the best way to get your work 73 | included in the project: 74 | 75 | 1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork, and configure the remotes: 76 | 77 | ```bash 78 | # Clone your fork of the repo into the current directory 79 | git clone https://github.com//ethjs-util.git 80 | # Navigate to the newly cloned directory 81 | cd ethjs-util 82 | # Assign the original repo to a remote called "upstream" 83 | git remote add upstream https://github.com/ethjs/ethjs-util.git 84 | ``` 85 | 86 | 2. If you cloned a while ago, get the latest changes from upstream: 87 | 88 | ```bash 89 | git checkout master 90 | git pull upstream master 91 | ``` 92 | 93 | 3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: 94 | 95 | ```bash 96 | git checkout -b 97 | ``` 98 | 99 | 4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/about-git-rebase/) feature to tidy up your commits before making them public. 100 | 101 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 102 | 103 | ```bash 104 | git pull [--rebase] upstream master 105 | ``` 106 | 107 | 6. Push your topic branch up to your fork: 108 | 109 | ```bash 110 | git push origin 111 | ``` 112 | 113 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 114 | with a clear title and description. 115 | 116 | **DESIGN NOTE**: ethjs-util follows the UNIX programming philosophy. Please consider this before contributing, keep your commits/modules concise and to the point. 117 | 118 | Read more here: 119 | http://www.catb.org/esr/writings/taoup/html/ch01s06.html 120 | 121 | **IMPORTANT**: By submitting a patch, you agree to allow the project 122 | owners to license your work under the terms of the [MIT License](LICENSE.txt). 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## ethjs-util 2 | 3 |
4 | 5 | 6 | Dependency Status 8 | 9 | 10 | 11 | 12 | devDependency Status 13 | 14 | 15 | 16 | 17 | Build Status 19 | 20 | 21 | 22 | 23 | NPM version 25 | 26 | 27 | 28 | 29 | Test Coverage 30 | 31 | 32 | 33 | 34 | js-airbnb-style 35 | 36 |
37 | 38 |
39 | 40 | A simple set of Ethereum JS utilities such as `toBuffer` and `isHexPrefixed`. 41 | 42 | ## Install 43 | 44 | ``` 45 | npm install --save ethjs-util 46 | ``` 47 | 48 | ## Usage 49 | 50 | ```js 51 | const util = require('ethjs-util'); 52 | 53 | const value = util.intToBuffer(38272); 54 | 55 | // returns 56 | ``` 57 | 58 | ## About 59 | 60 | A simple set of Ethereum JS utilties, mainly for frontend dApps. 61 | 62 | ## Available Methods 63 | 64 | ``` 65 | getBinarySize 66 | intToBuffer 67 | intToHex 68 | 69 | padToEven 70 | isHexPrefixed 71 | isHexString 72 | stripHexPrefix 73 | addHexPrefix 74 | 75 | getKeys 76 | arrayContainsArray 77 | 78 | fromAscii 79 | fromUtf8 80 | toAscii 81 | toUtf8 82 | ``` 83 | 84 | ## Contributing 85 | 86 | Please help better the ecosystem by submitting issues and pull requests to default. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard and the unix philosophy. 87 | 88 | ## Guides 89 | 90 | You'll find more detailed information on using `ethjs-util` and tailoring it to your needs in our guides: 91 | 92 | - [User guide](docs/user-guide.md) - Usage, configuration, FAQ and complementary tools. 93 | - [Developer guide](docs/developer-guide.md) - Contributing to `ethjs-util` and writing your own code and coverage. 94 | 95 | ## Help out 96 | 97 | There is always a lot of work to do, and will have many rules to maintain. So please help out in any way that you can: 98 | 99 | - Create, enhance, and debug ethjs rules (see our guide to ["Working on rules"](./github/CONTRIBUTING.md)). 100 | - Improve documentation. 101 | - Chime in on any open issue or pull request. 102 | - Open new issues about your ideas for making `ethjs-util` better, and pull requests to show us how your idea works. 103 | - Add new tests to *absolutely anything*. 104 | - Create or contribute to ecosystem tools, like modules for encoding or contracts. 105 | - Spread the word. 106 | 107 | Please consult our [Code of Conduct](CODE_OF_CONDUCT.md) docs before helping out. 108 | 109 | We communicate via [issues](https://github.com/ethjs/ethjs-util/issues) and [pull requests](https://github.com/ethjs/ethjs-util/pulls). 110 | 111 | ## Important documents 112 | 113 | - [Changelog](CHANGELOG.md) 114 | - [Code of Conduct](CODE_OF_CONDUCT.md) 115 | - [License](https://raw.githubusercontent.com/ethjs/ethjs-util/master/LICENSE) 116 | 117 | ## Licence 118 | 119 | This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md. 120 | 121 | ``` 122 | The MIT License 123 | 124 | Copyright (c) 2016 Nick Dodson. nickdodson.com 125 | 126 | Permission is hereby granted, free of charge, to any person obtaining a copy 127 | of this software and associated documentation files (the "Software"), to deal 128 | in the Software without restriction, including without limitation the rights 129 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 130 | copies of the Software, and to permit persons to whom the Software is 131 | furnished to do so, subject to the following conditions: 132 | 133 | The above copyright notice and this permission notice shall be included in 134 | all copies or substantial portions of the Software. 135 | 136 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 137 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 138 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 139 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 140 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 141 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 142 | THE SOFTWARE. 143 | ``` 144 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const isHexPrefixed = require('is-hex-prefixed'); 2 | const stripHexPrefix = require('strip-hex-prefix'); 3 | 4 | /** 5 | * Pads a `String` to have an even length 6 | * @param {String} value 7 | * @return {String} output 8 | */ 9 | function padToEven(value) { 10 | var a = value; // eslint-disable-line 11 | 12 | if (typeof a !== 'string') { 13 | throw new Error(`[ethjs-util] while padding to even, value must be string, is currently ${typeof a}, while padToEven.`); 14 | } 15 | 16 | if (a.length % 2) { 17 | a = `0${a}`; 18 | } 19 | 20 | return a; 21 | } 22 | 23 | /** 24 | * Converts a `Number` into a hex `String` 25 | * @param {Number} i 26 | * @return {String} 27 | */ 28 | function intToHex(i) { 29 | var hex = i.toString(16); // eslint-disable-line 30 | 31 | return `0x${hex}`; 32 | } 33 | 34 | /** 35 | * Converts an `Number` to a `Buffer` 36 | * @param {Number} i 37 | * @return {Buffer} 38 | */ 39 | function intToBuffer(i) { 40 | const hex = intToHex(i); 41 | 42 | return new Buffer(padToEven(hex.slice(2)), 'hex'); 43 | } 44 | 45 | /** 46 | * Get the binary size of a string 47 | * @param {String} str 48 | * @return {Number} 49 | */ 50 | function getBinarySize(str) { 51 | if (typeof str !== 'string') { 52 | throw new Error(`[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '${typeof str}'.`); 53 | } 54 | 55 | return Buffer.byteLength(str, 'utf8'); 56 | } 57 | 58 | /** 59 | * Returns TRUE if the first specified array contains all elements 60 | * from the second one. FALSE otherwise. 61 | * 62 | * @param {array} superset 63 | * @param {array} subset 64 | * 65 | * @returns {boolean} 66 | */ 67 | function arrayContainsArray(superset, subset, some) { 68 | if (Array.isArray(superset) !== true) { throw new Error(`[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '${typeof superset}'`); } 69 | if (Array.isArray(subset) !== true) { throw new Error(`[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '${typeof subset}'`); } 70 | 71 | return subset[Boolean(some) && 'some' || 'every']((value) => (superset.indexOf(value) >= 0)); 72 | } 73 | 74 | /** 75 | * Should be called to get utf8 from it's hex representation 76 | * 77 | * @method toUtf8 78 | * @param {String} string in hex 79 | * @returns {String} ascii string representation of hex value 80 | */ 81 | function toUtf8(hex) { 82 | const bufferValue = new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g, '')), 'hex'); 83 | 84 | return bufferValue.toString('utf8'); 85 | } 86 | 87 | /** 88 | * Should be called to get ascii from it's hex representation 89 | * 90 | * @method toAscii 91 | * @param {String} string in hex 92 | * @returns {String} ascii string representation of hex value 93 | */ 94 | function toAscii(hex) { 95 | var str = ''; // eslint-disable-line 96 | var i = 0, l = hex.length; // eslint-disable-line 97 | 98 | if (hex.substring(0, 2) === '0x') { 99 | i = 2; 100 | } 101 | 102 | for (; i < l; i += 2) { 103 | const code = parseInt(hex.substr(i, 2), 16); 104 | str += String.fromCharCode(code); 105 | } 106 | 107 | return str; 108 | } 109 | 110 | /** 111 | * Should be called to get hex representation (prefixed by 0x) of utf8 string 112 | * 113 | * @method fromUtf8 114 | * @param {String} string 115 | * @param {Number} optional padding 116 | * @returns {String} hex representation of input string 117 | */ 118 | function fromUtf8(stringValue) { 119 | const str = new Buffer(stringValue, 'utf8'); 120 | 121 | return `0x${padToEven(str.toString('hex')).replace(/^0+|0+$/g, '')}`; 122 | } 123 | 124 | /** 125 | * Should be called to get hex representation (prefixed by 0x) of ascii string 126 | * 127 | * @method fromAscii 128 | * @param {String} string 129 | * @param {Number} optional padding 130 | * @returns {String} hex representation of input string 131 | */ 132 | function fromAscii(stringValue) { 133 | var hex = ''; // eslint-disable-line 134 | for(var i = 0; i < stringValue.length; i++) { // eslint-disable-line 135 | const code = stringValue.charCodeAt(i); 136 | const n = code.toString(16); 137 | hex += n.length < 2 ? `0${n}` : n; 138 | } 139 | 140 | return `0x${hex}`; 141 | } 142 | 143 | /** 144 | * getKeys([{a: 1, b: 2}, {a: 3, b: 4}], 'a') => [1, 3] 145 | * 146 | * @method getKeys get specific key from inner object array of objects 147 | * @param {String} params 148 | * @param {String} key 149 | * @param {Boolean} allowEmpty 150 | * @returns {Array} output just a simple array of output keys 151 | */ 152 | function getKeys(params, key, allowEmpty) { 153 | if (!Array.isArray(params)) { throw new Error(`[ethjs-util] method getKeys expecting type Array as 'params' input, got '${typeof params}'`); } 154 | if (typeof key !== 'string') { throw new Error(`[ethjs-util] method getKeys expecting type String for input 'key' got '${typeof key}'.`); } 155 | 156 | var result = []; // eslint-disable-line 157 | 158 | for (var i = 0; i < params.length; i++) { // eslint-disable-line 159 | var value = params[i][key]; // eslint-disable-line 160 | if (allowEmpty && !value) { 161 | value = ''; 162 | } else if (typeof(value) !== 'string') { 163 | throw new Error('invalid abi'); 164 | } 165 | result.push(value); 166 | } 167 | 168 | return result; 169 | } 170 | 171 | /** 172 | * Is the string a hex string. 173 | * 174 | * @method check if string is hex string of specific length 175 | * @param {String} value 176 | * @param {Number} length 177 | * @returns {Boolean} output the string is a hex string 178 | */ 179 | function isHexString(value, length) { 180 | if (typeof(value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) { 181 | return false; 182 | } 183 | 184 | if (length && value.length !== 2 + 2 * length) { return false; } 185 | 186 | return true; 187 | } 188 | 189 | module.exports = { 190 | arrayContainsArray, 191 | intToBuffer, 192 | getBinarySize, 193 | isHexPrefixed, 194 | stripHexPrefix, 195 | padToEven, 196 | intToHex, 197 | fromAscii, 198 | fromUtf8, 199 | toAscii, 200 | toUtf8, 201 | getKeys, 202 | isHexString, 203 | }; 204 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "ethjs-util", 3 | "_id": "ethjs-util@0.1.4", 4 | "_inBundle": false, 5 | "_integrity": "sha1-HItoeSV0RO9NPz+7rC3tEs2ZfZM=", 6 | "_location": "/ethjs-util", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "ethjs-util", 12 | "name": "ethjs-util", 13 | "escapedName": "ethjs-util", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.4.tgz", 23 | "_shasum": "1c8b6879257444ef4d3f3fbbac2ded12cd997d93", 24 | "_spec": "ethjs-util", 25 | "_where": "/home/nick", 26 | "authors": [ 27 | "Nick Dodson " 28 | ], 29 | "babel": { 30 | "plugins": [ 31 | [ 32 | "transform-es2015-template-literals", 33 | { 34 | "loose": true 35 | } 36 | ], 37 | "transform-es2015-literals", 38 | "transform-es2015-function-name", 39 | "transform-es2015-arrow-functions", 40 | "transform-es2015-block-scoped-functions", 41 | [ 42 | "transform-es2015-classes", 43 | { 44 | "loose": true 45 | } 46 | ], 47 | "transform-es2015-object-super", 48 | "transform-es2015-shorthand-properties", 49 | [ 50 | "transform-es2015-computed-properties", 51 | { 52 | "loose": true 53 | } 54 | ], 55 | [ 56 | "transform-es2015-for-of", 57 | { 58 | "loose": true 59 | } 60 | ], 61 | "transform-es2015-sticky-regex", 62 | "transform-es2015-unicode-regex", 63 | "check-es2015-constants", 64 | [ 65 | "transform-es2015-spread", 66 | { 67 | "loose": true 68 | } 69 | ], 70 | "transform-es2015-parameters", 71 | [ 72 | "transform-es2015-destructuring", 73 | { 74 | "loose": true 75 | } 76 | ], 77 | "transform-es2015-block-scoping", 78 | "transform-object-rest-spread", 79 | "transform-es3-member-expression-literals", 80 | "transform-es3-property-literals" 81 | ], 82 | "env": { 83 | "commonjs": { 84 | "plugins": [ 85 | [ 86 | "transform-es2015-modules-commonjs", 87 | { 88 | "loose": true 89 | } 90 | ] 91 | ] 92 | } 93 | } 94 | }, 95 | "bugs": { 96 | "url": "https://github.com/ethjs/ethjs-util/issues" 97 | }, 98 | "bundleDependencies": false, 99 | "contributors": [ 100 | { 101 | "name": "Richard Moore", 102 | "email": "me@ricmoo.com", 103 | "url": "https://ethers.io" 104 | } 105 | ], 106 | "dependencies": { 107 | "is-hex-prefixed": "1.0.0", 108 | "strip-hex-prefix": "1.0.0" 109 | }, 110 | "deprecated": false, 111 | "description": "A simple set of Ethereum JS utilties.", 112 | "devDependencies": { 113 | "babel-cli": "6.18.0", 114 | "babel-core": "6.18.2", 115 | "babel-eslint": "7.1.0", 116 | "babel-loader": "6.2.8", 117 | "babel-plugin-check-es2015-constants": "6.8.0", 118 | "babel-plugin-transform-es2015-arrow-functions": "6.8.0", 119 | "babel-plugin-transform-es2015-block-scoped-functions": "6.8.0", 120 | "babel-plugin-transform-es2015-block-scoping": "6.18.0", 121 | "babel-plugin-transform-es2015-classes": "6.18.0", 122 | "babel-plugin-transform-es2015-computed-properties": "6.8.0", 123 | "babel-plugin-transform-es2015-destructuring": "6.19.0", 124 | "babel-plugin-transform-es2015-for-of": "6.18.0", 125 | "babel-plugin-transform-es2015-function-name": "6.9.0", 126 | "babel-plugin-transform-es2015-literals": "6.8.0", 127 | "babel-plugin-transform-es2015-modules-commonjs": "6.18.0", 128 | "babel-plugin-transform-es2015-object-super": "6.8.0", 129 | "babel-plugin-transform-es2015-parameters": "6.18.0", 130 | "babel-plugin-transform-es2015-shorthand-properties": "6.18.0", 131 | "babel-plugin-transform-es2015-spread": "6.8.0", 132 | "babel-plugin-transform-es2015-sticky-regex": "6.8.0", 133 | "babel-plugin-transform-es2015-template-literals": "6.8.0", 134 | "babel-plugin-transform-es2015-unicode-regex": "6.11.0", 135 | "babel-plugin-transform-es3-member-expression-literals": "6.5.0", 136 | "babel-plugin-transform-es3-property-literals": "6.5.0", 137 | "babel-plugin-transform-object-rest-spread": "6.19.0", 138 | "babel-register": "6.18.0", 139 | "bignumber.js": "3.0.1", 140 | "bn.js": "4.11.6", 141 | "chai": "3.5.0", 142 | "check-es3-syntax-cli": "0.1.3", 143 | "coveralls": "2.11.9", 144 | "cross-env": "1.0.7", 145 | "eslint": "2.10.1", 146 | "eslint-config-airbnb": "9.0.1", 147 | "eslint-import-resolver-webpack": "0.2.4", 148 | "eslint-plugin-import": "1.8.0", 149 | "eslint-plugin-jsx-a11y": "1.2.0", 150 | "eslint-plugin-react": "5.1.1", 151 | "eventsource-polyfill": "0.9.6", 152 | "istanbul": "0.4.5", 153 | "json-loader": "0.5.4", 154 | "lint-staged": "1.0.1", 155 | "mocha": "3.1.2", 156 | "pre-commit": "1.1.3", 157 | "rimraf": "2.3.4", 158 | "webpack": "2.1.0-beta.15" 159 | }, 160 | "engines": { 161 | "node": ">=6.5.0", 162 | "npm": ">=3" 163 | }, 164 | "eslintConfig": { 165 | "parser": "babel-eslint", 166 | "extends": "airbnb", 167 | "env": { 168 | "node": true, 169 | "mocha": true, 170 | "es6": true 171 | }, 172 | "parserOptions": { 173 | "ecmaVersion": 6, 174 | "sourceType": "module" 175 | }, 176 | "rules": { 177 | "import/no-unresolved": 2, 178 | "comma-dangle": [ 179 | 2, 180 | "always-multiline" 181 | ], 182 | "indent": [ 183 | 2, 184 | 2, 185 | { 186 | "SwitchCase": 1 187 | } 188 | ], 189 | "no-console": 1, 190 | "max-len": 0, 191 | "prefer-template": 2, 192 | "no-use-before-define": 0, 193 | "newline-per-chained-call": 0, 194 | "arrow-body-style": [ 195 | 2, 196 | "as-needed" 197 | ] 198 | } 199 | }, 200 | "files": [ 201 | "dist", 202 | "internals", 203 | "lib", 204 | "src" 205 | ], 206 | "homepage": "https://github.com/ethjs/ethjs-util#readme", 207 | "keywords": [ 208 | "ethereum", 209 | "rpc", 210 | "formatter", 211 | "format", 212 | "ethereum", 213 | "encoding", 214 | "decoding" 215 | ], 216 | "license": "MIT", 217 | "lint-staged": { 218 | "lint:eslint": "*.js" 219 | }, 220 | "main": "lib/index.js", 221 | "name": "ethjs-util", 222 | "pre-commit": "build", 223 | "repository": { 224 | "type": "git", 225 | "url": "git+ssh://git@github.com/ethjs/ethjs-util.git" 226 | }, 227 | "scripts": { 228 | "build": "npm run build:commonjs && npm run test:lib && npm run build:umd && npm run build:umd:min", 229 | "build:clean": "npm run test:clean && rimraf ./dist", 230 | "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --copy-files", 231 | "build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", 232 | "build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", 233 | "coveralls": "npm run test-travis && cat ./coverage/lcov.info | coveralls", 234 | "lint": "npm run lint:js", 235 | "lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern **/**.min.js", 236 | "lint:js": "npm run lint:eslint -- . ", 237 | "lint:staged": "lint-staged", 238 | "prebuild": "npm run build:clean && npm run test", 239 | "prepublish": "npm run build", 240 | "pretest": "npm run lint", 241 | "release": "npmpub", 242 | "start": "npm test", 243 | "test": "mocha ./src/tests/**/*.js -R spec --timeout 2000000", 244 | "test-travis": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- src/tests/**/*.js -R spec --timeout 2000000", 245 | "test:clean": "rimraf ./coverage", 246 | "test:lib": "mocha ./lib/tests/**/*.js -R spec --timeout 2000000" 247 | }, 248 | "version": "0.1.4" 249 | } 250 | -------------------------------------------------------------------------------- /src/tests/test.index.js: -------------------------------------------------------------------------------- 1 | const util = require('../index.js'); 2 | const assert = require('chai').assert; 3 | const BN = require('bn.js'); 4 | 5 | describe('check all exports', () => { 6 | it('should have all exports available', () => { 7 | const expected = ['arrayContainsArray', 8 | 'toBuffer', 9 | 'intToBuffer', 10 | 'getBinarySize', 11 | 'stripHexPrefix', 12 | 'isHexPrefixed', 13 | 'padToEven', 14 | 'intToHex', 15 | 'fromAscii', 16 | 'fromUtf8', 17 | 'toAscii', 18 | 'getKeys', 19 | 'isHexString', 20 | 'toUtf8']; 21 | 22 | Object.keys(util).forEach((utilKey) => { 23 | assert.equal(expected.includes(utilKey), true, utilKey); 24 | }); 25 | }); 26 | 27 | it('should convert intToHex', () => { 28 | assert.equal(util.intToHex(new BN(0)), '0x0'); 29 | }); 30 | 31 | it('should throw when invalid abi', () => { 32 | assert.throws(() => util.getKeys([], 3289), Error); 33 | }); 34 | 35 | it('should detect invalid length hex string', () => { 36 | assert.equal(util.isHexString('0x0', 2), false); 37 | }); 38 | 39 | it('should stripHexPrefix strip prefix of valid strings', () => { 40 | assert.equal(util.stripHexPrefix('0xkdsfksfdkj'), 'kdsfksfdkj'); 41 | assert.equal(util.stripHexPrefix('0xksfdkj'), 'ksfdkj'); 42 | assert.equal(util.stripHexPrefix('0xkdsfdkj'), 'kdsfdkj'); 43 | assert.equal(util.stripHexPrefix('0x23442sfdkj'), '23442sfdkj'); 44 | assert.equal(util.stripHexPrefix('0xkdssdfssfdkj'), 'kdssdfssfdkj'); 45 | assert.equal(util.stripHexPrefix('0xaaaasfdkj'), 'aaaasfdkj'); 46 | assert.equal(util.stripHexPrefix('0xkdsdfsfsdfsdfsdfdkj'), 'kdsdfsfsdfsdfsdfdkj'); 47 | assert.equal(util.stripHexPrefix('0x111dssdddj'), '111dssdddj'); 48 | }); 49 | 50 | it('should stripHexPrefix strip prefix of mix hexed strings', () => { 51 | assert.equal(util.stripHexPrefix('0xkdsfksfdkj'), 'kdsfksfdkj'); 52 | assert.equal(util.stripHexPrefix('ksfdkj'), 'ksfdkj'); 53 | assert.equal(util.stripHexPrefix('kdsfdkj'), 'kdsfdkj'); 54 | assert.equal(util.stripHexPrefix('23442sfdkj'), '23442sfdkj'); 55 | assert.equal(util.stripHexPrefix('0xkdssdfssfdkj'), 'kdssdfssfdkj'); 56 | assert.equal(util.stripHexPrefix('aaaasfdkj'), 'aaaasfdkj'); 57 | assert.equal(util.stripHexPrefix('kdsdfsfsdfsdfsdfdkj'), 'kdsdfsfsdfsdfsdfdkj'); 58 | assert.equal(util.stripHexPrefix('111dssdddj'), '111dssdddj'); 59 | }); 60 | 61 | it('should stripHexPrefix bypass if not string', () => { 62 | assert.equal(util.stripHexPrefix(null), null); 63 | assert.equal(util.stripHexPrefix(undefined), undefined); 64 | assert.equal(util.stripHexPrefix(242423), 242423); 65 | assert.deepEqual(util.stripHexPrefix({}), {}); 66 | assert.deepEqual(util.stripHexPrefix([]), []); 67 | assert.equal(util.stripHexPrefix(true), true); 68 | }); 69 | 70 | it('valid padToEven should pad to even', () => { 71 | assert.equal(String(util.padToEven('0')).length % 2, 0); 72 | assert.equal(String(util.padToEven('111')).length % 2, 0); 73 | assert.equal(String(util.padToEven('22222')).length % 2, 0); 74 | assert.equal(String(util.padToEven('ddd')).length % 2, 0); 75 | assert.equal(String(util.padToEven('aa')).length % 2, 0); 76 | assert.equal(String(util.padToEven('aaaaaa')).length % 2, 0); 77 | assert.equal(String(util.padToEven('sdssd')).length % 2, 0); 78 | assert.equal(String(util.padToEven('eee')).length % 2, 0); 79 | assert.equal(String(util.padToEven('w')).length % 2, 0); 80 | }); 81 | 82 | it('valid padToEven should pad to even check string prefix 0', () => { 83 | assert.equal(String(util.padToEven('0')), '00'); 84 | assert.equal(String(util.padToEven('111')), '0111'); 85 | assert.equal(String(util.padToEven('22222')), '022222'); 86 | assert.equal(String(util.padToEven('ddd')), '0ddd'); 87 | assert.equal(String(util.padToEven('aa')), 'aa'); 88 | assert.equal(String(util.padToEven('aaaaaa')), 'aaaaaa'); 89 | assert.equal(String(util.padToEven('sdssd')), '0sdssd'); 90 | assert.equal(String(util.padToEven('eee')), '0eee'); 91 | assert.equal(String(util.padToEven('w')), '0w'); 92 | }); 93 | 94 | it('should padToEven throw as expected string got null', () => { 95 | try { 96 | util.padToEven(null); 97 | } catch (error) { 98 | assert.equal(typeof error, 'object'); 99 | } 100 | }); 101 | 102 | it('should padToEven throw as expected string got undefined', () => { 103 | try { 104 | util.padToEven(undefined); 105 | } catch (error) { 106 | assert.equal(typeof error, 'object'); 107 | } 108 | }); 109 | 110 | it('should padToEven throw as expected string got {}', () => { 111 | try { 112 | util.padToEven({}); 113 | } catch (error) { 114 | assert.equal(typeof error, 'object'); 115 | } 116 | }); 117 | 118 | it('should padToEven throw as expected string got new Buffer()', () => { 119 | try { 120 | util.padToEven(new Buffer()); 121 | } catch (error) { 122 | assert.equal(typeof error, 'object'); 123 | } 124 | }); 125 | 126 | it('should padToEven throw as expected string got number', () => { 127 | try { 128 | util.padToEven(24423232); 129 | } catch (error) { 130 | assert.equal(typeof error, 'object'); 131 | } 132 | }); 133 | 134 | it('method getKeys should throw as expected array for params got number', () => { 135 | try { 136 | util.getKeys(2482822); 137 | } catch (error) { 138 | assert.equal(typeof error, 'object'); 139 | } 140 | }); 141 | 142 | it('method invalid getKeys with allow empty and no defined value', () => { 143 | try { 144 | util.getKeys([{ type: undefined }], 'type', true); 145 | } catch (error) { 146 | assert.equal(typeof error, 'object'); 147 | } 148 | }); 149 | 150 | it('method valid getKeys with allow empty and false', () => { 151 | try { 152 | util.getKeys([{ type: true }], 'type', true); 153 | } catch (error) { 154 | assert.equal(typeof error, 'object'); 155 | } 156 | }); 157 | 158 | it('method getKeys should throw as expected array for params got number', () => { 159 | try { 160 | util.getKeys(2482822, 293849824); 161 | } catch (error) { 162 | assert.equal(typeof error, 'object'); 163 | } 164 | }); 165 | 166 | it('method getKeys should throw as expected array for params got object', () => { 167 | try { 168 | util.getKeys({}, []); 169 | } catch (error) { 170 | assert.equal(typeof error, 'object'); 171 | } 172 | }); 173 | 174 | it('method getKeys should throw as expected array for params got null', () => { 175 | try { 176 | util.getKeys(null); 177 | } catch (error) { 178 | assert.equal(typeof error, 'object'); 179 | } 180 | }); 181 | 182 | it('method getKeys should throw as expected array for params got false', () => { 183 | try { 184 | util.getKeys(false); 185 | } catch (error) { 186 | assert.equal(typeof error, 'object'); 187 | } 188 | }); 189 | 190 | it('valid getKeys should get keys from object in array', () => { 191 | assert.deepEqual(util.getKeys([{ type: 'sfd' }, { type: 'something' }], 'type'), ['sfd', 'something']); 192 | assert.deepEqual(util.getKeys([{ cool: 'something' }, { cool: 'fdsdfsfd' }], 'cool'), ['something', 'fdsdfsfd']); 193 | assert.deepEqual(util.getKeys([{ type: '234424' }, { type: '243234242432' }], 'type'), ['234424', '243234242432']); 194 | assert.deepEqual(util.getKeys([{ type: 'something' }, { type: 'something' }], 'type'), ['something', 'something']); 195 | assert.deepEqual(util.getKeys([{ type: 'something' }], 'type'), ['something']); 196 | assert.deepEqual(util.getKeys([], 'type'), []); 197 | assert.deepEqual(util.getKeys([{ type: 'something' }, { type: 'something' }, { type: 'something' }], 'type'), ['something', 'something', 'something']); 198 | }); 199 | 200 | it('valid isHexString tests', () => { 201 | assert.equal(util.isHexString('0x0e026d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 202 | assert.equal(util.isHexString('0x1e026d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 203 | assert.equal(util.isHexString('0x6e026d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 204 | assert.equal(util.isHexString('0xecfaa1a0c4372a2ac5cca1e164510ec8df04f681fc960797f1419802ec00b225'), true); 205 | assert.equal(util.isHexString('0x6e0e6d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 206 | assert.equal(util.isHexString('0x620e6d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 207 | assert.equal(util.isHexString('0x1e0e6d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 208 | assert.equal(util.isHexString('0x2e0e6d45820d91356fc73d7ff2bdef353ebfe7e9'), true); 209 | assert.equal(util.isHexString('0x220c96d48733a847570c2f0b40daa8793b3ae875b26a4ead1f0f9cead05c3863'), true); 210 | assert.equal(util.isHexString('0x2bb303f0ae65c64ef80a3bb3ee8ceef5d50065bd'), true); 211 | assert.equal(util.isHexString('0x6e026d45820d91256fc73d7ff2bdef353ebfe7e9'), true); 212 | }); 213 | 214 | it('invalid isHexString tests', () => { 215 | assert.equal(util.isHexString(' 0x0e026d45820d91356fc73d7ff2bdef353ebfe7e9'), false); 216 | assert.equal(util.isHexString('fdsjfsd'), false); 217 | assert.equal(util.isHexString(' 0xfdsjfsd'), false); 218 | assert.equal(util.isHexString('0xfds*jfsd'), false); 219 | assert.equal(util.isHexString('0xfds$jfsd'), false); 220 | assert.equal(util.isHexString('0xf@dsjfsd'), false); 221 | assert.equal(util.isHexString('0xfdsjf!sd'), false); 222 | assert.equal(util.isHexString('fds@@jfsd'), false); 223 | assert.equal(util.isHexString(24223), false); 224 | assert.equal(util.isHexString(null), false); 225 | assert.equal(util.isHexString(undefined), false); 226 | assert.equal(util.isHexString(false), false); 227 | assert.equal(util.isHexString({}), false); 228 | assert.equal(util.isHexString([]), false); 229 | }); 230 | 231 | it('valid arrayContainsArray should array contain every array', () => { 232 | assert.equal(util.arrayContainsArray([1, 2, 3], [1, 2]), true); 233 | assert.equal(util.arrayContainsArray([3, 3], [3, 3]), true); 234 | assert.equal(util.arrayContainsArray([1, 2, 'h'], [1, 2, 'h']), true); 235 | assert.equal(util.arrayContainsArray([1, 2, 'fsffds'], [1, 2, 'fsffds']), true); 236 | assert.equal(util.arrayContainsArray([1], [1]), true); 237 | assert.equal(util.arrayContainsArray([], []), true); 238 | assert.equal(util.arrayContainsArray([1, 3333], [1, 3333]), true); 239 | }); 240 | 241 | it('valid getBinarySize should get binary size of string', () => { 242 | assert.equal(util.getBinarySize('0x0e026d45820d91356fc73d7ff2bdef353ebfe7e9'), 42); 243 | assert.equal(util.getBinarySize('0x220c96d48733a847570c2f0b40daa8793b3ae875b26a4ead1f0f9cead05c3863'), 66); 244 | }); 245 | 246 | it('invalid getBinarySize should throw invalid type Boolean', () => { 247 | try { 248 | util.getBinarySize(false); 249 | } catch (error) { 250 | assert.equal(typeof error, 'object'); 251 | } 252 | }); 253 | 254 | it('invalid getBinarySize should throw invalid type object', () => { 255 | try { 256 | util.getBinarySize({}); 257 | } catch (error) { 258 | assert.equal(typeof error, 'object'); 259 | } 260 | }); 261 | 262 | it('invalid getBinarySize should throw invalid type Array', () => { 263 | try { 264 | util.getBinarySize([]); 265 | } catch (error) { 266 | assert.equal(typeof error, 'object'); 267 | } 268 | }); 269 | 270 | it('valid arrayContainsArray should array some every array', () => { 271 | assert.equal(util.arrayContainsArray([1, 2], [1], true), true); 272 | assert.equal(util.arrayContainsArray([3, 3], [3, 2323], true), true); 273 | assert.equal(util.arrayContainsArray([1, 2, 'h'], [2332, 2, 'h'], true), true); 274 | assert.equal(util.arrayContainsArray([1, 2, 'fsffds'], [3232, 2, 'fsffds'], true), true); 275 | assert.equal(util.arrayContainsArray([1], [1], true), true); 276 | assert.equal(util.arrayContainsArray([1, 3333], [1, 323232], true), true); 277 | }); 278 | 279 | it('method arrayContainsArray should throw as expected array for params got false', () => { 280 | try { 281 | util.arrayContainsArray(false); 282 | } catch (error) { 283 | assert.equal(typeof error, 'object'); 284 | } 285 | }); 286 | 287 | it('method arrayContainsArray should throw as expected array for params got false', () => { 288 | try { 289 | util.arrayContainsArray([], false); 290 | } catch (error) { 291 | assert.equal(typeof error, 'object'); 292 | } 293 | }); 294 | 295 | it('method arrayContainsArray should throw as expected array for params got {}', () => { 296 | try { 297 | util.arrayContainsArray({}, false); 298 | } catch (error) { 299 | assert.equal(typeof error, 'object'); 300 | } 301 | }); 302 | 303 | const fromAsciiTests = [ 304 | { value: 'myString', expected: '0x6d79537472696e67' }, 305 | { value: 'myString\x00', expected: '0x6d79537472696e6700' }, 306 | { value: '\u0003\u0000\u0000\u00005èÆÕL]\u0012|Î¾ž\u001a7«›\u00052\u0011(ЗY\n<\u0010\u0000\u0000\u0000\u0000\u0000\u0000e!ßd/ñõì\f:z¦Î¦±ç·÷Í¢Ëß\u00076*…\bŽ—ñžùC1ÉUÀé2\u001aӆBŒ', 307 | expected: '0x0300000035e8c6d54c5d127c9dcebe9e1a37ab9b05321128d097590a3c100000000000006521df642ff1f5ec0c3a7aa6cea6b1e7b7f7cda2cbdf07362a85088e97f19ef94331c955c0e9321ad386428c' }, 308 | ]; 309 | 310 | describe('fromAscii', () => { 311 | fromAsciiTests.forEach((test) => { 312 | it(`should turn ${test.value} to ${test.expected} `, () => { 313 | assert.strictEqual(util.fromAscii(test.value), test.expected); 314 | }); 315 | }); 316 | }); 317 | 318 | const fromUtf8Tests = [ 319 | { value: 'myString', expected: '0x6d79537472696e67' }, 320 | { value: 'myString\x00', expected: '0x6d79537472696e67' }, 321 | { value: 'expected value\u0000\u0000\u0000', expected: '0x65787065637465642076616c7565' }, 322 | ]; 323 | 324 | describe('fromUtf8', () => { 325 | fromUtf8Tests.forEach((test) => { 326 | it(`should turn ${test.value} to ${test.expected} `, () => { 327 | assert.strictEqual(util.fromUtf8(test.value), test.expected); 328 | }); 329 | }); 330 | }); 331 | 332 | const toUtf8Tests = [ 333 | { value: '0x6d79537472696e67', expected: 'myString' }, 334 | { value: '0x6d79537472696e6700', expected: 'myString' }, 335 | { value: '0x65787065637465642076616c7565000000000000000000000000000000000000', expected: 'expected value' }, 336 | ]; 337 | 338 | describe('toUtf8', () => { 339 | toUtf8Tests.forEach((test) => { 340 | it(`should turn ${test.value} to ${test.expected} `, () => { 341 | assert.strictEqual(util.toUtf8(test.value), test.expected); 342 | }); 343 | }); 344 | }); 345 | 346 | const toAsciiTests = [ 347 | { value: '0x6d79537472696e67', expected: 'myString' }, 348 | { value: '0x6d79537472696e6700', expected: 'myString\u0000' }, 349 | { value: '0x0300000035e8c6d54c5d127c9dcebe9e1a37ab9b05321128d097590a3c100000000000006521df642ff1f5ec0c3a7aa6cea6b1e7b7f7cda2cbdf07362a85088e97f19ef94331c955c0e9321ad386428c', 350 | expected: '\u0003\u0000\u0000\u00005èÆÕL]\u0012|Î¾ž\u001a7«›\u00052\u0011(ЗY\n<\u0010\u0000\u0000\u0000\u0000\u0000\u0000e!ßd/ñõì\f:z¦Î¦±ç·÷Í¢Ëß\u00076*…\bŽ—ñžùC1ÉUÀé2\u001aӆBŒ' }, 351 | ]; 352 | 353 | describe('toAsciiTests', () => { 354 | toAsciiTests.forEach((test) => { 355 | it(`should turn ${test.value} to ${test.expected} `, () => { 356 | assert.strictEqual(util.toAscii(test.value), test.expected); 357 | }); 358 | }); 359 | }); 360 | 361 | describe('intToHex', () => { 362 | it('should convert a int to hex', () => { 363 | const i = 6003400; 364 | const hex = util.intToHex(i); 365 | assert.equal(hex, '0x5b9ac8'); 366 | }); 367 | }); 368 | 369 | describe('intToBuffer', () => { 370 | it('should convert a int to a buffer', () => { 371 | const i = 6003400; 372 | const buf = util.intToBuffer(i); 373 | assert.equal(buf.toString('hex'), '5b9ac8'); 374 | }); 375 | 376 | it('should convert a int to a buffer for odd length hex values', () => { 377 | const i = 1; 378 | const buf = util.intToBuffer(i); 379 | assert.equal(buf.toString('hex'), '01'); 380 | }); 381 | }); 382 | }); 383 | -------------------------------------------------------------------------------- /dist/ethjs-util.min.js: -------------------------------------------------------------------------------- 1 | !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("ethUtil",[],r):"object"==typeof exports?exports.ethUtil=r():t.ethUtil=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}var e={};return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,r,e){Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=3)}([function(t,r,e){"use strict";(function(t,n){function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(r,e){if(o()t)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return s(r),r>0&&void 0!==e?"string"==typeof n?f(t,r).fill(e,n):f(t,r).fill(e):f(t,r)}function h(r,e){if(s(e),r=f(r,0>e?0:0|y(e)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;e>n;++n)r[n]=0;return r}function c(r,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|d(e,n);r=f(r,i);var o=r.write(e,n);return o!==i&&(r=r.slice(0,o)),r}function p(t,r){var e=0>r.length?0:0|y(r.length);t=f(t,e);for(var n=0;e>n;n+=1)t[n]=255&r[n];return t}function l(r,e,n,i){if(0>n||n>e.byteLength)throw new RangeError("'offset' is out of bounds");if(n+(i||0)>e.byteLength)throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i),t.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=t.prototype):r=p(r,e),r}function g(r,e){if(t.isBuffer(e)){var n=0|y(e.length);return r=f(r,n),0===r.length?r:(e.copy(r,0,0,n),r)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||Z(e.length)?f(r,0):p(r,e);if("Buffer"===e.type&&W(e.data))return p(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function w(r){return+r!=r&&(r=0),t.alloc(+r)}function d(r,e){if(t.isBuffer(r))return r.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;"string"!=typeof r&&(r=""+r);var n=r.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(r).length;default:if(i)return K(r).length;e=(""+e).toLowerCase(),i=!0}}function v(t,r,e){var n=!1;if((void 0===r||0>r)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),0>=e)return"";if(e>>>=0,r>>>=0,r>=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,r,e);case"utf8":case"utf-8":return S(this,r,e);case"ascii":return Y(this,r,e);case"latin1":case"binary":return I(this,r,e);case"base64":return U(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function A(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function E(r,e,n,i,o){if(0===r.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:r.length-1),0>n&&(n=r.length+n),r.length>n){if(0>n){if(!o)return-1;n=0}}else{if(o)return-1;n=r.length-1}if("string"==typeof e&&(e=t.from(e,i)),t.isBuffer(e))return 0===e.length?-1:b(r,e,n,i,o);if("number"==typeof e)return e=255&e,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(r,e,n):Uint8Array.prototype.lastIndexOf.call(r,e,n):b(r,[e],n,i,o);throw new TypeError("val must be string, number or Buffer")}function b(t,r,e,n,i){function o(t,r){return 1===f?t[r]:t.readUInt16BE(r*f)}var f=1,u=t.length,s=r.length;if(void 0!==n&&(n=(n+"").toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(2>t.length||2>r.length)return-1;f=2,u/=2,s/=2,e/=2}var a;if(i){var h=-1;for(a=e;u>a;a++)if(o(t,a)===o(r,h===-1?0:a-h)){if(h===-1&&(h=a),a-h+1===s)return h*f}else h!==-1&&(a-=a-h),h=-1}else for(e+s>u&&(e=u-s),a=e;a>=0;a--){for(var c=!0,p=0;s>p;p++)if(o(t,a+p)!==o(r,p)){c=!1;break}if(c)return a}return-1}function m(t,r,e,n){e=+e||0;var i=t.length-e;n?(n=+n,n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var f=0;n>f;++f){var u=parseInt(r.substr(2*f,2),16);if(isNaN(u))return f;t[e+f]=u}return f}function R(t,r,e,n){return J(K(r,t.length-e),t,e,n)}function _(t,r,e,n){return J($(r),t,e,n)}function P(t,r,e,n){return _(t,r,e,n)}function T(t,r,e,n){return J(X(r),t,e,n)}function B(t,r,e,n){return J(V(r,t.length-e),t,e,n)}function U(t,r,e){return G.fromByteArray(0===r&&e===t.length?t:t.slice(r,e))}function S(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;e>i;){var o=t[i],f=null,u=o>239?4:o>223?3:o>191?2:1;if(e>=i+u){var s,a,h,c;switch(u){case 1:128>o&&(f=o);break;case 2:s=t[i+1],128===(192&s)&&(c=(31&o)<<6|63&s,c>127&&(f=c));break;case 3:s=t[i+1],a=t[i+2],128===(192&s)&&128===(192&a)&&(c=(15&o)<<12|(63&s)<<6|63&a,c>2047&&(55296>c||c>57343)&&(f=c));break;case 4:s=t[i+1],a=t[i+2],h=t[i+3],128===(192&s)&&128===(192&a)&&128===(192&h)&&(c=(15&o)<<18|(63&s)<<12|(63&a)<<6|63&h,c>65535&&1114112>c&&(f=c))}}null===f?(f=65533,u=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=u}return x(n)}function x(t){var r=t.length;if(tt>=r)return String.fromCharCode.apply(String,t);for(var e="",n=0;r>n;)e+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return e}function Y(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;e>i;++i)n+=String.fromCharCode(127&t[i]);return n}function I(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;e>i;++i)n+=String.fromCharCode(t[i]);return n}function C(t,r,e){var n=t.length;r&&r>=0||(r=0),(!e||0>e||e>n)&&(e=n);for(var i="",o=r;e>o;++o)i+=q(t[o]);return i}function O(t,r,e){for(var n=t.slice(r,e),i="",o=0;n.length>o;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,r,e){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function M(r,e,n,i,o,f){if(!t.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||f>e)throw new RangeError('"value" argument is out of bounds');if(n+i>r.length)throw new RangeError("Index out of range")}function D(t,r,e,n){0>r&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);o>i;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,r,e,n){0>r&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);o>i;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function k(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(0>e)throw new RangeError("Index out of range")}function N(t,r,e,n,i){return i||k(t,r,e,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(t,r,e,n,23,4),e+4}function z(t,r,e,n,i){return i||k(t,r,e,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(t,r,e,n,52,8),e+8}function F(t){if(t=H(t).replace(rt,""),2>t.length)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return 16>t?"0"+t.toString(16):t.toString(16)}function K(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],f=0;n>f;++f){if(e=t.charCodeAt(f),e>55295&&57344>e){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(56320>e){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,128>e){if((r-=1)<0)break;o.push(e)}else if(2048>e){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(65536>e){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(e>=1114112)throw Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function $(t){for(var r=[],e=0;t.length>e;++e)r.push(255&t.charCodeAt(e));return r}function V(t,r){for(var e,n,i,o=[],f=0;t.length>f&&(r-=2)>=0;++f)e=t.charCodeAt(f),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function X(t){return G.toByteArray(F(t))}function J(t,r,e,n){for(var i=0;n>i&&(i+eo;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return i>n?-1:n>i?1:0},t.isEncoding=function(t){switch((t+"").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!0;default:return!1}},t.concat=function(r,e){if(!W(r))throw new TypeError('"list" argument must be an Array of Buffers');if(0===r.length)return t.alloc(0);var n;if(void 0===e)for(e=0,n=0;r.length>n;++n)e+=r[n].length;var i=t.allocUnsafe(e),o=0;for(n=0;r.length>n;++n){var f=r[n];if(!t.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(i,o),o+=f.length}return i},t.byteLength=d,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;t>r;r+=2)A(this,r,r+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;t>r;r+=4)A(this,r,r+3),A(this,r+1,r+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;t>r;r+=8)A(this,r,r+7),A(this,r+1,r+6),A(this,r+2,r+5),A(this,r+3,r+4);return this},t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):v.apply(this,arguments)},t.prototype.equals=function(r){if(!t.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r||0===t.compare(this,r)},t.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},t.prototype.compare=function(r,e,n,i,o){if(!t.isBuffer(r))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=r?r.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),0>e||n>r.length||0>i||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var f=o-i,u=n-e,s=Math.min(f,u),a=this.slice(i,o),h=r.slice(e,n),c=0;s>c;++c)if(a[c]!==h[c]){f=a[c],u=h[c];break}return u>f?-1:f>u?1:0},t.prototype.includes=function(t,r,e){return this.indexOf(t,r,e)!==-1},t.prototype.indexOf=function(t,r,e){return E(this,t,r,e,!0)},t.prototype.lastIndexOf=function(t,r,e){return E(this,t,r,e,!1)},t.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r=0|r,isFinite(e)?(e=0|e,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(0>e||0>r)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,r,e);case"utf8":case"utf-8":return R(this,t,r,e);case"ascii":return _(this,t,r,e);case"latin1":case"binary":return P(this,t,r,e);case"base64":return T(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(r,e){var n=this.length;r=~~r,e=void 0===e?n:~~e,0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),r>e&&(e=r);var i;if(t.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=t.prototype;else{var o=e-r;i=new t(o,(void 0));for(var f=0;o>f;++f)i[f]=this[f+r]}return i},t.prototype.readUIntLE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=this[t],i=1,o=0;++o0&&(i*=256);)n+=this[t+--r]*i;return n},t.prototype.readUInt8=function(t,r){return r||L(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,r){return r||L(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,r){return r||L(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,r){return r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,r){return r||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=this[t],i=1,o=0;++on||(n-=Math.pow(2,8*r)),n},t.prototype.readIntBE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,i>o||(o-=Math.pow(2,8*r)),o},t.prototype.readInt8=function(t,r){return r||L(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,r){r||L(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},t.prototype.readInt16BE=function(t,r){r||L(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},t.prototype.readInt32LE=function(t,r){return r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,r){return r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,r){return r||L(t,4,this.length),Q.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,r){return r||L(t,4,this.length),Q.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,r){return r||L(t,8,this.length),Q.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,r){return r||L(t,8,this.length),Q.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=0|r,e=0|e,!n){var i=Math.pow(2,8*e)-1;M(this,t,r,e,i,0)}var o=1,f=0;for(this[r]=255&t;++f=0&&(f*=256);)this[r+o]=t/f&255;return r+e},t.prototype.writeUInt8=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,1,255,0),t.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=255&r,e+1},t.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8):D(this,r,e,!0),e+2},t.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=255&r):D(this,r,e,!1),e+2},t.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=255&r):j(this,r,e,!0),e+4},t.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=255&r):j(this,r,e,!1),e+4},t.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);M(this,t,r,e,i-1,-i)}var o=0,f=1,u=0;for(this[r]=255&t;++ot&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},t.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);M(this,t,r,e,i-1,-i)}var o=e-1,f=1,u=0;for(this[r+o]=255&t;--o>=0&&(f*=256);)0>t&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},t.prototype.writeInt8=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,1,127,-128),t.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),0>r&&(r=255+r+1),this[e]=255&r,e+1},t.prototype.writeInt16LE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8):D(this,r,e,!0),e+2},t.prototype.writeInt16BE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=255&r):D(this,r,e,!1),e+2},t.prototype.writeInt32LE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):j(this,r,e,!0),e+4},t.prototype.writeInt32BE=function(r,e,n){return r=+r,e=0|e,n||M(this,r,e,4,2147483647,-2147483648),0>r&&(r=4294967295+r+1),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=255&r):j(this,r,e,!1),e+4},t.prototype.writeFloatLE=function(t,r,e){return N(this,t,r,!0,e)},t.prototype.writeFloatBE=function(t,r,e){return N(this,t,r,!1,e)},t.prototype.writeDoubleLE=function(t,r,e){return z(this,t,r,!0,e)},t.prototype.writeDoubleBE=function(t,r,e){return z(this,t,r,!1,e)},t.prototype.copy=function(r,e,n,i){if(n||(n=0),i||0===i||(i=this.length),r.length>e||(e=r.length),e||(e=0),i>0&&n>i&&(i=n),i===n)return 0;if(0===r.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),i-n>r.length-e&&(i=r.length-e+n);var o,f=i-n;if(this===r&&e>n&&i>e)for(o=f-1;o>=0;--o)r[o+e]=this[o+n];else if(1e3>f||!t.TYPED_ARRAY_SUPPORT)for(o=0;f>o;++o)r[o+e]=this[o+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+f),e);return f},t.prototype.fill=function(r,e,n,i){if("string"==typeof r){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===r.length){var o=r.charCodeAt(0);256>o&&(r=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof r&&(r=255&r);if(0>e||e>this.length||n>this.length)throw new RangeError("Out of range index");if(e>=n)return this;e>>>=0,n=void 0===n?this.length:n>>>0,r||(r=0);var f;if("number"==typeof r)for(f=e;n>f;++f)this[f]=r;else{var u=t.isBuffer(r)?r:K(""+new t(r,i)),s=u.length;for(f=0;n-e>f;++f)this[f+e]=u[f%s]}return this};var rt=/[^+\/0-9A-Za-z-_]/g}).call(r,e(0).Buffer,e(7))},function(t,r){t.exports=function(t){if("string"!=typeof t)throw Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(t,r,e){var n=e(1);t.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},function(t,r,e){"use strict";(function(r){function n(t){var r=t;if("string"!=typeof r)throw Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof r+", while padToEven.");return r.length%2&&(r="0"+r),r}function i(t){var r=t.toString(16);return"0x"+r}function o(t){var e=i(t);return new r(n(e.slice(2)),"hex")}function f(t){if("string"!=typeof t)throw Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return r.byteLength(t,"utf8")}function u(t,r,e){if(Array.isArray(t)!==!0)throw Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(Array.isArray(r)!==!0)throw Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof r+"'");return r[!!e&&"some"||"every"](function(r){return t.indexOf(r)>=0})}function s(t){var e=new r(n(y(t).replace(/^0+|0+$/g,"")),"hex");return e.toString("utf8")}function a(t){var r="",e=0,n=t.length;for("0x"===t.substring(0,2)&&(e=2);n>e;e+=2){var i=parseInt(t.substr(e,2),16);r+=String.fromCharCode(i)}return r}function h(t){var e=new r(t,"utf8");return"0x"+n(e.toString("hex")).replace(/^0+|0+$/g,"")}function c(t){for(var r="",e=0;t.length>e;e++){var n=t.charCodeAt(e),i=n.toString(16);r+=2>i.length?"0"+i:i}return"0x"+r}function p(t,r,e){if(!Array.isArray(t))throw Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof t+"'");if("string"!=typeof r)throw Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof r+"'.");for(var n=[],i=0;t.length>i;i++){var o=t[i][r];if(e&&!o)o="";else if("string"!=typeof o)throw Error("invalid abi");n.push(o)}return n}function l(t,r){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!r||t.length===2+2*r)}var g=e(1),y=e(2);t.exports={arrayContainsArray:u,intToBuffer:o,getBinarySize:f,isHexPrefixed:g,stripHexPrefix:y,padToEven:n,intToHex:i,fromAscii:c,fromUtf8:h,toAscii:a,toUtf8:s,getKeys:p,isHexString:l}}).call(r,e(0).Buffer)},function(t,r){"use strict";function e(t){var r=t.length;if(r%4>0)throw Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");e===-1&&(e=r);var n=e===r?0:4-e%4;return[e,n]}function n(t){var r=e(t),n=r[0],i=r[1];return 3*(n+i)/4-i}function i(t,r,e){return 3*(r+e)/4-e}function o(t){for(var r,n=e(t),o=n[0],f=n[1],u=new c(i(t,o,f)),s=0,a=f>0?o-4:o,p=0;a>p;p+=4)r=h[t.charCodeAt(p)]<<18|h[t.charCodeAt(p+1)]<<12|h[t.charCodeAt(p+2)]<<6|h[t.charCodeAt(p+3)],u[s++]=r>>16&255,u[s++]=r>>8&255,u[s++]=255&r;return 2===f&&(r=h[t.charCodeAt(p)]<<2|h[t.charCodeAt(p+1)]>>4,u[s++]=255&r),1===f&&(r=h[t.charCodeAt(p)]<<10|h[t.charCodeAt(p+1)]<<4|h[t.charCodeAt(p+2)]>>2,u[s++]=r>>8&255,u[s++]=255&r),u}function f(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function u(t,r,e){for(var n,i=[],o=r;e>o;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(f(n));return i.join("")}function s(t){for(var r,e=t.length,n=e%3,i=[],o=16383,f=0,s=e-n;s>f;f+=o)i.push(u(t,f,f+o>s?s:f+o));return 1===n?(r=t[e-1],i.push(a[r>>2]+a[r<<4&63]+"==")):2===n&&(r=(t[e-2]<<8)+t[e-1],i.push(a[r>>10]+a[r>>4&63]+a[r<<2&63]+"=")),i.join("")}r.byteLength=n,r.toByteArray=o,r.fromByteArray=s;for(var a=[],h=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,g=p.length;g>l;++l)a[l]=p[l],h[p.charCodeAt(l)]=l;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,i){var o,f,u=8*i-n-1,s=(1<>1,h=-7,c=e?i-1:0,p=e?-1:1,l=t[r+c];for(c+=p,o=l&(1<<-h)-1,l>>=-h,h+=u;h>0;o=256*o+t[r+c],c+=p,h-=8);for(f=o&(1<<-h)-1,o>>=-h,h+=n;h>0;f=256*f+t[r+c],c+=p,h-=8);if(0===o)o=1-a;else{if(o===s)return f?NaN:(l?-1:1)*(1/0);f+=Math.pow(2,n),o-=a}return(l?-1:1)*f*Math.pow(2,o-n)},r.write=function(t,r,e,n,i,o){var f,u,s,a=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,g=n?1:-1,y=0>r||0===r&&0>1/r?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,f=h):(f=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-f))<1&&(f--,s*=2),r+=1>f+c?p*Math.pow(2,1-c):p/s,2>r*s||(f++,s/=2),h>f+c?1>f+c?(u=r*Math.pow(2,c-1)*Math.pow(2,i),f=0):(u=(r*s-1)*Math.pow(2,i),f+=c):(u=0,f=h));i>=8;t[e+l]=255&u,l+=g,u/=256,i-=8);for(f=f<0;t[e+l]=255&f,l+=g,f/=256,a-=8);t[e+l-g]|=128*y}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(n){"object"==typeof window&&(e=window)}t.exports=e}])}); -------------------------------------------------------------------------------- /dist/ethjs-util.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ethjs-util.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap f41b664e569a4a4e8d04","webpack:///./~/buffer/index.js","webpack:///./~/is-hex-prefixed/src/index.js","webpack:///./~/strip-hex-prefix/src/index.js","webpack:///lib/index.js","webpack:///./~/base64-js/index.js","webpack:///./~/ieee754/index.js","webpack:///./~/isarray/index.js","webpack:///(webpack)/buildin/global.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ethUtil\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ethUtil\"] = factory();\n\telse\n\t\troot[\"ethUtil\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmory imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmory exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tObject.defineProperty(exports, name, {\n \t\t\tconfigurable: false,\n \t\t\tenumerable: true,\n \t\t\tget: getter\n \t\t});\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f41b664e569a4a4e8d04","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/buffer/index.js\n// module id = 0\n// module chunks = 0","/**\n * Returns a `Boolean` on whether or not the a `String` starts with '0x'\n * @param {String} str the string input value\n * @return {Boolean} a boolean if it is or is not hex prefixed\n * @throws if the str input is not a string\n */\nmodule.exports = function isHexPrefixed(str) {\n if (typeof str !== 'string') {\n throw new Error(\"[is-hex-prefixed] value must be type 'string', is currently type \" + (typeof str) + \", while checking isHexPrefixed.\");\n }\n\n return str.slice(0, 2) === '0x';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/is-hex-prefixed/src/index.js\n// module id = 1\n// module chunks = 0","var isHexPrefixed = require('is-hex-prefixed');\n\n/**\n * Removes '0x' from a given `String` is present\n * @param {String} str the string value\n * @return {String|Optional} a string by pass if necessary\n */\nmodule.exports = function stripHexPrefix(str) {\n if (typeof str !== 'string') {\n return str;\n }\n\n return isHexPrefixed(str) ? str.slice(2) : str;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/strip-hex-prefix/src/index.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nvar isHexPrefixed = require('is-hex-prefixed');\nvar stripHexPrefix = require('strip-hex-prefix');\n\n/**\n * Pads a `String` to have an even length\n * @param {String} value\n * @return {String} output\n */\nfunction padToEven(value) {\n var a = value; // eslint-disable-line\n\n if (typeof a !== 'string') {\n throw new Error('[ethjs-util] while padding to even, value must be string, is currently ' + typeof a + ', while padToEven.');\n }\n\n if (a.length % 2) {\n a = '0' + a;\n }\n\n return a;\n}\n\n/**\n * Converts a `Number` into a hex `String`\n * @param {Number} i\n * @return {String}\n */\nfunction intToHex(i) {\n var hex = i.toString(16); // eslint-disable-line\n\n return '0x' + hex;\n}\n\n/**\n * Converts an `Number` to a `Buffer`\n * @param {Number} i\n * @return {Buffer}\n */\nfunction intToBuffer(i) {\n var hex = intToHex(i);\n\n return new Buffer(padToEven(hex.slice(2)), 'hex');\n}\n\n/**\n * Get the binary size of a string\n * @param {String} str\n * @return {Number}\n */\nfunction getBinarySize(str) {\n if (typeof str !== 'string') {\n throw new Error('[ethjs-util] while getting binary size, method getBinarySize requires input \\'str\\' to be type String, got \\'' + typeof str + '\\'.');\n }\n\n return Buffer.byteLength(str, 'utf8');\n}\n\n/**\n * Returns TRUE if the first specified array contains all elements\n * from the second one. FALSE otherwise.\n *\n * @param {array} superset\n * @param {array} subset\n *\n * @returns {boolean}\n */\nfunction arrayContainsArray(superset, subset, some) {\n if (Array.isArray(superset) !== true) {\n throw new Error('[ethjs-util] method arrayContainsArray requires input \\'superset\\' to be an array got type \\'' + typeof superset + '\\'');\n }\n if (Array.isArray(subset) !== true) {\n throw new Error('[ethjs-util] method arrayContainsArray requires input \\'subset\\' to be an array got type \\'' + typeof subset + '\\'');\n }\n\n return subset[Boolean(some) && 'some' || 'every'](function (value) {\n return superset.indexOf(value) >= 0;\n });\n}\n\n/**\n * Should be called to get utf8 from it's hex representation\n *\n * @method toUtf8\n * @param {String} string in hex\n * @returns {String} ascii string representation of hex value\n */\nfunction toUtf8(hex) {\n var bufferValue = new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g, '')), 'hex');\n\n return bufferValue.toString('utf8');\n}\n\n/**\n * Should be called to get ascii from it's hex representation\n *\n * @method toAscii\n * @param {String} string in hex\n * @returns {String} ascii string representation of hex value\n */\nfunction toAscii(hex) {\n var str = ''; // eslint-disable-line\n var i = 0,\n l = hex.length; // eslint-disable-line\n\n if (hex.substring(0, 2) === '0x') {\n i = 2;\n }\n\n for (; i < l; i += 2) {\n var code = parseInt(hex.substr(i, 2), 16);\n str += String.fromCharCode(code);\n }\n\n return str;\n}\n\n/**\n * Should be called to get hex representation (prefixed by 0x) of utf8 string\n *\n * @method fromUtf8\n * @param {String} string\n * @param {Number} optional padding\n * @returns {String} hex representation of input string\n */\nfunction fromUtf8(stringValue) {\n var str = new Buffer(stringValue, 'utf8');\n\n return '0x' + padToEven(str.toString('hex')).replace(/^0+|0+$/g, '');\n}\n\n/**\n * Should be called to get hex representation (prefixed by 0x) of ascii string\n *\n * @method fromAscii\n * @param {String} string\n * @param {Number} optional padding\n * @returns {String} hex representation of input string\n */\nfunction fromAscii(stringValue) {\n var hex = ''; // eslint-disable-line\n for (var i = 0; i < stringValue.length; i++) {\n // eslint-disable-line\n var code = stringValue.charCodeAt(i);\n var n = code.toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return '0x' + hex;\n}\n\n/**\n * getKeys([{a: 1, b: 2}, {a: 3, b: 4}], 'a') => [1, 3]\n *\n * @method getKeys get specific key from inner object array of objects\n * @param {String} params\n * @param {String} key\n * @param {Boolean} allowEmpty\n * @returns {Array} output just a simple array of output keys\n */\nfunction getKeys(params, key, allowEmpty) {\n if (!Array.isArray(params)) {\n throw new Error('[ethjs-util] method getKeys expecting type Array as \\'params\\' input, got \\'' + typeof params + '\\'');\n }\n if (typeof key !== 'string') {\n throw new Error('[ethjs-util] method getKeys expecting type String for input \\'key\\' got \\'' + typeof key + '\\'.');\n }\n\n var result = []; // eslint-disable-line\n\n for (var i = 0; i < params.length; i++) {\n // eslint-disable-line\n var value = params[i][key]; // eslint-disable-line\n if (allowEmpty && !value) {\n value = '';\n } else if (typeof value !== 'string') {\n throw new Error('invalid abi');\n }\n result.push(value);\n }\n\n return result;\n}\n\n/**\n * Is the string a hex string.\n *\n * @method check if string is hex string of specific length\n * @param {String} value\n * @param {Number} length\n * @returns {Boolean} output the string is a hex string\n */\nfunction isHexString(value, length) {\n if (typeof value !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n\n return true;\n}\n\nmodule.exports = {\n arrayContainsArray: arrayContainsArray,\n intToBuffer: intToBuffer,\n getBinarySize: getBinarySize,\n isHexPrefixed: isHexPrefixed,\n stripHexPrefix: stripHexPrefix,\n padToEven: padToEven,\n intToHex: intToHex,\n fromAscii: fromAscii,\n fromUtf8: fromUtf8,\n toAscii: toAscii,\n toUtf8: toUtf8,\n getKeys: getKeys,\n isHexString: isHexString\n};\n\n\n// WEBPACK FOOTER //\n// lib/index.js","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-js/index.js\n// module id = 4\n// module chunks = 0","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ieee754/index.js\n// module id = 5\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 6\n// module chunks = 0","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() { return this; })();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AC9vDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA;;;;;;;;AC7MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnFA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;","sourceRoot":""} --------------------------------------------------------------------------------