diff --git a/LICENSE b/LICENSE
index 3b49e068..d838e1e1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2015 Eric Martindale
+Copyright (c) 2016 Eric Martindale
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index be393126..3ef721ef 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,8 @@ Maki
==============
[](https://travis-ci.org/martindale/maki)
[](https://coveralls.io/r/martindale/maki)
-[](https://community.ericmartindale.com/)
+
+[](https://chat.maki.io/)
The complete stack for building extensible apps, faster than ever. Hand-roll your application by telling Maki what your application does, and it takes care of the rest – without getting in your way if you want to customize it.
diff --git a/components/404.jade b/components/404.jade
new file mode 100644
index 00000000..78d5f02a
--- /dev/null
+++ b/components/404.jade
@@ -0,0 +1,17 @@
+dom-module#maki-undefined
+ template
+ .ui.text.container
+ h1 Nothing known.
+ p We're sorry, but we don't know anything about that. Here are some alternative resources you might be interested in.
+
+ .ui.horizontal.segments
+ .ui.segment
+ p One
+ .ui.segment
+ p Two
+ .ui.segment
+ p Two
+ script.
+ Polymer({
+ is: 'maki-undefined'
+ });
diff --git a/components/application.jade b/components/application.jade
new file mode 100644
index 00000000..0c95a7be
--- /dev/null
+++ b/components/application.jade
@@ -0,0 +1,169 @@
+dom-module#maki-application
+ style.
+ #navigation {
+ width: 100%;
+ }
+
+ template
+ maki-datastore(name="#{config.service.namespace}")
+ maki-channel(autoconnect, reconnect="true")
+
+ .pusher
+ .ui.inverted.vertical.center.aligned.segment
+ .ui.container
+ maki-navbar
+
+ .content(for="viewport")
+ maki-index
+
+ .ui.inverted.vertical.footer.segment
+ .ui.container
+ .ui.stackable.inverted.divided.equal.height.stackable.grid
+ .six.wide.column
+ h4.ui.inverted.header About
+ p This website is powered by Maki, a full-stack framework that implements strong-typing at the network level. You can see and engage with the auto-generated API to learn more.
+ p Maki is a labor of love, a result of several years of iterations and re-architectures in pursuit of a clean, hand-rolled framework for building clean, useful applications. We hope you like it.
+ //-.ui.inverted.link.list
+ a.item(href="#") Protocol
+ a.item(href="#") Whitepaper
+ a.item(href="#") Roadmap
+ a.item(href="#") Contact Us
+ .seven.wide.column
+ h4.ui.inverted.header Copyleft
+ p #{config.service.name} has not supplied a LICENSE file in config/index.json.
+ p Maki is copyleft, and encourages you to copy, clone, and create. After all, without a rich public domain, how else can we innovate? Much to our chagrin, the software itself is more formally MIT licensed, while our content is licensed under CC-BY.
+ .three.wide.column
+ h4.ui.inverted.header Elsewhere
+ .ui.inverted.link.list
+ a.item(href="https://github.com/martindale/maki", rel="me")
+ i.icon.github
+ | GitHub
+ a.item(href="https://twitter.com/martindale", rel="me")
+ i.icon.twitter
+ | Twitter
+ a.item(href="https://facebook.com/eric.martindale", rel="me")
+ i.icon.facebook
+ | Facebook
+ //-a.item(href="#", rel="me")
+ i.icon.medium
+ | Medium
+
+ script(src="/js/page.min.js", async)
+ script(src="/js/jquery.js", async)
+ script.
+ window.maki = Polymer({
+ is: 'maki-application',
+ properties: {
+ src: {
+ type: String
+ },
+ for: {
+ type: String
+ },
+ route: {
+ type: String
+ },
+ routes: {
+ type: Object,
+ value: {}
+ },
+ components: {
+ type: Object,
+ value: {}
+ },
+ resources: {
+ type: Object,
+ observer: '_resourcesUpdated'
+ },
+ datastore: {
+ type: Object
+ },
+ identity: {
+ type: Object
+ },
+ worker: { type: Object }
+ },
+ _route: function(ctx) {
+ var self = this;
+
+ var component = 'maki-undefined';
+ for (var route in self.routes) {
+ var regex = self.routes[route];
+ var viewport = document.querySelectorAll('[for=viewport]')[0];
+
+ console.log('[MAKI:APPLICATION]', 'testing', regex, 'against', ctx.path);
+
+ if (regex.test(ctx.path)) {
+ console.log('[MAKI:APPLICATION]', 'picking', route, 'from', ctx.path);
+ component = self.components[route];
+ view = document.createElement(component);
+ view.type = self.resourceMap[route];
+ view.type.route = route;
+ break;
+ }
+ }
+
+ console.log('[MAKI:APPLICATION]', 'settled on rendering:', view.type.route, view);
+ //console.log('[MAKI:APPLICATION]', 'type.static:', view.type.static);
+ //console.log('[MAKI:APPLICATION]', 'setting and appending...');
+
+ view.setAttribute('src', ctx.path);
+
+ while (viewport.hasChildNodes()) {
+ viewport.removeChild(viewport.lastChild);
+ }
+ viewport.appendChild(view);
+ },
+ _resourcesUpdated: function(resources) {
+ var self = this;
+ var _route = self._route.bind(self);
+
+ self.resourceMap = {};
+
+ console.log('[MAKI:APPLICATION]', '_resourcesUpdated', resources);
+
+ var order = ['Person', 'Post', 'Index'];
+ Object.keys(resources).forEach(function(name) {
+ var resource = resources[name];
+ console.log('[MAKI:APPLICATION]', 'initializing', name);
+ ['get', 'query'].forEach(function(action) {
+ console.log('[MAKI:APPLICATION]', 'looking for', action, 'in', resource.routes);
+ var route = resource.routes[action];
+ if (!route) return;
+
+ console.log('[MAKI:APPLICATION]', 'components are:', resource.components);
+
+ self.routes[route] = new RegExp(eval(resource.paths[action]));
+ self.components[route] = resource.components[action];
+ self.resourceMap[route] = resource;
+ page(route, _route);
+ });
+ });
+
+ self.routes['/'] = new RegExp(/^\/$/);
+ self.components['/'] = (resources.Index && resources.Index.components) ? resources.Index.components.query : 'maki-index';
+
+ page('/', _route);
+ page('*', _route);
+
+ page();
+ },
+ created: function() {
+ var self = this;
+
+ self.route = window.location.pathname;
+ //self.worker = new Worker('/worker.js');
+
+ $.ajax({
+ type: 'OPTIONS',
+ url: '/',
+ headers: {
+ 'Accept': 'application/json'
+ },
+ success: function(data) {
+ self.config = data.config;
+ self.resources = data.resources;
+ }
+ });
+ }
+ });
diff --git a/components/channel.jade b/components/channel.jade
new file mode 100644
index 00000000..8b302c22
--- /dev/null
+++ b/components/channel.jade
@@ -0,0 +1,127 @@
+dom-module#maki-channel
+ script(src="/js/uuid.js", async)
+ script(src="/js/jsonrpc.js", async)
+ script.
+ Polymer({
+ is: 'maki-channel',
+ properties: {
+ namespace: {
+ type: String
+ },
+ autoconnect: {
+ type: Boolean
+ },
+ reconnect: {
+ type: Boolean
+ },
+ subscriptions: {
+ type: Array
+ },
+ ws: {
+ type: Object
+ },
+ src: {
+ type: String
+ },
+ },
+ _send: function(method, params) {
+ var self = this;
+ self.ws.send(JSON.stringify({
+ 'jsonrpc': '2.0',
+ 'method': method,
+ 'params': params,
+ 'id': uuid.v4() // TODO: sequence?
+ }));
+ },
+ _subscribe: function(path) {
+ console.log('[MAKI:CHANNEL]', 'subscribing to:', path);
+ var self = this;
+ self._send('subscribe', {
+ channel: path
+ });
+ },
+ _consume: function() {
+ var self = this;
+ var elements = document.querySelectorAll('[src]');
+
+ console.log('[MAKI:CHANNEL]', '_consume', elements);
+
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ self._subscribe(element.src);
+ }
+ },
+ _handleMessage: function(msg) {
+ var self = this;
+ console.log('[MAKI:CHANNEL]', '_handleMessage', msg);
+
+ try {
+ var data = JSON.parse( msg.data );
+ } catch (e) {
+ var data = {};
+ }
+
+ console.log('[MAKI:CHANNEL]', '_handleMessage', 'resulting data:', data);
+
+ // experimental JSON-RPC implementation
+ if (data.jsonrpc === '2.0') {
+ console.log('[MAKI:CHANNEL]', '_handleMessage', 'valid jsonrpc!');
+
+ switch (data.method) {
+ case 'ping':
+ console.log('[MAKI:CHANNEL]', 'received ping. playing pong...');
+ self.ws.send(JSON.stringify({
+ 'jsonrpc': '2.0',
+ 'result': 'pong',
+ 'id': data.id
+ }));
+ break;
+ case 'patch':
+ // TODO: update in-memory data (two-way binding);
+ console.log('[MAKI:CHANNEL]', 'received `patch` event:', data.params.channel , data );
+ var channel = data.params.channel;
+ var ops = data.params.ops;
+ var datastore = document.querySelector('maki-datastore[name='+self.namespace+']');
+ var manager = document.querySelector('maki-peer-manager');
+
+ datastore._patch(channel, ops);
+ manager._relay(data);
+
+ break;
+ default:
+ console.error('[MAKI:CHANNEL]', 'unhandled jsonrpc method ' , data.method);
+ break;
+ }
+ } else {
+
+ }
+ },
+ _connect: function() {
+ var self = this;
+ var maki = document.querySelector('maki-application');
+ var protocol = (document.location.protocol === 'http:') ? 'ws://' : 'wss://';
+ var path = protocol + document.location.host; // + self.src;
+
+ console.log('[MAKI:CHANNEL]', 'websocket connecting to: ', path);
+
+ self.ws = new WebSocket(path);
+ self.ws.onclose = function onClose() {
+ if (self.reconnect === true) {
+ setTimeout(function() {
+ self._connect();
+ }, 500);
+ }
+ }
+ self.ws.onmessage = self._handleMessage.bind(self);
+ self.ws.onopen = function onOpen() {
+ console.log('[MAKI:CHANNEL]', 'websocket open.');
+ }
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:CHANNEL]', 'ready');
+ if (self.autoconnect === true) {
+ self._connect();
+ }
+ },
+ });
diff --git a/components/collection.jade b/components/collection.jade
new file mode 100644
index 00000000..efdb6067
--- /dev/null
+++ b/components/collection.jade
@@ -0,0 +1,91 @@
+dom-module#maki-collection
+ template
+ .ui.vertical.segment
+ .ui.container
+ h2
+ //-template(if$="{{type.options.icon}}")
+ i(class$="ui icon {{type.options.icon}}")
+ a(href="/{{type.names.query}}") {{type.plural}}
+ p {{type.description}}
+ code
+ pre {{resource}}
+
+ .ui.five.cards
+ template(is="dom-repeat", items="{{items}}")
+ .ui.card
+ template(if="{{item.image}}")
+ .image
+ img(src="/img/maki-logo.png")
+ .content
+ a.header(href="/{{type.names.query}}/{{item.slug}}") {{item.name}} {{item.username}}
+ p.description {{item.description}}
+ template(if="{{item.action}}")
+ a.ui.bottom.attached.button(if="{{item.action}}", href="{{item.action.href}}") {{item.action.text}}
+ //-maki-item(src="/people/{{item.id}}", item="{{item}}")
+
+ script.
+ Polymer({
+ is: 'maki-collection',
+ listeners: {
+ 'datastore:query': '_handleQuery',
+ 'state:change': '_applyState'
+ },
+ properties: {
+ src: {
+ type: String,
+ observer: '_sourceChanged'
+ },
+ type: {
+ type: Object
+ },
+ items: {
+ type: Array,
+ notify: true
+ },
+ },
+ _handleQuery: function(e, key) {
+ var self = this;
+ var datastore = document.querySelectorAll('maki-datastore')[0];
+ console.log('[MAKI:COLLECTION]','_handleQuery:', e, key);
+ datastore._retrieve(key, function(err, data) {
+ if (!data) self.fire('datastore:miss', key);
+ if (err) {
+ console.error('_handleQuery error:', err);
+ data = [];
+ }
+ self.fire('state:change', data);
+ });
+ },
+ _applyState: function(e) {
+ var self = this;
+ var state = e.detail;
+
+ if (!(state instanceof Array)) {
+ state = [state];
+ }
+
+ self.items = state;
+ },
+ _sourceChanged: function(source) {
+ var self = this;
+ var maki = document.querySelectorAll('maki-application')[0];
+ console.log('[MAKI:COLLECTION]', 'collection sourceChanged:', source);
+ //self.resource = maki.resourceMap[source];
+ self.fire('datastore:query', source);
+ },
+ _sync: function() {
+ var self = this;
+ console.log('[MAKI:COLLECTION]', '_sync');
+ self.fire('datastore:query', self.src);
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:COLLECTION]', 'ready');
+ },
+ attached: function() {
+ var self = this;
+ var channel = document.querySelectorAll('maki-channel')[0];
+ console.log('[MAKI:COLLECTION]', 'collection is attached:', self.src);
+ channel._subscribe(self.src);
+ }
+ });
diff --git a/components/content-store.jade b/components/content-store.jade
new file mode 100644
index 00000000..3781ecc6
--- /dev/null
+++ b/components/content-store.jade
@@ -0,0 +1,25 @@
+dom-module#maki-content-store
+ template
+ maki-crypto-worker
+ //- TODO: replace this with maki-peer-manager
+ maki-key-value(name="fabric")
+ script.
+ Polymer({
+ is: 'maki-content-store',
+ _get: function(key, cb) {
+ var db = document.querySelector('maki-key-value[name=fabric]');
+ db._retrieve(key, cb);
+ },
+ _store: function(doc, cb) {
+ var db = document.querySelector('maki-key-value[name=fabric]');
+ var worker = document.querySelector('maki-crypto-worker');
+ if (typeof doc !== 'string') {
+ doc = JSON.stringify(doc);
+ }
+ worker._digest(doc, function(err, hash) {
+ db._store(hash, doc, function(err) {
+ cb(err, hash);
+ });
+ });
+ }
+ });
diff --git a/components/datastore.jade b/components/datastore.jade
new file mode 100644
index 00000000..f200d8e5
--- /dev/null
+++ b/components/datastore.jade
@@ -0,0 +1,397 @@
+//- maki-datastore
+//- is a top-level manager of data
+//- maps /path to
+dom-module#maki-datastore
+ template
+ maki-crypto-worker(name="datastore")
+ maki-key-value(name="tips", for$="{{name}}")
+ maki-key-value(name$="{{name}}")
+ script(src="/js/json-patch-duplex.min.js")
+ script.
+ Polymer({
+ is: 'maki-datastore',
+ properties: {
+ name: {
+ type: String
+ },
+ for: {
+ type: String
+ },
+ db: {
+ type: Object
+ },
+ fabric: {
+ type: Object
+ },
+ tips: {
+ type: Object
+ },
+ private: {
+ type: Boolean
+ },
+ resources: {
+ type: Object,
+ value: {}
+ }
+ },
+ listeners: {
+ 'datastore:miss': '_handleMiss',
+ 'datastore:change': '_handleChange',
+ 'datastore:patch': '_handlePatch',
+ },
+ _query: function(path, query, opts, cb) {
+ var self = this;
+ var name = self.name;
+ if (typeof opts === 'function') {
+ cb = opts;
+ opts = {};
+ }
+
+ console.log('[MAKI:DATASTORE]', name, '_query', 'incoming:', path, query, opts);
+
+ // TODO: not do this
+ var application = document.querySelector(self.for + '-application');
+ var resource = application._pathToResource(path);
+ console.log('[MAKI:DATASTORE]', name, '_query', 'dat path', path, resource);
+ resource.store.find(query, function(err, docs) {
+ console.log('[MAKI:DATASTORE]',name, '_query', 'dat result', err, docs);
+ cb(err, docs);
+ });
+ },
+ _post: function(path, obj, cb) {
+ // TODO: middlewares
+ var self = this;
+ console.log('[MAKI:DATASTORE]', '_post', '_publish', 'adding', path, obj);
+
+ self.tips._get(path, function(err, tip) {
+ if (err) console.error('[MAKI:DATASTORE]', '_post', 'tip retrieval err:', err);
+ self.db._get(tip, {
+ convert: true
+ }, function(err, collection) {
+ if (err) console.error('[MAKI:DATASTORE]', '_post', 'getTip error:', err);
+ if (!collection) {
+ collection = [];
+ }
+ if (!(collection instanceof Array)) {
+ console.error('[MAKI:DATASTORE]', '_post', 'getTip not collection', collection);
+ return cb('Tip exists, but does not store a collection.');
+ }
+
+ console.log('[MAKI:DATASTORE]', '_post', '_publish', 'getTip results', collection);
+
+ self._put(path + '/' + obj['id'], obj, function(err, doc) {
+ if (err) console.error('[MAKI:DATASTORE]', '_post', '_put', path + '/' + obj['id'], err);
+ // TODO: remove this condition, understand where and why `null`
+ // happens to `doc` sometimes...
+ if (doc) {
+ collection.unshift(doc);
+ }
+
+ console.error('[MAKI:DATASTORE]', '_post', '_publish', 'collection (before):', path, collection);
+
+ collection = collection.map(function(x) {
+ if (x['@id']) {
+ return x['@id'];
+ } else {
+ return x;
+ }
+ });
+ collection = JSON.parse(JSON.stringify(collection));
+
+ console.error('[MAKI:DATASTORE]', '_post', '_publish', 'collection (after):', path, collection);
+
+ self._put(path, collection, function(err) {
+ if (err) console.error('[MAKI:DATASTORE]', '_post', '_publish', 'adding result', err);
+ return cb(err, doc);
+ });
+ });
+ });
+ });
+ },
+ _put: function(path, val, cb) {
+ // TODO: middlewares
+ var self = this;
+ var name = self.name;
+ self._bundle(val, function(err, obj) {
+ if (err) console.error(err);
+ console.log('[MAKI:DATASTORE]', '_put', '_post', '_bundle', '_publish', 'output', obj);
+ if (!obj) console.log('[MAKI:DATASTORE]', '_put', 'grave concern! no obj from bundle', path, val);
+ if (!obj['@id']) console.log('[MAKI:DATASTORE]', '_put', 'grave concern! no @id from bundle', obj);
+
+ /*if (obj['@id'] === val['@id']) {
+ return cb(null, obj);
+ }*/
+
+ self.db._set(obj['@id'], obj, function(err) {
+ if (err) console.error(err);
+ console.log('[MAKI:DATASTORE]', name, '_put', '_publish', 'setting tip...', path, obj['@id']);
+ self.tips._set(path, obj['@id'], function(err) {
+ if (err) console.error(err);
+ console.log('[MAKI:DATASTORE]', name, '_put', '_publish', 'set the tip!', path, obj);
+
+ self._flatten(obj, function(err, doc) {
+ var application = document.querySelector(self.for + '-application');
+ // TODO: not do this. maybe use the `private` property?
+ if (!application) {
+ console.error('[MAKI:DATASTORE]', name, '_put', '_publish', 'could not find application', self.for);
+ self.fire('datastore:change', {
+ path: path,
+ val: obj,
+ old: undefined
+ });
+
+ return cb(err, obj);
+ } else {
+ var resource = application._pathToResource(path);
+
+ resource.store.insert(obj, function(err, result) {
+ if (err) console.error('[MAKI:DATASTORE]', name, '_put', '_publish', 'store.insert:', err);
+
+ self.fire('datastore:change', {
+ path: path,
+ val: obj,
+ old: undefined
+ });
+
+ console.log('[MAKI:DATASTORE]', name, '_put', '_publish', 'shared:', path, obj, result);
+
+ return cb(err, obj);
+ });
+ }
+ });
+ });
+ });
+ });
+ },
+ _update: function(path, query, updates, opts, cb) {
+ var self = this;
+
+ console.log('[MAKI:DATASTORE]', '_update', self.for);
+ console.log('[MAKI:DATASTORE]', '_update', path, query, updates, opts);
+ console.log('[MAKI:DATASTORE]', '_update', 'updates:', updates, 'opts:', opts);
+
+ var application = document.querySelector(self.for + '-application');
+ var resource = application._pathToResource(path);
+ resource.store.update(query, updates, opts, cb);
+ },
+ _upsert: function(path, query, item, cb) {
+ var self = this;
+ self._update(path, query, item, {
+ upsert: true
+ }, function(err, numAffected) {
+ console.log('[MAKI:DATASTORE]', '_upsert end', err, numAffected);
+ cb(err);
+ });
+ },
+ _flatten: function(item, cb) {
+ var self = this;
+ window.traverse(item, function(node, next) {
+ var context = this;
+ if (context.isRoot) return next();
+ var key = context.key;
+ var val = context.parent[key];
+ if (val['@id']) {
+ context.parent[key] = val['@id'];
+ }
+ next();
+ }, function(final) {
+ cb(null, final);
+ });
+ },
+ // HTTP-emulated GET request
+ _get: function(path, cb) {
+ // TODO: middlewares
+ var self = this;
+ var name = self.name;
+ console.log('[MAKI:DATASTORE]', '_get looking for:', path);
+
+ var eventName = 'key-value:'+name+':open';
+ console.log('[MAKI:DATASTORE]', name, '_get', 'waiting for (eventName):', eventName);
+ self.tips._get(path, function(err, tip) {
+ if (err) console.error('[MAKI:DATASTORE]', '_get', path, err);
+
+ console.log('[MAKI:DATASTORE]', name, '_get', path, 'tip is:', tip);
+
+ self.db._get(tip, {
+ convert: true,
+ //hydrate: true
+ }, function(err, obj) {
+ if (err || !obj) {
+ obj = [];
+ }
+
+ console.log('[MAKI:DATASTORE]', name, '_get', 'db.get', 'will traverse:', err, tip, obj);
+ function resolveReferences(node, next) {
+ var context = this;
+ var key = context.key;
+ console.log('[MAKI:DATASTORE]', name, '_get', 'traverse', 'key', key, context, node);
+ if (typeof node !== 'string') return next();
+ if (key === '@id') return next();
+
+ console.log('[MAKI:DATASTORE]', name, '_get', 'traverse', 'populating', key);
+ self.db._get(node, {
+ convert: true
+ }, function(err, item) {
+ if (err) console.error('[MAKI:DATASTORE]', '_get', 'error:', err);
+ if (!item) return next();
+ console.log('[MAKI:DATASTORE]', name, '_get', 'key:', key, 'found:', item);
+ console.log('[MAKI:DATASTORE]', name, '_get', 'key:', key, 'replacing:', key, 'with', item, 'in', context.parent);
+
+ console.log('[MAKI:DATASTORE]', name, '_get', 'key:', key, 'was:', context.parent[key], 'in', context.parent);
+ context.parent[key] = item;
+ console.log('[MAKI:DATASTORE]', name, '_get', 'key:', key, 'now:', context.parent[key]);
+ console.log('[MAKI:DATASTORE]', name, '_get', 'deep diving...', item);
+ // deep dive.
+ window.traverse(item, resolveReferences, function(inner) {
+ if (!inner) return next();
+ console.log('[MAKI:DATASTORE]', name, '_get', 'inner:', inner);
+ next();
+ });
+ });
+ }
+
+ // TODO: make modular
+ window.traverse(obj, resolveReferences, function(final) {
+ console.log('[MAKI:DATASTORE]', '_get', path, 'final:', null, final);
+ return cb(null, final);
+ });
+ });
+ });
+
+ /*self.db._get(key, function(err, val) {
+ if (err) console.error(err);
+ if (val) return cb(null, val) && self.fire('datastore:miss', key);
+ self.fire('datastore:miss', key);
+ return cb('datastore:miss');
+ });*/
+ },
+ _patch: function(key, ops, cb) {
+ // TODO: middlewares
+ var self = this;
+ console.log('[MAKI:DATASTORE]', 'datastore:patch:', key, ops);
+ self._get(key, function(err, obj) {
+ if (err) console.error(err);
+ console.log('[MAKI:DATASTORE]', 'applying to:', obj);
+ jsonpatch.apply(obj, ops);
+ console.log('[MAKI:DATASTORE]', 'obj now:', obj);
+ self._put(key, obj, function(err) {
+ if (err) console.error(err);
+ });
+ });
+ },
+ _bundle: function(obj, cb) {
+ var self = this;
+ console.log('[MAKI:DATASTORE]', '_bundle', '_post', 'pre-parse', obj);
+ obj['@id'] = undefined;
+ console.log('[MAKI:DATASTORE]', '_bundle', '_post', 'post-parse', obj);
+ var worker = document.querySelector('maki-crypto-worker[name=datastore]');
+ worker._digest(obj, function(err, hash) {
+ console.log('[MAKI:DATASTORE]', '_bundle', '_put', '_post', 'post-parse digest:', hash);
+ obj['@id'] = hash;
+ cb(err, obj);
+ });
+ },
+ _handleMiss: function(e, detail) {
+ return;
+ var self = this;
+ var key = e.detail;
+ console.log('[MAKI:DATASTORE]', '_handleMiss', e, detail);
+ if (self.private) return;
+
+ // TODO: query network instead of server
+ $.getJSON(key, function(data) {
+ console.log('[MAKI:DATASTORE]', 'retrieved (from remote)', data);
+ if (!data) return;
+ self._put(key, data, function(err) {
+ if (err) console.error('[MAKI:DATASTORE]', '_handeMiss error:', err);
+ });
+ });
+ },
+ _handlePatch: function(e) {
+ var self = this;
+ console.log('[MAKI:DATASTORE]', '_handlePatch', e.detail);
+ var channel = document.querySelector('maki-channel');
+ channel._send('patch', {
+ channel: e.detail.key,
+ ops: e.detail.patches
+ });
+ },
+ _handleChange: function(e, detail) {
+ var self = this;
+
+ console.log('[MAKI:DATASTORE]', '_handleChange', e, detail);
+ if (!detail) {
+ var detail = e.detail;
+ }
+
+ var path = detail.path;
+ var val = detail.val;
+ var old = detail.old;
+
+ /* if (!old) {
+ if (val instanceof Array) {
+ old = [];
+ } else {
+ old = {};
+ }
+ }
+
+ if (old) {
+ var worker = document.querySelector('maki-crypto-worker');
+ var observer = jsonpatch.observe(old);
+
+ console.log('[MAKI:DATASTORE]', 'extending', old, 'with', val);
+ var now = _.extend(old, val);
+ console.log('[MAKI:DATASTORE]', 'final:', now);
+ var patches = jsonpatch.generate(observer);
+
+ console.log('[MAKI:DATASTORE]', 'patch set generated:', patches);
+
+ var channel = document.querySelectorAll('maki-channel');
+ /*channel._send('patch', {
+ channel: key,
+ ops: [{ op: 'add', }]
+ });****
+ } */
+
+ var pattern = '[src="'+path+'"]';
+ var elements = document.querySelectorAll(pattern);
+ console.log('[MAKI:DATASTORE]', 'elements bound to this key:', path, elements);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ element._sync();
+ }
+ },
+ _sync: function() {
+ var elements = document.querySelectorAll('[src]');
+ console.log('[MAKI:DATASTORE]', '_sync', elements);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ if (typeof element._sync === 'function') {
+ console.log('[MAKI:DATASTORE]', 'syncing', element);
+ element._sync();
+ }
+ }
+ },
+ attached: function() {
+ var self = this;
+ console.log('[MAKI:DATASTORE]', 'attached');
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:DATASTORE]', 'ready');
+ document.addEventListener('key-value:tips:open', function() {
+ self.tips = document.querySelector('maki-key-value[name=tips][for='+self.name+']');
+ });
+ document.addEventListener('key-value:'+self.name+':open', function() {
+ console.log('[MAKI:DATASTORE]', 'key-value open received!');
+ self.db = document.querySelector('maki-key-value[name='+self.name+']');
+
+ self.db.addEventListener('key-value:change', self._handleChange.bind(self));
+
+ self.fire('datastore:'+self.name+':open');
+ self.fire('datastore:open');
+ });
+ //self.listen(self.db, 'key-value:change', '_handleChange');
+ }
+ });
diff --git a/components/examples.jade b/components/examples.jade
new file mode 100644
index 00000000..c4b45282
--- /dev/null
+++ b/components/examples.jade
@@ -0,0 +1,97 @@
+dom-module#maki-examples
+ template
+ .ui.vertical.segment
+ .ui.container
+ h2 Projects Using Maki
+ p We're really excited to have helped many people build awesome things. Here's a few of them, including special highlights when they've also shared their code!
+
+ .ui.icon.message
+ i.icon.lab
+ .content
+ .header Building something cool?
+ p Go ahead and add it to the list! We'd love to highlight what you've built. Bonus points for being open source! 🍺
+
+ .ui.divided.items
+ template(is="dom-repeat", items="{{items}}")
+ .item
+ a.ui.tiny.image(href="{{item.uri}}")
+ template(if="{{item.image}}")
+ img(src="{{item.image}}")
+ template(else="{{item.source}}")
+ img(src="/img/image.png")
+ .content
+ .header
+ a(href="{{item.uri}}") {{item.name}}
+ template(if="{{item.source}}")
+ |
+ a.ui.label(href="{{item.source}}")
+ i.icon.code
+ | Source
+ p.description {{item.description}}
+
+ script.
+ Polymer({
+ is: 'maki-examples',
+ listeners: {
+ 'datastore:query': '_handleQuery',
+ 'state:change': '_applyState'
+ },
+ properties: {
+ src: {
+ type: String,
+ observer: '_sourceChanged'
+ },
+ resource: {
+ type: Object
+ },
+ items: {
+ type: Array,
+ notify: true
+ },
+ },
+ _handleQuery: function(e, key) {
+ var self = this;
+ var datastore = document.querySelectorAll('maki-datastore')[0];
+ console.log('[MAKI:COLLECTION]','_handleQuery:', e, key);
+ datastore._retrieve(key, function(err, data) {
+ if (!data) self.fire('datastore:miss', hash);
+ if (err) {
+ //console.error('_handleQuery error:', err);
+ data = [];
+ }
+ self.fire('state:change', data);
+ });
+ },
+ _applyState: function(e) {
+ var self = this;
+ var state = e.detail;
+
+ if (!(state instanceof Array)) {
+ state = [state];
+ }
+
+ console.log('applying state', e, state);
+ self.items = state;
+ },
+ _sourceChanged: function(source) {
+ var self = this;
+ var maki = document.querySelectorAll('maki-application')[0];
+ console.log('[MAKI:COLLECTION]', 'collection sourceChanged:', source);
+ self.fire('datastore:query', source);
+ },
+ _sync: function() {
+ var self = this;
+ console.log('[MAKI:COLLECTION]', '_sync');
+ self.fire('datastore:query', self.src);
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:COLLECTION]', 'ready');
+ },
+ attached: function() {
+ var self = this;
+ var channel = document.querySelectorAll('maki-channel')[0];
+ console.log('[MAKI:COLLECTION]', 'collection is attached:', self.src);
+ channel._subscribe(self.src);
+ }
+ });
diff --git a/components/identities.jade b/components/identities.jade
new file mode 100644
index 00000000..761ae975
--- /dev/null
+++ b/components/identities.jade
@@ -0,0 +1,128 @@
+dom-module#maki-identities
+ template
+ maki-datastore(name="identity", private)
+ .ui.three.doubling.cards
+ template(is="dom-repeat", items="{{identities}}")
+ .ui.card
+ .image
+ img(src="/img/stevie.jpg")
+ .content
+ .header
+ //- TODO: break into its own component
+ maki-field(path="/name")
+ template(is="dom-if", if="{{item.name}}")
+ .value {{item.name}}
+ template(is="dom-if", if="{{!item.name}}")
+ .value anonymous
+ .ui.two.bottom.attached.buttons
+ template(is="dom-if", if="{{item.name}}")
+ .ui.button(on-tap="_beginEditing") change name
+ template(is="dom-if", if="{{!item.name}}")
+ .ui.bottom.attached.button(on-tap="_beginEditing") set name
+ .ui.button(on-tap="_delete") delete
+ script.
+ Polymer({
+ is: 'maki-identities',
+ properties: {
+ identities: {
+ type: Array
+ }
+ },
+ _handleChange: function(e) {
+ var self = this;
+ if (e.which === 13) {
+ e.preventDefault();
+ self._lockName();
+ }
+
+ var field = $('maki-field[path="/name"] .value');
+ var value = field.html();
+
+ var identity = self.identity;
+
+ console.log('[MAKI:IDENTITIES]', identity);
+ identity.name = value;
+
+ var db = document.querySelectorAll('maki-identity maki-datastore')[0];
+ db._patch('/identities', [
+ { op: 'replace', path: '/0', value: identity }
+ ], function(err) {
+ console.log('db._patch back:', err);
+ });
+
+ },
+ _beginEditing: function() {
+ var self = this;
+ var field = $('maki-field[path="/name"] .value');
+ var handler = _.debounce(self._handleChange, 250);
+ field.keypress(handler.bind(self));
+ self._unlockName();
+ field.focus();
+ },
+ _unlockName: function() {
+ var self = this;
+ var field = $('maki-field[path="/name"] .value');
+ field.attr('contenteditable', true);
+ },
+ _lockName: function() {
+ var self = this;
+ var field = $('maki-field[path="/name"] .value');
+ field.attr('contenteditable', false);
+ },
+ _list: function() {
+ var self = this;
+ console.log('identity datastore open, initializing work...');
+ var db = document.querySelectorAll('maki-datastore[name=identity]')[0];
+ var melody = document.querySelectorAll('melody-application')[0];
+
+ db._retrieve('/identities', function(err, identities) {
+ console.log('[MAKI:IDENTITIES]', 'retrieved:', err, identities);
+ if (err) console.error(err);
+ self.identities = identities;
+ self.identity = identities[0];
+ melody.identity = identities[0];
+ });
+ },
+ _store: function(identity) {
+ var self = this;
+ console.log('[MAKI:IDENTITIES]', '_storeIdentity', identity);
+ // TODO: only if autoregister enabled...
+ var db = document.querySelectorAll('maki-datastore[name=identity]')[0];
+ var key = '/identities/' + identity.key.public.toString();
+
+ var clone = _.cloneDeep(identity);
+ clone.key.public = identity.key.public.toString();
+
+ db._store(key, clone, function(err) {
+ console.log('identity registered!', err);
+ });
+ },
+ _register: function(identity) {
+ var self = this;
+ console.log('[MAKI:IDENTITIES]', '_storeIdentity', identity);
+ // TODO: only if autoregister enabled...
+ var db = document.querySelectorAll('maki-datastore[name=melody]')[0];
+ var key = '/identities/' + identity.key.public.toString();
+
+ var clone = _.cloneDeep(identity);
+ clone.key.public = identity.key.public.toString();
+
+ delete clone.key.private;
+
+ db._store(key, clone, function(err) {
+ console.log('identity registered!', err);
+ });
+ },
+ _generate: function(done) {
+ // TODO: do this in a Web Worker to prevent UI jank
+ var Mnemonic = require('bitcore-mnemonic');
+ var mnemonic = new Mnemonic();
+ done(null, mnemonic);
+ },
+ ready: function() {
+ var self = this;
+ var db = document.querySelectorAll('maki-identities maki-datastore')[0];
+ console.log('[MAKI:IDENTITIES]', 'ready');
+ document.addEventListener('datastore:identity:open', self._list.bind(self), false);
+ }
+ });
diff --git a/components/identity-card.jade b/components/identity-card.jade
new file mode 100644
index 00000000..fbbf8036
--- /dev/null
+++ b/components/identity-card.jade
@@ -0,0 +1,10 @@
+dom-module#maki-identity-card
+ script.
+ Polymer({
+ is: 'maki-identity-card',
+ attributes: {
+ identity: {
+ type: Object
+ }
+ }
+ });
diff --git a/components/identity.jade b/components/identity.jade
new file mode 100644
index 00000000..aa340460
--- /dev/null
+++ b/components/identity.jade
@@ -0,0 +1,404 @@
+dom-module#maki-identity
+ template
+ maki-crypto-worker(name="identity")
+ maki-datastore(name="identity", for$="{{for}}", private)
+ a.item(href="/", on-tap="_reset") Reset
+ //- TODO: this should be a /people thing, not an identity
+ template(is="dom-if", if="{{!hasIdentities}}")
+ a.item(on-tap="_onboard")
+ i.icon.sign.in
+ | Sign In
+ template(is="dom-if", if="{{hasIdentities}}")
+ template(is="dom-if", if="{{!isLoggedIn}}")
+ .ui.dropdown.item
+ i.icon.sign.in
+ | Sign In
+ i.icon.dropdown
+ maki-identity-list.menu
+ template(is="dom-repeat", items="{{identities}}")
+ maki-identity-card.item(identity="{{item}}", on-tap="_selectIdentity") {{item.name}}
+ .green.icon.labeled.item(on-tap="_onboard")
+ i.icon.leaf
+ | Start Fresh
+ template(is="dom-if", if="{{isLoggedIn}}")
+ //-a.item(href="/settings")
+ i.icon.setting
+ a.item(href="/people/{{identity.name}}")
+ template(is="dom-if", if="{{isNamed}}") {{identity.name}}
+ template(is="dom-if", if="{{!isNamed}}") anonymous
+ .ui.button.item(on-tap="_logout")
+ i.icon.sign.out
+ | Sign Out
+
+ maki-modal.ui.modal#identity-confirm
+ .header Let's introduce ourselves. How?
+ .content
+ .description
+ .ui.two.massive.stackable.buttons
+ .ui.blue.labeled.icon.button(on-tap="_importFromSeed")
+ i.icon.eyedropper
+ | Existing Seed
+ .or
+ .ui.green.right.labeled.icon.button(on-tap="_displayGeneratorModal")
+ i.icon.leaf
+ | Fresh Start
+
+ .ui.icon.fluid.message
+ i.icon.idea
+ .content
+ .header Forget your worries, not your passwords.
+ p Maki-powered apps remember you, so you never have to click "forgot password" again.
+ a(href="/") Learn More »
+
+ .actions
+ .ui.right.labeled.icon.button(on-tap="_closeSelectionModal") Some other time.
+ i.remove.icon
+
+ maki-modal.ui.modal#identity-create
+ .header Identity Generator
+ .content
+ .description
+ maki-step-ladder
+ .clearing
+
+ .actions
+ .ui.cancel.labeled.icon.button.hidden(on-tap="_displayNameModal") Nevermind, I'm done here.
+ i.remove.icon
+
+ script(src="/js/lodash.min.js", async)
+ script(src="/assets/bitcore.min.js", async)
+ script(src="/assets/bitcore-mnemonic.min.js", async)
+ script.
+ Polymer({
+ is: 'maki-identity',
+ properties: {
+ for: { type: String },
+ seed: { type: String },
+ words: { type: String },
+ identity: { type: Object, notify: true, observer: '_identityChanged' },
+ identityFull: { type: Object, },
+ isLoggedIn: { type: Boolean, value: false },
+ autoselect: { type: Boolean, value: false },
+ hasIdentities: { type: Boolean, value: false },
+ isNamed: { type: Boolean, value: false },
+ display: { type: String }
+ },
+ _generate: function(cb) {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', '_generate');
+ // TODO: do this in a Web Worker to prevent UI jank
+ var Mnemonic = require('bitcore-mnemonic');
+ var mnemonic = new Mnemonic();
+
+ var key = mnemonic.toHDPrivateKey();
+ var sub = key.derive('m/0');
+
+ self.seed = mnemonic;
+ self.words = mnemonic.toString();
+
+ var identity = {
+ id: sub.hdPublicKey.toString(),
+ _id: ObjectId().toString(),
+ seed: mnemonic.toString(),
+ //address: sub.hdPublicKey.toAddress(),
+ key: {
+ hd: true,
+ private: key.toString(),
+ public: sub.hdPublicKey.toString()
+ }
+ };
+
+ var clone = _.cloneDeep(identity);
+ delete clone.seed;
+ delete clone.key.private;
+
+ self.identity = clone;
+ self.identityFull = identity;
+
+ self._save(cb);
+ },
+ _save: function(cb) {
+ var self = this;
+ var datastore = document.querySelector('maki-datastore[name=identity]');
+ var identity = self.identityFull;
+ console.log('[MAKI:IDENTITY]', '_save', identity);
+
+ datastore._upsert('/identities', {
+ 'key.public': identity.key.public
+ }, identity, function(err) {
+ if (err) console.log('err', err);
+
+ console.log('[MAKI:IDENTITY]', '_upsert', 'callback', err, identity);
+
+ datastore._query('/identities', {
+ 'key.public': identity.key.public
+ }, function(err, identities) {
+ if (err) console.error('[MAKI-IDENTITY]', '_save', '_query', err);
+ console.log('[MAKI-IDENTITY]', '_save', '_query', 'identities', identities);
+ cb(err, identities);
+ });
+ });
+ },
+ // publishes to the local application scoped for this control
+ // makes the application aware of an identity
+ _publish: function(cb) {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', '_publish');
+ if (!cb) cb = new Function();
+
+ var clone = _.cloneDeep(self.identity);
+ delete clone.seed;
+ delete clone.key.private;
+
+ // a simple stub to emulate only having a single identity.
+ // just queries the application datastore and assumes the first identity
+ // it finds is ours. net effect: will always overwrite one user.
+ var datastore = document.querySelector('maki-datastore[for='+self.for+']');
+ console.log('[MAKI:IDENTITY]', '_publish', 'query', datastore);
+ // TODO: add unique keys to `maki-datastore` and/or `maki-resource`.
+ datastore._query('/identities', {
+ 'key.public': clone.key.public
+ }, function(err, identities) {
+ console.log('[MAKI:IDENTITY]', '_publish', 'melody knows these identities:', err, identities);
+ console.log('[MAKI:IDENTITY]', '_publish', 'you are:', clone.key.public);
+
+ async.filter(identities, function(identity, callback) {
+ var doesMatch = (identity.key.public === clone.key.public);
+ console.log('[MAKI:IDENTITY]', '_publish', 'comparing:', identity.key.public, clone.key.public);
+ callback(null, doesMatch);
+ }, function(err, known) {
+ console.log('[MAKI:IDENTITY]', '_publish', 'matching', err, known);
+ if (!known.length) {
+ // TODO: transform into JSON-LD
+ datastore._post('/identities', clone, function(err, stored) {
+ console.log('[MAKI:IDENTITY]', '_publish', 'datastore put, identity return:', err, stored);
+ cb(err, stored);
+ });
+ } else {
+ console.log('[MAKI:IDENTITY]', '_publish', 'datastore returning obj:', known[0]);
+ cb(err, known[0]);
+ }
+ });
+ });
+
+ /*$.ajax({
+ type: 'POST',
+ url: '/identities',
+ data: clone,
+ headers: {
+ Accept: 'application/json'
+ },
+ success: function(data) {
+ console.log('[MAKI:IDENTITY]', 'published:', data);
+ self.identity._id = data._id;
+ cb(null, data);
+ }
+ });*/
+ },
+ _reset: function() {
+ var dbs = [
+ 'IDBWrapper-fabric-key-value',
+ 'IDBWrapper-identity-key-value',
+ 'IDBWrapper-identity:tips-key-value',
+ 'IDBWrapper-melody-key-value',
+ 'IDBWrapper-melody:tips-key-value',
+ 'NeDB',
+ 'fabric-identity',
+ ];
+
+ dbs.forEach(function(name) {
+ var req = indexedDB.deleteDatabase(name);
+ req.onsuccess = function () {
+ console.log('[MAKI:IDENTITY]', "Deleted database successfully");
+ };
+ req.onerror = function () {
+ console.log('[MAKI:IDENTITY]', "Couldn't delete database");
+ };
+ req.onblocked = function () {
+ console.log('[MAKI:IDENTITY]', "Couldn't delete database due to the operation being blocked");
+ };
+ });
+
+ },
+ _authenticate: function() {
+
+ },
+ _displaySelectionModal: function() {
+ $('.modal#identity-confirm').modal('show');
+ },
+ _closeSelectionModal: function() {
+ $('.modal#identity-confirm').modal('hide');
+ },
+ _displayGeneratorModal: function() {
+ $('.modal#identity-create').modal('show');
+ },
+ _closeGeneratorModal: function() {
+ $('.modal#identity-create').modal('hide');
+ },
+ _initializeDropdown: function() {
+ $('.ui.dropdown').dropdown({
+ action: 'nothing'
+ });
+ },
+ _initiateGeneration: function() {
+ var self = this;
+ self._closeSelectionModal();
+ self._generate();
+ },
+ _onboard: function() {
+ var self = this;
+ self._select();
+ },
+ _sign: function(input, done) {
+ var Message = require('bitcore-message');
+ },
+ _identityChanged: function(identity, old) {
+ var self = this;
+ self.identityFull = identity;
+
+ if (self.identity) {
+ self.isLoggedIn = true;
+ }
+ if (self.identities) {
+ self.hasIdentities = true;
+ }
+ if (identity && identity.name) {
+ self.isNamed = true;
+ self.fire('identity', identity);
+ }
+ },
+ _register: function() {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', '_register', 'calling publish...');
+ self._publish(function(err, identity) {
+ if (err) console.error(err);
+
+ var identity = self.identity;
+ console.log('[MAKI:IDENTITY]', '_register', '_publish', 'identity:', identity);
+
+ var datastore = document.querySelector('maki-datastore[name=melody]');
+ datastore._bundle(identity, function(err, ident) {
+ console.log('[MAKI:IDENTITY]', '_register', '_publish', 'bundled:', ident);
+ console.log('[MAKI:IDENTITY]', '_register', '_publish', 'querying...', ident['@id']);
+ datastore._query('/people', {
+ identity: ident['@id']
+ }, function(err, known) {
+ console.log('[MAKI:IDENTITY]', '_register', '_publish', 'melody knew:', err, known);
+ if (err || known.length) {
+ return console.log('[MAKI:IDENTITY]', '_register', 'application "melody" knew identity:', ident['@id'], 'as', known[0].name);
+ }
+
+ datastore._post('/people', {
+ id: identity.name.toLowerCase(),
+ _id: ObjectId().toString(),
+ name: identity.name,
+ slug: identity.name.toLowerCase(),
+ identity: ident['@id']
+ }, function(err, person) {
+ console.log('[MAKI:IDENTITY]', '_register', 'datastore put, person return:', err, person);
+ });
+ });
+
+
+ });
+
+ /* $.ajax({
+ type: 'POST',
+ url: '/people',
+ data: {
+ name: identity.name,
+ identity: identity.key.public,
+ _identity: identity._id
+ },
+ headers: {
+ Accept: 'application/json'
+ },
+ success: function(data, res) {
+ console.log('[MAKI:IDENTITY]', '_register result:', res);
+ }
+ }); */
+ });
+ },
+ _select: function() {
+ var self = this;
+ var db = document.querySelector('maki-datastore[name=identity]');
+ var melody = document.querySelector('melody-application');
+
+ console.log('[MAKI:IDENTITY]', '_select');
+ db._get('/identities', function(err, identities) {
+ console.log('[MAKI:IDENTITY]', 'retrieved', identities);
+ self.identities = identities || [];
+ self._displaySelectionModal();
+ });
+ },
+ _selectIdentity: function(e, detail) {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', '_selectIdentity', e, detail);
+ var manager = document.querySelector('maki-identity');
+ e.target.classList.add('loading');
+ manager.identity = e.target.identity;
+ manager._register();
+ },
+ _startAgent: function() {
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/worker.js').then(function(reg) {
+ console.log('[MAKI:IDENTITY]', 'service worker installled!');
+
+ navigator.serviceWorker.addEventListener('message', function(event) {
+ console.log('[MAKI:IDENTITY]', 'serviceworker message:', event );
+ });
+
+ }).catch(function(err) {
+ console.log('[MAKI:IDENTITY]', 'service worker failed:', err);
+ });
+ }
+ },
+ _attach: function() {
+ var self = this;
+ var localIdentityStore = document.querySelector('maki-datastore[name=identity]');
+ console.log('[MAKI:IDENTITY]', '_attach', 'querying...');
+ //self._startAgent();
+ // this emulates the HTTP API, but don't be fooled – this could be
+ // replaced with anything. use the tools you have, right? :)
+ // TODO: look at this.
+ //localIdentityStore._get('/identities', function(err, identities) {
+ localIdentityStore._query('/identities', {}, function(err, identities) {
+ console.log('[MAKI:IDENTITY]', '_attach', 'recovered:', identities);
+
+ if (err) console.warn('[MAKI:IDENTITY]', 'retrieved', identities);
+ if (!identities) identities = [];
+ self.identities = identities;
+ if (identities.length) {
+ self.hasIdentities = true;
+ if (self.autoselect) {
+ self.identity = identities[0];
+ console.warn('[MAKI:IDENTITY]', 'autoselect _register', self.identity);
+ self._register();
+ }
+ }
+ self._initializeDropdown();
+ });
+ },
+ _logout: function() {
+ var self = this;
+ self.identity = null;
+ self.isLoggedIn = false;
+ console.log('[MAKI:IDENTITY]', '_logout', self.identity);
+ self.fire('identity', null);
+ // TODO: why is a delay required here?
+ setTimeout(function() {
+ self._initializeDropdown();
+ }, 50);
+ },
+ attached: function() {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', 'attached');
+ self._initializeDropdown();
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:IDENTITY]', 'ready');
+ document.addEventListener('datastore:identity:open', self._attach.bind(self), false);
+ //self.addEventListener('identity', self._initializeDropdown.bind(self), false);
+ }
+ });
diff --git a/components/index.jade b/components/index.jade
new file mode 100644
index 00000000..000b0df2
--- /dev/null
+++ b/components/index.jade
@@ -0,0 +1,42 @@
+dom-module#maki-index
+ template
+ .ui.container
+ .ui.header
+ h1.huge Hello, {{config.service.name}}.
+ h2 {{config.service.mission}}
+
+ p {{config.service.description}}
+
+ //-.ui.stackable.three.column.grid
+ for point in config.service.points
+ .column
+ .ui.fluid.card
+ .content
+ h2.header #{ point.header }
+ //- TODO: use marked config, not a regex, to fix errant tags
+ p.description
+ | !{ markdown( point.description ).replace(/
(.*)<\/p>/, '$1') }
+ if (point.action)
+ a.ui.bottom.attached.button(href="#{point.action.link}") !{point.action.text}
+
+ //-.ui.stackable.three.column.grid
+ .column
+ h3 Resources
+ .ui.list
+ each resource in resources
+ if (!resource.internal)
+ a.item(href="#{resource.routes.query}") #{resource.plural}
+
+ .column
+ h3 Services
+
+ .ui.list
+ each service in services
+ a.item(href="#{service.protocol}://#{service.authority}") #{service.name}
+ script.
+ Polymer({
+ is: 'maki-index',
+ ready: function() {
+ console.log('[MAKI:INDEX]', 'ready');
+ }
+ });
diff --git a/components/item.jade b/components/item.jade
new file mode 100644
index 00000000..04e91bb8
--- /dev/null
+++ b/components/item.jade
@@ -0,0 +1,35 @@
+dom-module#maki-item
+ template
+ .ui.card
+ .image
+ img(src="/img/maki-logo.png")
+ .content
+ a.header(href="{{item.href}}") {{item.name}}
+ p.description {{item.description}}
+ template(if="{{item.action}}")
+ a.ui.bottom.attached.button(if="{{item.action}}", href="{{item.action.href}}") {{item.action.text}}
+
+ script(src="/js/jquery.js", async)
+ script.
+ Polymer({
+ is: 'maki-item',
+ properties: {
+ src: {
+ type: String,
+ //observer: '_srcChanged'
+ },
+ hash: {
+ type: String
+ },
+ item: {
+ type: Object
+ }
+ },
+ created: function() {
+ var self = this;
+ console.log('created!', self.item);
+ },
+ _srcChanged: function() {
+ console.log('source changed for item');
+ }
+ });
diff --git a/components/key-value.jade b/components/key-value.jade
new file mode 100644
index 00000000..b2c0009c
--- /dev/null
+++ b/components/key-value.jade
@@ -0,0 +1,87 @@
+//- maki-key-value
+//- keeps a simple key:value mapping
+//- backed by LevelDB
+dom-module#maki-key-value
+ //-script(src="/assets/level.js")
+ script.
+ Polymer({
+ is: 'maki-key-value',
+ properties: {
+ name: {
+ type: String
+ },
+ for: {
+ type: String
+ },
+ level: {
+ type: Object
+ }
+ },
+ _get: function(key, opts, cb) {
+ var self = this;
+ if (typeof opts == 'function') {
+ cb = opts;
+ opts = {};
+ }
+ console.log('[MAKI:KV]', '_get', 'key', key);
+ self.level.get(key, {
+ asBuffer: false
+ }, function(err, val) {
+
+ console.log('[MAKI:KV]', '_get', 'valfor', key, val);
+
+ if (err) console.error(err);
+ if (!val) return cb('No such value: ' + key, null);
+ if (opts.convert) {
+ console.log('[MAKI:KV]', '_get', 'converting:', val);
+ try {
+ val = JSON.parse(val);
+ } catch (e) {
+ console.error('[MAKI:KV]', '_get', e);
+ }
+ }
+ console.log('[MAKI:KV]', '_get', key, val);
+ return cb(err, val);
+ });
+ },
+ _set: function(key, val, cb) {
+ var self = this;
+ console.log('[MAKI:KV]', '_set', key, val);
+
+ if (typeof val !== 'string') {
+ val = JSON.stringify(val);
+ }
+
+ // TODO: use async.
+ self.level.get(key, {
+ asBuffer: false
+ }, function(err, old) {
+ if (err) console.error(err);
+ self.level.put(key, val, function(err) {
+ if (err) console.error(err);
+ self.fire('key-value:change', {
+ key: key,
+ val: val,
+ old: old
+ });
+ console.log('[MAKI:KV]', '_set', key, val);
+ return cb(err);
+ });
+ });
+ },
+ ready: function() {
+ var self = this;
+ var name = self.name + '-key-value';
+ if (self.for) {
+ name = self.for + ':' + name;
+ }
+ self.level = level(name);
+ self.level.open(function(err) {
+ if (err) console.error(err);
+ var event = new Event('key-value:open');
+ document.dispatchEvent(event);
+ var event = new Event('key-value:'+self.name+':open');
+ document.dispatchEvent(event);
+ });
+ }
+ });
diff --git a/components/maki-splash.jade b/components/maki-splash.jade
new file mode 100644
index 00000000..9f7502f8
--- /dev/null
+++ b/components/maki-splash.jade
@@ -0,0 +1,93 @@
+dom-module#maki-splash
+ style.
+ #navigation {
+ width: 100%;
+ }
+
+ template
+ .ui.inverted.vertical.masthead.center.aligned.segment
+ .ui.text.container
+ h1.ui.inverted.header Code less.
+ h2 #{config.service.name} is !{config.service.mission}
+
+ pre(style="font-size: 1.2em; margin-top: 2em;")
+ code.nohighlight.
+ npm install martindale/maki --save
+
+ a.ui.huge.primary.button(href="/docs")
+ | Build Your MVP Faster
+ i.right.chevron.icon
+
+ .ui.vertical.stripe.segment
+ .ui.middle.aligned.stackable.grid.container
+ .ui.equal.width.stackable.internally.celled.grid
+ .center.aligned.row
+ for point in config.service.points
+ .column
+ h3.header #{ point.header }
+ //- TODO: use marked config, not a regex, to fix errant
tags
+ p.description
+ | !{ markdown( point.description ).replace(/
(.*)<\/p>/, '$1') }
+ if (point.action)
+ a.ui.huge.fluid.button(href="#{point.action.link}") !{point.action.text}
+
+ .ui.vertical.stripe.segment
+ .ui.text.container
+ h3.ui.header Powerful Helpers
+ p Maki comes with a suite of powerful tools, out of the box. Each is completely optional and replaceable!
+
+ h4.ui.horizontal.header.divider The Power Suite
+
+ p By default, Maki apps are composed with Jade, styled with Semantic UI, and bound together by custom Web Components (as implemented by Polymer).
+ pre.jade
+ code.
+ dom-module#maki-application
+
+ template
+ maki-datastore(name="my-app")
+ maki-channel(autoconnect, reconnect="true")
+
+ .ui.page
+ .row
+ message-list(src="/messages/custom-room")
+ .row
+ message-form
+
+ p This allows you to write your application once, and we can derive native interfaces directly — by default, provided by React Native.
+
+ h2.ui.header Loosely Coupled
+ p Have a better way to do things? Have a different compile target? All Maki components are optional, and can even be outright removed without disrupting the other components of the system.
+
+
+ .ui.vertical.stripe.quote.segment
+ .ui.equal.width.stackable.internally.celled.grid
+ .center.aligned.row
+ .column
+ h3 "This feels like the invention of the transistor."
+ p Will Ricketts, SailsJS Contributor
+ .column
+ h3 We're building something new.
+ a.ui.huge.primary.button(href="/developers/getting-involved") Come join us.
+ i.icon.right.chevron
+
+ script(src="/js/highlight.pack.js")
+ script.
+
+ Polymer({
+ is: 'maki-splash',
+ ready: function() {
+ hljs.initHighlightingOnLoad();
+ }
+ });
+
+ /*(function () {
+ window._BlabNS = {};
+ window._BlabNS.user_id = '7f64ecb8166943cd896ea28ff8d0c5d0';
+ window._BlabNS.enableMobile = true;
+ var s = document.createElement('script');
+ s.type = 'text/javascript';
+ s.async = true;
+ s.src = 'https://cdn.blab.im/tinyplayer/js/sdk.js';
+ var x = document.getElementsByTagName('script')[0];
+ x.parentNode.insertBefore(s, x);
+ })();*/
diff --git a/components/navbar.jade b/components/navbar.jade
new file mode 100644
index 00000000..6d50e8b8
--- /dev/null
+++ b/components/navbar.jade
@@ -0,0 +1,31 @@
+dom-module#maki-navbar
+ template
+ .ui.large.secondary.inverted.pointing.menu
+ a.toc.item
+ i.sidebar.icon
+ a.item(href="/")
+ img.tooltipped(src="/img/maki-icon.png", title="The hand-rolled, carefully crafted goodness that is Maki.", data-variation="inverted", style="max-height: 2em; max-width: 2em; margin-bottom: -0.75em; margin-right: -0.5em;")
+ a.item(href="/")
+ i.icon.left(class="#{ config.service.icon || 'lab' }")
+ | #{config.service.name}
+ each resource in resources
+ if (!resource.internal)
+ a.item(href="#{resource.routes.query}")
+ if (resource.options.icon)
+ i.icon(class="#{resource.options.icon}")
+ | #{resource.plural}
+
+ //- block for prepend/append/replace-able menu items
+ block mainMenu
+ .right.menu
+ a.item.tooltipped(class="btn btn-default", href="bitcoin:1EBdAcEhP4Qn7sihJoCqinLC8A14zqHJ7R", title="If you have a bitcoin wallet installed and configured, this will launch it.")
+ i.icon.bitcoin(alt="Bitcoin", title="Donate Bitcoin")
+ | Donate »
+ a.item.tooltipped(href="#{ config.service.source }", title="View the Source, Luke! Source code for this site.")
+ i.fork.icon
+ | Code »
+
+ script.
+ Polymer({
+ is: 'maki-navbar'
+ });
diff --git a/components/peer-list.jade b/components/peer-list.jade
new file mode 100644
index 00000000..4b7380ef
--- /dev/null
+++ b/components/peer-list.jade
@@ -0,0 +1,25 @@
+dom-module#maki-peer-list
+ template
+ maki-datastore(name="fabric")
+ h2 Currently Connected Peers
+ .ui.cards
+ template(is="dom-repeat", items="{{peers}}")
+ .ui.card
+ .content
+ .header {{item.id}}
+ script.
+ Polymer({
+ is: 'maki-peer-list',
+ properties: {
+ peers: Array
+ },
+ ready: function() {
+ var self = this;
+ var fabric = document.querySelector('maki-datastore[name=melody]');
+ console.log('[FABRIC:PEER-LIST]', 'ready');
+ fabric._retrieve('/peers', function(err, peers) {
+ console.log('[FABRIC:PEER-LIST]', 'ready _retrieve', err, peers);
+ self.set('peers', peers);
+ });
+ }
+ });
diff --git a/components/peer-manager.jade b/components/peer-manager.jade
new file mode 100644
index 00000000..9eb71b21
--- /dev/null
+++ b/components/peer-manager.jade
@@ -0,0 +1,261 @@
+dom-module#maki-peer-manager
+ template
+ //-maki-datastore(name="fabric")
+ script(src="/assets/peer.min.js", async)
+ script.
+ Polymer({
+ is: 'maki-peer-manager',
+ properties: {
+ peer: {
+ type: Object
+ },
+ connections: {
+ type: Object,
+ value: {}
+ },
+ peers: {
+ type: Object,
+ value: {},
+ //observer: '_peersChanged',
+ notify: true
+ }
+ },
+ observers: [
+ //'_peersChanged(peers)'
+ '_peersChangedDeep(peers.*)'
+ ],
+ _broadcast: function(msg) {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', '_broadcast', msg);
+ if (typeof msg !== 'string') {
+ msg = JSON.stringify(msg);
+ }
+
+ Object.keys(self.connections).forEach(function(id) {
+ var conn = self.connections[id];
+ console.log('[MAKI:PEER-MANAGER]', 'connection iterator:', id);
+ conn.send(msg);
+ });
+ },
+ _relay: function(msg) {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', '_relay', msg);
+ self._broadcast(msg);
+ },
+ _peerWith: function(id) {
+ var self = this;
+ if (!self.peer) return console.error('[MAKI:PEER-MANAGER]', 'no local peer');
+ console.log('[MAKI:PEER-MANAGER]', '_peerWith', id, 'from:', self.peer.id)//, id);
+ if (id === self.peer.id) return console.error('[MAKI:PEER-MANAGER]', 'cannot peer with self');
+ if (self.connections[id]) {
+ console.log('[MAKI:PEER-MANAGER]', 'connection exists!');
+ } else {
+ var conn = self.peer.connect(id);
+ conn.on('open', function() {
+ conn.on('data', function(data) {
+ console.log('[MAKI:PEER-MANAGER]', 'connection data:', data);
+
+ var channel = document.querySelector('maki-channel');
+ channel._handleMessage({
+ data: data
+ });
+
+ });
+ self.connections[id] = conn;
+ });
+ }
+ },
+ _peersChangedDeep: function(change) {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', '_peersChangedDeep', change);
+
+ var peer = change.value;
+
+ if (peer && peer.state !== 'connected') {
+ return self._peerWith(peer.id);
+ }
+
+ },
+ _peersChanged: function(peers, old) {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', '_peersChanged', peers, old);
+
+ Object.keys(peers).forEach(function(id) {
+ console.log('[MAKI:PEER-MANAGER]', 'iterating over:', id);
+ var peer = self.peers[id];
+ if (peer && peer.state !== 'connected') {
+ return self._peerWith(id);
+ }
+ });
+
+ //setTimeout(self._connect.bind(self), 2500);
+ },
+ _receivePeerChange: function(e) {
+ var self = this;
+ var db = document.querySelector('maki-datastore[name=melody]');
+ console.log('[MAKI:PEER-MANAGER]', 'found datastore change:', e);//, detail);
+ if (e.detail.key === '/peers') {
+ var knownPeerIDs = Object.keys(self.peers);
+ var others = e.detail.val.map(function(x) {
+ return x.id;
+ });
+
+ var newPeerIDs = _.difference(others, knownPeerIDs);
+
+ /*newPeerIDs.forEach(function(id) {
+ self._peerWith(id);
+ });*/
+
+ console.log('[MAKI:PEER-MANAGER]', 'peering with:', newPeerIDs[0]);
+
+ self._peerWith(newPeerIDs[0]);
+
+ console.log('[MAKI:PEER-MANAGER]', 'currently known', knownPeerIDs);
+ console.log('[MAKI:PEER-MANAGER]', 'others', others);
+ console.log('[MAKI:PEER-MANAGER]', 'newPeerIDs', newPeerIDs);
+
+ }
+ },
+ _register: function(done) {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', '_register', self.peer);
+
+ var obj = {
+ id: self.peer.id
+ };
+
+ $.ajax({
+ type: 'POST',
+ url: '/peers',
+ data: obj,
+ headers: {
+ 'Accept': 'application/json'
+ }
+ }).done(function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '_register success:', data);
+ done();
+ }).error(function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '_register error:', data);
+ done();
+ });
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:PEER-MANAGER]', 'ready');
+ /*var db = document.querySelector('maki-datastore[name=melody]');
+ db.addEventListener('datastore:change', function(e) {
+ console.log('[MAKI:PEER-MANAGER]', 'found datastore change:', e);
+ });*/
+ // TODO: get peerJS server working directly on the edge node
+ /*var options = {
+ host: window.location.hostname,
+ port: window.location.port,
+ path: '/peerjs'
+ };*/
+
+ var options = {
+ key: 'i31eg2i9x5p9o1or'
+ };
+ // TODO: pass a peer ID based on a cryptographic identity
+ var peer = new Peer(options);
+ self.peer = peer;
+
+ peer.on('connection', function(conn) {
+ console.log('[MAKI:PEER-MANAGER]', 'inbound connection', conn);
+ self.connections[conn.peer] = conn;
+ });
+
+ peer.on('open', function() {
+ console.log('[MAKI:PEER-MANAGER]', 'peer id:', peer.id);
+ self._register(function(err) {
+ self.peers[peer.id] = peer;
+ self.set('peers.' + peer.id, peer);
+ self.notifyPath('peers', self.peers);
+
+ var db = document.querySelector('maki-datastore[name=melody]');
+ db.addEventListener('datastore:change', self._receivePeerChange.bind(self));
+ console.log('[MAKI:PEER-MANAGER]', 'peers now:', self.peers);
+ });
+ });
+
+ /*var alice = new Peer({
+ initiator: true,
+ trickle: false
+ });
+ alice.on('error', function(err) {
+ console.error('[MAKI:PEER-MANAGER]', '(alice) error:', err);
+ });
+ alice.on('signal', function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) signal:', data);
+ bob.signal(data);
+ });
+ alice.on('message', function(msg) {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) message:', msg);
+ });
+ alice.on('connect', function() {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) connect');
+ alice.send('Well hello there!');
+ });
+
+ var bob = new Peer({
+ //initiator: true,
+ trickle: false
+ });
+ bob.on('error', function(err) {
+ console.error('[MAKI:PEER-MANAGER]', '(bob) error:', err);
+ });
+ bob.on('signal', function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) signal:', data);
+ alice.signal(data);
+ });
+ bob.on('message', function(msg) {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) message:', msg);
+ });
+ bob.on('connect', function() {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) connect');
+ bob.send('Well hello there!');
+ });*/
+
+ },
+ _connect: function() {
+ console.log('[MAKI:PEER-MANAGER]', '_connect');
+
+ // TODO: get peerJS server working directly in Maki server
+ var options = {
+ host: window.location.hostname,
+ port: window.location.port,
+ path: '/peerjs'
+ };
+
+ var options = {
+ key: 'i31eg2i9x5p9o1or'
+ };
+
+ var alice = new Peer('alice', options);
+ var aliceConn = alice.connect('bob');
+ aliceConn.on('open', function() {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) open');
+ aliceConn.send('ahem. hello there.');
+ });
+ alice.on('connection', function(peer) {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) connection:', peer);
+ peer.on('data', function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '(alice) data:', data);
+ });
+ });
+
+ var bob = new Peer('bob', options);
+ var bobConn = bob.connect('alice');
+ bobConn.on('open', function() {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) open');
+ bobConn.send('ahem. hello there.');
+ });
+ bob.on('connection', function(peer) {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) connection:', peer);
+ peer.on('data', function(data) {
+ console.log('[MAKI:PEER-MANAGER]', '(bob) data:', data);
+ });
+ });
+
+ },
+ });
diff --git a/components/resource.jade b/components/resource.jade
new file mode 100644
index 00000000..1ee8caaf
--- /dev/null
+++ b/components/resource.jade
@@ -0,0 +1,29 @@
+dom-module#maki-resource
+ script(src="/assets/nedb.min.js", async)
+ script.
+ Polymer({
+ is: 'maki-resource',
+ properties: {
+ name: {
+ type: String
+ },
+ store: {
+ type: Object
+ },
+ definition: {
+ type: Object
+ }
+ },
+ _load: function() {
+ var self = this;
+ console.log('[MAKI:RESOURCE]', '_load', self.name);
+ self.store = new Nedb({
+ filename: self.name,
+ autoload: true
+ });
+ },
+ ready: function() {
+ var self = this;
+ console.log('[MAKI:RESOURCE]', 'ready', self.name);
+ }
+ });
diff --git a/components/step-ladder.jade b/components/step-ladder.jade
new file mode 100644
index 00000000..5633907c
--- /dev/null
+++ b/components/step-ladder.jade
@@ -0,0 +1,158 @@
+dom-module#maki-step-ladder
+ style.
+ .hidden {
+ display: none;
+ }
+ template
+ .ui.three.steps
+ .active.step(data-step="generate")
+ i.leaf.icon
+ .content
+ .title Generate
+ .description Create a key.
+ .step(data-step="secure")
+ i.icon.lock
+ .content
+ .title Secure
+ .description Keep it safe.
+ .step(data-step="configure")
+ i.icon.setting
+ .content
+ .title Configure
+ .description Name yourself.
+ template(is="dom-repeat", items="{{steps}}")
+ .step x:{{item}}
+
+ .step-view(data-step="generate")
+ .ui.bottom.attached.clearing.segment
+ h3 This is a different way.
+ p Instead of remembering passwords, your computer will always remember you. You can re-invent yourself any time you want, and even switch back and forth.
+ p But it's important to keep this one thing, the seed. The seed is a short list of words that can be used to restore your identity. Once we give it to you, we don't have it anymore.
+ p If you're ready to save your seed, generate it by using the button below.
+ .right.floated.buttons
+ a.ui.yellow.huge.fluid.button(on-tap="_startGenerator")
+ i.icon.plug
+ | Generate Seed
+ .step-view(data-step="secure")
+ .ui.bottom.attached.clearing.segment
+ h3 Write this down.
+ p This is your seed. It can be used to sign in as you anywhere, any time. Write it down and put it somewhere very safe.
+ pre
+ code {{words}}
+ p If you lose your seed, it's gone. We cannot recover it for you. Make sure you've really got it.
+ a.ui.huge.fluid.green.button(on-tap="_moveToConfigure")
+ i.icon.checkmark
+ | Yep, I've written it down.
+ .step-view(data-step="configure")
+ .ui.bottom.attached.clearing.segment
+ h3 Give yourself a name!
+ p This is how other people will see you! You can change it at any time, but then people might forget you. Make it memorable!
+ .ui.large.form
+ .field
+ label Your Name
+ input(type="text", placeholder="SomeUsername", name="name", value="{{identity.name}}")
+ .button.ui.positive.right.labeled.huge.icon.fluid.button(type="submit", on-tap="_setName") I'm happy.
+ i.right.chevron.icon
+ script.
+ Polymer({
+ is: 'maki-step-ladder',
+ properties: {
+ words: {
+ type: String
+ },
+ steps: {
+ type: Object
+ },
+ step: {
+ type: String,
+ observer: '_stepChanged',
+ notify: true
+ }
+ },
+ _createIdentity: function() {
+ var self = this;
+ var manager = document.querySelector('maki-identity');
+ var button = document.querySelector('.step-view[data-step=generate] .segment .button');
+ var step = document.querySelector('.step[data-step=generate]');
+ var next = document.querySelector('.step[data-step=secure]');
+ manager._generate(function(err, identity) {
+ console.log('generate complete:', err);
+ button.classList.remove('loading');
+ step.classList.remove('active');
+ next.classList.add('active');
+ self.words = manager.words;
+ self.step = 'secure';
+ });
+ },
+ _setName: function(e) {
+ e.preventDefault();
+ var self = this;
+ var manager = document.querySelector('maki-identity');
+ var name = $('*[data-step=configure] input[name=name]').val();
+ var step = document.querySelector('.step[data-step=configure]');
+
+ $('*[data-step=configure] input[name=name]').val('');
+
+ console.log('[MAKI:STEP-LADDER]', '_setName', name);
+ // hack.
+ // TODO: fix this
+ manager.identity.name = name;
+ manager.identityFull.name = name;
+ // other old dust. unsure if necessary.
+ manager.set('identity.name', name);
+ manager.isNamed = true;
+
+ console.log('[MAKI:STEP-LADDER]', '_setName', 'result:', manager.identity.name);
+
+ manager._save(function(err) {
+ step.classList.remove('active');
+ manager._register();
+ manager._closeGeneratorModal();
+ self.step = 'generate';
+ });
+ },
+ _moveToConfigure: function() {
+ var self = this;
+ var step = document.querySelector('.step[data-step=secure]');
+ var next = document.querySelector('.step[data-step=configure]');
+ step.classList.remove('active');
+ next.classList.add('active');
+ self.step = 'configure';
+ },
+ _stepChanged: function(step) {
+ var self = this;
+ console.log('[MAKI:STEP-LADDER]', '_stepChanged', step);
+
+ var steps = document.querySelectorAll('.step-view');
+ console.log('[MAKI:STEP-LADDER]', 'pages found:', steps);
+
+ for (var i = 0; i < steps.length; i++) {
+ var el = steps[i];
+ var name = el.getAttribute('data-step');
+ var cond = (self.step !== name);
+ var step = document.querySelector('.step[data-step='+name+']');
+
+ console.log('[MAKI:STEP-LADDER]', '_stepChanged cond', cond);
+ if (cond) {
+ el.classList.add('hidden');
+ step.classList.remove('active');
+ } else {
+ el.classList.remove('hidden');
+ step.classList.add('active');
+ }
+ }
+ },
+ _startGenerator: function(e) {
+ var self = this;
+ var button = document.querySelector('.step-view[data-step=generate] .segment .button');
+
+ button.classList.add('loading');
+
+ self._createIdentity();
+
+ },
+ attached: function() {
+ var self = this;
+ self.step = 'generate';
+ }
+ });
diff --git a/docs/components.md b/docs/components.md
new file mode 100644
index 00000000..1a3b3dad
--- /dev/null
+++ b/docs/components.md
@@ -0,0 +1,16 @@
+## Components
+
+
+Components reside in `components/`.
+
+### Creating a Component
+
+
+
+
+### Special Components
+Maki exposes a number of Components for your convenience. Most of the time, you
+won't need to access these items directly.
+
+#### ``
+Creates a browser datastore for Resources.
diff --git a/lib/Maki.js b/lib/Maki.js
index d304a49e..0c6270f6 100644
--- a/lib/Maki.js
+++ b/lib/Maki.js
@@ -61,6 +61,15 @@ Maki.prototype.define = function( name , options ) {
Maki.prototype.use = function( plugin ) {
var self = this;
+ if (!plugin.extends) {
+ plugin.extends = {};
+ }
+
+ if (plugin.provides) {
+ Object.keys(plugin.provides).forEach(function(name) {
+ self.define(name, plugin.provides[name]);
+ });
+ }
if (plugin.extends.resources) {
Object.keys( plugin.extends.resources ).forEach(function( n ) {
@@ -105,11 +114,15 @@ Maki.prototype.serve = function( services , cb ) {
self.resources['Index'] = new self.Resource('Index', {
name: 'Index',
template: 'index',
+ components: {
+ query: 'maki-splash',
+ get: 'maki-splash'
+ },
routes: {
query: '/'
},
static: true,
- internal: true
+ //internal: true
});
}
@@ -183,7 +196,7 @@ Maki.prototype.bootstrap = function(done) {
'/views/layouts',
'/views/partials'
];
-
+
if (!done) {
var done = new Function();
}
diff --git a/lib/Resource/index.js b/lib/Resource/index.js
index 1b25c7d7..23e72592 100644
--- a/lib/Resource/index.js
+++ b/lib/Resource/index.js
@@ -1,3 +1,4 @@
+var fs = require('fs');
var util = require('util');
var pluralize = require('pluralize');
var pathToRegex = require('path-to-regexp');
@@ -21,6 +22,7 @@ var Resource = function( name , options ) {
if (!options.routes) options.routes = {};
if (!options.methods) options.methods = {};
if (!options.templates) options.templates = {};
+ if (!options.components) options.components = {};
if (!options.plugins) options.plugins = [];
if (!options.requires) options.requires = [];
if (!options.handlers) options.handlers = {};
@@ -49,6 +51,7 @@ var Resource = function( name , options ) {
self.synopsis = options.synopsis || 'Resource.';
self.description = options.description || 'A Resource available on this server.';
self.template = options.template || nameLower;
+ self.templates = options.templates;
self.routes = {};
self.paths = { query: new RegExp( self.routes.query ) };
@@ -59,10 +62,9 @@ var Resource = function( name , options ) {
get: nameLower,
create: nameLower
});
- self.templates = {
- query: options.templates.query || options.template || (options.singular) ? nameLower : collectionName,
- get: options.templates.get || nameLower
- };
+
+ if (!self.templates.query) self.templates.query = options.template || (options.singular) ? nameLower : collectionName;
+ if (!self.templates.get) self.templates.get = options.template || nameLower;
if (self.options.routes) self.routes = _.merge( self.routes , self.options.routes );
@@ -174,10 +176,10 @@ Resource.prototype.attach = function( maki ) {
maki: maki, // <- le sigh. can we do this another way?
resource: self
});
-
+
self.Schema.methods.Resource = self;
self.Schema.methods.Resources = maki.resources;
-
+
Object.keys( self.options.methods ).forEach(function( name ) {
self.Schema.methods[ name ] = self.options.methods[ name ];
});
@@ -211,19 +213,19 @@ Resource.prototype.attach = function( maki ) {
}
});
-
+
if (self.options.indices && self.options.indices instanceof Array) {
self.options.indices.forEach(function(index) {
var fields = {};
-
+
index.fields.forEach(function(field) {
fields[field] = 1;
});
-
+
var opts = {
unique: index.unique || false
};
-
+
self.Schema.index(fields, opts);
});
}
@@ -238,7 +240,9 @@ Resource.prototype.attach = function( maki ) {
self.Schema.plugin( plugin );
});
- self.Model = maki.mongoose.model( self.name , self.Schema );
+ if (!self.internal) {
+ self.Model = maki.mongoose.model( self.name , self.Schema );
+ }
if (self.source) {
@@ -311,6 +315,30 @@ Resource.prototype.attach = function( maki ) {
}
}
+ self.components = {
+ query: self.options.components.query || maki.config.service.namespace + '-' + self.names.query,
+ get: self.options.components.get || maki.config.service.namespace + '-' + self.names.get
+ };
+
+ var lib = __dirname + '/../../components/';
+ var base = process.env.PWD + '/components/';
+ ['query', 'get'].forEach(function(action) {
+ var name = self.components[action]
+ .replace(maki.config.service.namespace+'-', '')
+ .replace('maki-', '');
+
+ var path = base + self.components[action] + '.jade';
+ var alt = base + name + '.jade';
+
+ var fall = lib + self.components[action] + '.jade';
+ var back = lib + name + '.jade';
+
+ if (!fs.existsSync(path) && !fs.existsSync(alt) && !fs.existsSync(fall) && !fs.existsSync(back)) {
+ console.log('neither exist, defaulting');
+ self.components[action] = 'maki-collection';
+ }
+ });
+
//if (self.internal || self.static) return;
maki.resources[ self.name ] = self;
};
@@ -416,7 +444,7 @@ Resource.prototype.get = function( q , opts , complete ) {
});
function executeMethod( q , done ) {
- var query = Model.findOne( q ).sort('-_id');
+ var query = Model.findOne( q ).sort( opts.sort || '-_id' );
if (opts.populate instanceof String) {
query.populate( opts.populate.path );
@@ -461,9 +489,9 @@ Resource.prototype.get = function( q , opts , complete ) {
}
-Resource.prototype.create = function( doc , params , complete ) {
+Resource.prototype.create = function( doc , opts , complete ) {
var self = this;
- if (typeof( params ) === 'function') var complete = params;
+ if (typeof( opts ) === 'function') var complete = opts;
if (!complete) var complete = new Function();
if (self.options.static) return complete();
@@ -483,6 +511,21 @@ Resource.prototype.create = function( doc , params , complete ) {
var instance = new Model( doc );
instance.save(function(err) {
if (err) return complete(err);
+
+ if (opts.populate instanceof String) {
+ return instance.populate( opts.populate , done );
+ }
+
+ if (opts.populate instanceof Array) {
+ return opts.populate.forEach(function(field) {
+ if (field.fields) {
+ instance.populate( field , done );
+ } else {
+ instance.populate( field , done );
+ }
+ });
+ }
+
return done( null , instance );
});
}
@@ -494,7 +537,9 @@ Resource.prototype.create = function( doc , params , complete ) {
// find one based on our query, and return it if it exists
Model.findOne( query ).exec(function(err, instance) {
if (err) return complete(err);
- if (instance) return complete( err , instance );
+ if (instance) {
+ return complete( err , instance );
+ }
return done( null );
});
}
@@ -519,6 +564,12 @@ Resource.prototype.create = function( doc , params , complete ) {
}
+Resource.prototype.count = function(query, complete) {
+ var self = this;
+ var Model = self.Model;
+ Model.count(query, complete);
+}
+
Resource.prototype.patch = function( query , params, complete ) {
var self = this;
if (!complete) var complete = new Function();
diff --git a/lib/Service/http.js b/lib/Service/http.js
index a657a73f..9460946d 100644
--- a/lib/Service/http.js
+++ b/lib/Service/http.js
@@ -6,6 +6,7 @@ var express = require('express');
var fs = require('fs');
var pem = require('pem');
var async = require('async');
+var walk = require('walk');
var _ = require('lodash');
var streamifier = require('streamifier');
@@ -20,8 +21,17 @@ var HTTP = function() {
this._pre = {};
this._post = {};
this._plugins = [];
- this._scripts = [];
+ this._scripts = [
+ __dirname + '/../../public/js/webcomponents-lite.min.js',
+ __dirname + '/../../public/js/semantic.min.js',
+ __dirname + '/../../public/assets/objectid.js',
+ //__dirname + '/../../public/assets/peer.js',
+ //'public/js/jquery.js',
+ //'public/js/maki.js'
+ ];
this._workers = [];
+ this._resourceMap = {};
+ this._flatResourceMap = {};
};
require('util').inherits( HTTP , Service );
@@ -241,6 +251,36 @@ HTTP.prototype.attach = function( maki ) {
maki.socks = new WebSocketServer();
maki.app.use( require('maki-forms') );
+ Object.keys(maki.resources).forEach(function(name) {
+ var resource = maki.resources[name];
+ self._resourceMap[name] = [];
+ Object.keys(resource.paths).forEach(function(method) {
+ self._resourceMap[name].push(resource.paths[method]);
+ });
+ });
+
+ console.log('resourceMap:', self._resourceMap);
+
+ /* maki.socks.on('patch', function(patch) {
+ console.log('inner received patch:', patch);
+ var match = null;
+ for (var name in self._resourceMap) {
+ var regii = self._resourceMap[name];
+ for (var i = 0; i < regii.length; i++) {
+ var regex = regii[i];
+ if (regex.test(patch.channel)) {
+ match = name;
+ break;
+ }
+ }
+ if (match) {
+ break;
+ };
+ };
+ console.log('match!', match);
+ maki.resources[match]._patch(patch.channel, patch.ops);
+ }); */
+
var map = {
'query': 'get',
'create': 'post',
@@ -251,13 +291,6 @@ HTTP.prototype.attach = function( maki ) {
self.map = map;
self.invertedMap = _.invert(map);
- /*var jademin = require('jade-browser');
- maki.app.use( jademin('/js/templates.js', maki.app.set('views'), {
- beforeCompile: function( input ) {
- return input.replace(/extends (.*)\n/, '');
- }
- }) );*/
-
var lessmin = require('less-middleware');
maki.app.use( lessmin({
debug: self.debug,
@@ -284,6 +317,17 @@ HTTP.prototype.attach = function( maki ) {
inMemory: true
}));
+ maki.httpd = require('http').createServer( maki.app );
+
+ var ExpressPeerServer = require('peer').ExpressPeerServer;
+ var peerServer = ExpressPeerServer(maki.httpd);
+ maki.app.use('/peerjs', peerServer);
+ peerServer.on('connection', function(id) {
+ var self = this;
+ console.log(self);
+ console.log('peerserver connection:', id);
+ });
+
maki.app.locals[ 'config' ] = maki.config;
maki.app.locals[ 'resources' ] = maki.resources;
maki.app.locals[ 'services' ] = maki.services;
@@ -303,6 +347,32 @@ HTTP.prototype.attach = function( maki ) {
return next();
});
+ maki.app.locals.componentMap = {};
+ maki.app.locals.components = '';
+
+ var defaults = __dirname + '/../../components';
+ var overrides = process.env.PWD + '/components';
+
+ [defaults, overrides].forEach(function(path) {
+ var options = {
+ listeners: {
+ file: function(root, fileStats, next) {
+ var component = path + '/' + fileStats.name;
+ maki.app.render(component, function(err, html) {
+ if (err) console.error(err);
+ maki.app.locals.componentMap[fileStats.name] = html;
+ next();
+ });
+ }
+ }
+ };
+ walk.walkSync(path, options);
+ });
+
+ Object.keys(maki.app.locals.componentMap).forEach(function(name) {
+ maki.app.locals.components += maki.app.locals.componentMap[name];
+ });
+
maki.app.use( self.provide() );
if (maki.config.statics && maki.config.statics.length) {
@@ -313,7 +383,7 @@ HTTP.prototype.attach = function( maki ) {
maki.app.get( path , function(req, res) {
res.provide( s );
});
- })
+ });
}
function serveDocumentation(req, res, next) {
@@ -332,21 +402,30 @@ HTTP.prototype.attach = function( maki ) {
return resource;
});
+ var resourceMap = {};
+ Object.keys(maki.resources).filter(function(r) {
+ var resource = maki.resources[ r ];
+ return true;
+ return !resource.internal || !resource.static;
+ }).forEach(function(name) {
+ var model = maki.resources[name];
+ var resource = _.clone(model, true);
+ delete resource.Schema;
+ resourceMap[name] = resource;
+ });
+
return res.format({
html: function() {
res.render('endpoints', {
resources: resourceList
- })
+ });
},
json: function() {
res.send({
config: {
- views: {
- client: maki.config.views.client
- }
+ service: maki.config.service
},
- // TODO: fix circular JSON issue here
- resources: resourceList
+ resources: resourceMap
});
}
});
@@ -359,6 +438,19 @@ HTTP.prototype.attach = function( maki ) {
next();
});
+ maki.app.get('/components', function(req, res, next) {
+ return res.send(maki.app.locals.components);
+ });
+
+ maki.app.get('/components/:name', function(req, res, next) {
+ var name = req.params.name;
+ var path = __dirname + '/../../components/'+name+'.jade';
+ if (fs.existsSync(path)) return res.render(path);
+ var path = process.env.PWD + '/components/'+name+'.jade';
+ if (fs.existsSync(path)) return res.render(path);
+ return next();
+ });
+
maki.app.get('/api', function(req, res, next) {
return serveDocumentation(req, res, next);
});
@@ -604,7 +696,7 @@ HTTP.prototype.attach = function( maki ) {
// there is a slight difference in how Resource methods are implemented//
// specifically, "editing" a resourcing requires 1) a query , and 2)//
// patches. Perhaps we can use a "builder" and .apply() here.
-
+
if (p === 'query') {
var executor = function(req, res, next) {
req.m = p;
@@ -687,27 +779,31 @@ HTTP.prototype.attach = function( maki ) {
doc[ field ] = file._id;
});
- resource[ p ]( doc , function(err, instance) {
+ resource[ p ]( doc , {
+ populate: methodPopulationMap[ p ]
+ }, function(err, instance) {
if (err) return res.error( err );
req.locals = instance;
return res.provide( r , instance , handlers );
});
});
}
-
+
maki.app['put']( regex + '/:id' , function(req, res, next) {
req.m = p;
if (resource.source) return res.status( 405 ).provide( r );
// TODO: query pipeline (facades)
var doc = req.body;
- resource[ p ]( doc , function(err, instance) {
+ resource[ p ]( doc , {
+ populate: methodPopulationMap[ p ]
+ }, function(err, instance) {
if (err) return res.error( err );
req.locals = instance;
return res.provide( r , instance );
});
});
-
+
} else if (p === 'update') {
var executor = function(req, res, next) {
req.m = p;
@@ -752,7 +848,7 @@ HTTP.prototype.attach = function( maki ) {
var stack = [ regex ];
var pre = [];
var post = [];
-
+
pre.push(function setupMiddleware(req, res, next) {
req.resource = resource;
next();
@@ -801,14 +897,13 @@ HTTP.prototype.start = function( started ) {
// TODO: build an extensible service worker platform; events, triggers, etc.
self._workers.forEach(function(w) {
- var workerPath = __dirname + '/../../public/service.js'; // sadly at root :(
+ var workerPath = __dirname + '/../../public/worker.js'; // sadly at root :(
var worker = fs.createWriteStream(workerPath);
worker.on('open', function() {
fs.createReadStream(w).pipe(worker);
});
});
-
self.on('started', function() {
// TODO: final events, or mechanism for routes injected to Maki pre-start
setTimeout(function() {
@@ -822,14 +917,14 @@ HTTP.prototype.start = function( started ) {
// TODO: allow configurable certificate, supplied by config
// this will allow for standalone mode, as well as a "backend worker" mode.
pem.createCertificate({
- days: 1,
+ days: 90,
selfSigned: true
}, function(err, keys) {
var sslPort = self.maki.config.services.http.port + 443 - 80;
//self.maki.config.services.spdy.port = sslPort;
- self.maki.httpd = require('http').createServer( self.maki.app );
+ //self.maki.httpd = require('http').createServer( self.maki.app );
self.maki.spdyd = require('spdy').createServer({
key: keys.serviceKey,
cert: keys.certificate
diff --git a/maki.js b/maki.js
index 3eda8fd7..7fd58ad6 100644
--- a/maki.js
+++ b/maki.js
@@ -8,6 +8,8 @@ var passport = new Passport({
resource: 'Person'
});
maki.use( passport );
+maki.use(require('maki-client-level'));
+maki.use(require('maki-client-polymer'));
var CMS = require('maki-cms-local');
var cms = new CMS({
@@ -45,6 +47,8 @@ maki.use(developers);
maki.use(auth);
var Person = maki.define('Person', {
+ icon: 'user',
+ description: 'People are the most important part of Maki, and this is where we list them. We\'re not users, we\'re _people_, damnit.',
attributes: {
username: { type: String , max: 80 , required: true , slug: true },
name: {
@@ -56,13 +60,12 @@ var Person = maki.define('Person', {
email: { type: String , max: 80 , restricted: true },
created: { type: Date , default: Date.now }
},
- auth: {
+ /* auth: {
'patch': ['admin', function(done) {
var person = this;
return false;
}]
- },
- icon: 'user'
+ }, */
});
Person.post('patch', function(done) {
var person = this;
@@ -71,17 +74,24 @@ Person.post('patch', function(done) {
});
maki.define('Example', {
+ icon: 'idea',
+ description: 'A list of applications Made With Maki.',
+ source: 'data/examples.json',
+ components: {
+ query: 'maki-examples'
+ },
attributes: {
name: { type: String , max: 80 },
slug: { type: String , max: 80 , id: true },
content: { type: String },
screenshot: { type: 'File' }
},
- source: 'data/examples.json',
- icon: 'idea'
});
maki.define('Release', {
+ icon: 'tags',
+ description: 'Officially tagged releases of the Maki library.',
+ source: 'https://api.github.com/repos/martindale/maki/releases',
attributes: {
name: { type: String , max: 80 },
tag: { type: String , max: 80 },
@@ -89,8 +99,6 @@ maki.define('Release', {
published: { type: Date },
notes: { type: String , render: 'markdown' }
},
- source: 'https://api.github.com/repos/martindale/maki/releases',
- icon: 'tags',
map: function( release ) {
return {
name: release.name,
@@ -102,17 +110,36 @@ maki.define('Release', {
});
maki.define('Plugin', {
+ icon: 'puzzle',
+ description: 'Modules that extend the default Maki behaviors.',
attributes: {
name: { type: String , max: 80 },
description: { type: String },
version: { type: String , max: 10 },
coverage: { type: Number , default: 0 },
},
- icon: 'puzzle'
+});
+
+maki.define('Index', {
+ name: 'Index',
+ templates: {
+ query: 'splash'
+ },
+ components: {
+ query: 'maki-splash',
+ get: 'maki-splash'
+ },
+ routes: {
+ query: '/'
+ },
+ static: true,
+ //internal: true
});
/*var Analytics = require('maki-analytics');
var analytics = new Analytics({ id: 'UA-57746323-2' });
maki.use( analytics ).serve(['http']).start();*/
-maki.start();
+maki.start(function() {
+ console.log('routes:', maki.routes);
+});
diff --git a/package.json b/package.json
index 78c0adc2..6927f06f 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"async": "~0.7.0",
"body-parser": "~1.2.2",
"browserify": "^11.0.1",
+ "browserify-shim": "^3.8.12",
"coalescent": "^0.5.0-alpha.3",
"colors": "^1.0.3",
"connect-busboy": "0.0.2",
@@ -47,9 +48,11 @@
"json-patch": "^0.4.3",
"jsonpath-object-transform": "git://github.com/dvdln/jsonpath-object-transform",
"less-middleware": "git://github.com/martindale/less.js-middleware#maki",
- "lodash": "^2.4.1",
+ "lodash": "^4.6.1",
"maki-analytics": "git://github.com/martindale/maki-analytics",
"maki-auth-simple": "0.0.1",
+ "maki-client-level": "^0.1.0",
+ "maki-client-polymer": "git://github.com/martindale/maki-client-polymer",
"maki-cms-local": "0.0.2",
"maki-forms": "0.0.0",
"maki-jsonrpc": "^0.1.1",
@@ -68,6 +71,7 @@
"node-torrent-stream": "git://github.com/unusualbob/node-torrent-stream#master",
"node-uuid": "^1.4.1",
"path-to-regexp": "~0.2.1",
+ "peer": "^0.2.8",
"pem": "^1.4.1",
"pluralize": "^1.0.0",
"procure": "^0.1.4",
@@ -77,6 +81,7 @@
"spdy": "^1.28.1",
"speakingurl": "^1.1.0",
"streamifier": "^0.1.0",
+ "walk": "^2.3.9",
"ws": "~0.4.31"
},
"devDependencies": {
diff --git a/public/assets/async.min.js b/public/assets/async.min.js
new file mode 100644
index 00000000..9e8eaf4b
--- /dev/null
+++ b/public/assets/async.min.js
@@ -0,0 +1,2 @@
+!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.async=t.async||{})}(this,function(t){"use strict";function n(t,n,r){var e=r.length;switch(e){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function r(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function e(t){var n=r(t)?Zn.call(t):"";return n==Vn||n==Xn}function o(t){if(r(t)){var n=e(t.valueOf)?t.valueOf():t;t=r(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(nr,"");var o=er.test(t);return o||or.test(t)?ur(t.slice(2),o?2:8):rr.test(t)?tr:+t}function u(t){if(!t)return 0===t?t:0;if(t=o(t),t===ir||t===-ir){var n=0>t?-1:1;return n*cr}var r=t%1;return t===t?r?t-r:t:0}function i(t,r){if("function"!=typeof t)throw new TypeError(ar);return r=fr(void 0===r?t.length-1:u(r),0),function(){for(var e=arguments,o=-1,u=fr(e.length-r,0),i=Array(u);++o0&&(r=n.apply(this,arguments)),1>=t&&(n=void 0),r}}function s(t){return l(2,t)}function p(t){return function(n){return null==n?void 0:n[t]}}function y(t){return"number"==typeof t&&t>-1&&t%1==0&&pr>=t}function h(t){return null!=t&&y(sr(t))&&!e(t)}function v(t){return yr&&t[yr]&&t[yr]()}function d(t,n){return vr.call(t,n)||"object"==typeof t&&n in t&&null===dr(t)}function m(t){return mr(Object(t))}function g(t,n){for(var r=-1,e=Array(t);++r-1&&t%1==0&&n>t}function k(t){var n=t&&t.constructor,r="function"==typeof n&&n.prototype||Lr;return t===r}function E(t){var n=k(t);if(!n&&!h(t))return m(t);var r=S(t),e=!!r,o=r||[],u=o.length;for(var i in t)!d(t,i)||e&&("length"==i||_(i,u))||n&&"constructor"==i||o.push(i);return o}function A(t){var n,r=-1;if(h(t))return n=t.length,function(){return r++,n>r?{value:t[r],key:r}:null};var e=v(t);if(e)return function(){var t=e.next();return t.done?null:(r++,{value:t.value,key:r})};var o=E(t);return n=o.length,function(){r++;var e=o[r];return n>r?{value:t[e],key:e}:null}}function x(t){return function(){if(null===t)throw new Error("Callback was already called.");t.apply(this,arguments),t=null}}function L(t){return function(n,r,e){e=s(e||f),n=n||[];var o=A(n);if(0>=t)return e(null);var u=!1,i=0,c=!1;!function a(){if(u&&0>=i)return e(null);for(;t>i&&!c;){var n=o();if(null===n)return u=!0,void(0>=i&&e(null));i+=1,r(n.value,n.key,x(function(t){i-=1,t?(e(t),c=!0):a()}))}}()}}function I(t,n,r,e){L(n)(t,r,e)}function T(t,n){return function(r,e,o){return t(r,n,e,o)}}function F(t){return c(function(n,e){var o;try{o=t.apply(this,n)}catch(u){return e(u)}r(o)&&"function"==typeof o.then?o.then(function(t){e(null,t)})["catch"](function(t){e(t.message?t:new Error(t))}):e(null,o)})}function M(t,n){for(var r=-1,e=t.length;++rr&&(r=Pr(e+r,0)),q(t,n,r)):-1}function R(t,n,r){function e(t,n){m.push(function(){a(t,n)})}function o(){if(0===m.length&&0===h)return r(null,y);for(;m.length&&n>h;){var t=m.shift();t()}}function u(t,n){var r=d[t];r||(r=d[t]=[]),r.push(n)}function c(t){var n=d[t]||[];M(n,function(t){t()}),o()}function a(t,n){if(!v){var e=x(i(function(n,e){if(h--,e.length<=1&&(e=e[0]),n){var o={};B(y,function(t,n){o[n]=t}),o[t]=e,v=!0,d=[],r(n,o)}else y[t]=e,c(t)}));h++;var o=n[n.length-1];n.length>1?o(y,e):o(e)}}"function"==typeof n&&(r=n,n=null),r=s(r||f);var l=E(t),p=l.length;if(!p)return r(null);n||(n=p);var y={},h=0,v=!1,d={},m=[];B(t,function(n,r){function o(){for(var n,e=i.length;e--;){if(!(n=t[i[e]]))throw new Error("async.auto task `"+r+"` has non-existent dependency in "+i.join(", "));if(Sr(n)&&D(n,r)>=0)throw new Error("async.auto task `"+r+"`Has cyclic dependencies")}}if(!Sr(n))return void e(r,[n]);var i=n.slice(0,n.length-1),c=i.length;o(),M(i,function(t){u(t,function(){c--,0===c&&e(r,n)})})}),o()}function W(t,n){for(var r=-1,e=t.length,o=Array(e);++rr)return!1;var e=t.length-1;return r==e?t.pop():Br.call(t,r,1),!0}function J(t){var n=this.__data__,r=n.array;return r?H(r,t):n.map["delete"](t)}function K(t,n){var r=Q(t,n);return 0>r?void 0:t[r][1]}function V(t){var n=this.__data__,r=n.array;return r?K(r,t):n.map.get(t)}function X(t,n){return Q(t,n)>-1}function Y(t){var n=this.__data__,r=n.array;return r?X(r,t):n.map.has(t)}function Z(t){var n=!1;if(null!=t&&"function"!=typeof t.toString)try{n=!!(t+"")}catch(r){}return n}function tt(t){return null==t?!1:e(t)?Nr.test(Rr.call(t)):b(t)&&(Z(t)?Nr:qr).test(t)}function nt(t,n){var r=t[n];return tt(r)?r:void 0}function rt(){}function et(t){return t&&t.Object===Object?t:null}function ot(){this.__data__={hash:new rt,map:ne?new ne:[],string:new rt}}function ut(t,n){return Gr?void 0!==t[n]:ee.call(t,n)}function it(t,n){return ut(t,n)&&delete t[n]}function ct(t){var n=typeof t;return"number"==n||"boolean"==n||"string"==n&&"__proto__"!=t||null==t}function at(t){var n=this.__data__;return ct(t)?it("string"==typeof t?n.string:n.hash,t):ne?n.map["delete"](t):H(n.map,t)}function ft(t,n){if(Gr){var r=t[n];return r===oe?void 0:r}return ie.call(t,n)?t[n]:void 0}function lt(t){var n=this.__data__;return ct(t)?ft("string"==typeof t?n.string:n.hash,t):ne?n.map.get(t):K(n.map,t)}function st(t){var n=this.__data__;return ct(t)?ut("string"==typeof t?n.string:n.hash,t):ne?n.map.has(t):X(n.map,t)}function pt(t,n,r){var e=Q(t,n);0>e?t.push([n,r]):t[e][1]=r}function yt(t,n,r){t[n]=Gr&&void 0===r?ce:r}function ht(t,n){var r=this.__data__;return ct(t)?yt("string"==typeof t?r.string:r.hash,t,n):ne?r.map.set(t,n):pt(r.map,t,n),this}function vt(t){var n=-1,r=t?t.length:0;for(this.clear();++n=n;n++)Uo(c.process)}}};return c}function Qt(t,n){return Gt(t,1,n)}function Ht(t,n,r,e){Fr(t,function(t,e,o){r(n,t,function(t,r){n=r,o(t)})},function(t){e(t,n)})}function Jt(){var t=arguments;return i(function(n){var r=this,e=n[n.length-1];"function"==typeof e?n.pop():e=f,Ht(t,n,function(t,n,e){n.apply(r,t.concat([i(function(t,n){e(t,n)})]))},function(t,n){e.apply(r,[t].concat(n))})})}function Kt(){return Jt.apply(null,Po.call(arguments))}function Vt(t,n,r,e){var o=[];t(n,function(t,n,e){r(t,function(t,n){o=o.concat(n||[]),e(t)})},function(t){e(t,o)})}function Xt(t){return function(n,r,e){return t(Ir,n,r,e)}}function Yt(t){return function(n,r,e){return t(Fr,n,r,e)}}function Zt(t,n,r){return function(e,o,u,i){function c(t){i&&(t?i(t):i(null,r(!1)))}function a(t,e,o){return i?void u(t,function(e,c){i&&(e?(i(e),i=u=!1):n(c)&&(i(null,r(!0,t)),i=u=!1)),o()}):o()}arguments.length>3?t(e,o,a,c):(i=u,u=o,t(e,a,c))}}function tn(t,n){return n}function nn(t){return i(function(n,r){n.apply(null,r.concat([i(function(n,r){"object"==typeof console&&(n?console.error&&console.error(n):console[t]&&M(r,function(n){console[t](n)}))})]))})}function rn(t,n,r){r=r||f;var e=i(function(n,e){n?r(n):(e.push(o),t.apply(this,e))}),o=function(t,o){return t?r(t):o?void n(e):r(null)};t(o)}function en(t,n,r){var e=0;rn(function(t){return e++<1?t(null,!0):void n.apply(this,arguments)},t,r)}function on(t,n,r){if(r=r||f,!t())return r(null);var e=i(function(o,u){return o?r(o):t.apply(this,u)?n(e):void r.apply(null,[null].concat(u))});n(e)}function un(t,n,r){var e=0;return on(function(){return++e<=1||n.apply(this,arguments)},t,r)}function cn(t,n,r){return un(t,function(){return!n.apply(this,arguments)},r)}function an(t){return function(n,r,e){return t(n,e)}}function fn(t,n,r,e){return L(n)(t,an(r),e)}function ln(t){return c(function(n,r){var e=!0;n.push(function(){var t=arguments;e?Uo(function(){r.apply(null,t)}):r.apply(null,t)}),t.apply(this,n),e=!1})}function sn(t){return!t}function pn(t,n,r,e){var o=[];t(n,function(t,n,e){r(t,function(r,u){r?e(r):(u&&o.push({index:n,value:t}),e())})},function(t){t?e(t):e(null,W(o.sort(function(t,n){return t.index-n.index}),p("value")))})}function yn(t){return function(n,r,e,o){return t(L(r),n,e,o)}}function hn(t,n){function r(t){return t?e(t):void o(r)}var e=x(n||f),o=ln(t);r()}function vn(t){function n(r){function e(){return t.length&&t[r].apply(null,arguments),e.next()}return e.next=function(){return rn&&(n=-n>o?0:o+n),r=r>o?o:r,0>r&&(r+=o),o=n>r?0:r-n>>>0,n>>>=0;for(var u=Array(o);++er;)t=t[n[r++]];return r&&r==e?t:void 0}function kn(t,n,r){var e=null==t?void 0:_n(t,n);return void 0===e?r:e}function En(t,n){return 1==n.length?t:kn(t,Sn(n,0,-1))}function An(t,n,r){if(null==t)return!1;var e=r(t,n);e||wn(n)||(n=jn(n),t=En(t,n),null!=t&&(n=On(n),e=r(t,n)));var o=t?t.length:void 0;return e||!!o&&y(o)&&_(n,o)&&(Sr(t)||O(t)||w(t))}function xn(t,n){return An(t,n,d)}function Ln(t,n){var r=Object.create(null),e=Object.create(null);n=n||$;var o=c(function(o,u){var c=n.apply(null,o);xn(r,c)?Uo(function(){u.apply(null,r[c])}):xn(e,c)?e[c].push(u):(e[c]=[u],t.apply(null,o.concat([i(function(t){r[c]=t;var n=e[c];delete e[c];for(var o=0,u=n.length;u>o;o++)n[o].apply(null,t)})])))});return o.memo=r,o.unmemoized=t,o}function In(t,n,r){r=r||f;var e=h(n)?[]:{};t(n,function(t,n,r){t(i(function(t,o){o.length<=1&&(o=o[0]),e[n]=o,r(t)}))},function(t){r(t,e)})}function Tn(t,n,r){return In(L(n),t,r)}function Fn(t,n){return Gt(function(n,r){t(n[0],r)},n,1)}function Mn(t,n){function r(t,n){return t.priority-n.priority}function e(t,n,r){for(var e=-1,o=t.length-1;o>e;){var u=e+(o-e+1>>>1);r(n,t[u])>=0?e=u:o=u-1}return e}function o(t,n,o,u){if(null!=u&&"function"!=typeof u)throw new Error("task callback must be a function");return t.started=!0,Sr(n)||(n=[n]),0===n.length?Uo(function(){t.drain()}):void M(n,function(n){var i={data:n,priority:o,callback:"function"==typeof u?u:f};t.tasks.splice(e(t.tasks,i,r)+1,0,i),t.tasks.length===t.concurrency&&t.saturated(),t.tasks.length<=t.concurrency-t.buffer&&t.unsaturated(),Uo(t.process)})}var u=Fn(t,n);return u.push=function(t,n,r){o(u,t,n,r)},delete u.unshift,u}function $n(t,n){return function(r,e){if(null==r)return r;if(!h(r))return t(r,e);for(var o=r.length,u=n?o:-1,i=Object(r);(n?u--:++u0&&l.push(u(a.interval))}Cn(l,function(t,n){n=n[n.length-1],r(n.err,n.result)})}function Dn(t,n){return n||(n=t,t=null),c(function(r,e){function o(t){n.apply(null,r.concat([t]))}t?qn(t,o,e):qn(o,e)})}function Rn(t,n,r){function e(t,n){var r=t.criteria,e=n.criteria;return e>r?-1:r>e?1:0}tu(t,function(t,r){n(t,function(n,e){return n?r(n):void r(null,{value:t,criteria:e})})},function(t,n){return t?r(t):void r(null,W(n.sort(e),p("value")))})}function Wn(t,n){function r(){i||(o.apply(null,arguments),clearTimeout(u))}function e(){var t=new Error("Callback function timed out.");t.code="ETIMEDOUT",i=!0,o(t)}var o,u,i=!1;return c(function(i,c){o=c,u=setTimeout(e,n),t.apply(null,i.concat(r))})}function Nn(t,n,r,e){for(var o=-1,u=Ou(wu((n-t)/(r||1)),0),i=Array(u);u--;)i[e?u:++o]=t,t+=r;return i}function Gn(t,n,r,e){return Zo(Nn(0,t,1),n,r,e)}function Qn(t,n,r,e){3===arguments.length&&(e=r,r=n,n=Sr(t)?[]:{}),Ir(t,function(t,e,o){r(n,t,e,o)},function(t){e(t,n)})}function Hn(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Jn(t,n,r){return on(function(){return!t.apply(this,arguments)},n,r)}function Kn(t,n){function r(o){if(e===t.length)return n.apply(null,[null].concat(o));var u=x(i(function(t,e){return t?n.apply(null,[t].concat(e)):void r(e)}));o.push(u);var c=t[e++];c.apply(null,o)}if(n=s(n||f),!Sr(t))return n(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return n();var e=0;r([])}var Vn="[object Function]",Xn="[object GeneratorFunction]",Yn=Object.prototype,Zn=Yn.toString,tr=NaN,nr=/^\s+|\s+$/g,rr=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,or=/^0o[0-7]+$/i,ur=parseInt,ir=1/0,cr=1.7976931348623157e308,ar="Expected a function",fr=Math.max,lr="Expected a function",sr=p("length"),pr=9007199254740991,yr="function"==typeof Symbol&&Symbol.iterator,hr=Object.prototype,vr=hr.hasOwnProperty,dr=Object.getPrototypeOf,mr=Object.keys,gr="[object Arguments]",br=Object.prototype,jr=br.hasOwnProperty,wr=br.toString,Or=br.propertyIsEnumerable,Sr=Array.isArray,_r="[object String]",kr=Object.prototype,Er=kr.toString,Ar=9007199254740991,xr=/^(?:0|[1-9]\d*)$/,Lr=Object.prototype,Ir=T(I,1/0),Tr=a(Ir),Fr=T(I,1),Mr=a(Fr),$r=i(function(t,n){return i(function(r){return t.apply(null,n.concat(r))})}),Ur=P(),Pr=Math.max,zr=Array.prototype,Br=zr.splice,Cr=/[\\^$.*+?()[\]{}|]/g,qr=/^\[object .+?Constructor\]$/,Dr=Object.prototype,Rr=Function.prototype.toString,Wr=Dr.hasOwnProperty,Nr=RegExp("^"+Rr.call(Wr).replace(Cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gr=nt(Object,"create"),Qr=Object.prototype;rt.prototype=Gr?Gr(null):Qr;var Hr={"function":!0,object:!0},Jr=Hr[typeof t]&&t&&!t.nodeType?t:void 0,Kr=Hr[typeof module]&&module&&!module.nodeType?module:void 0,Vr=et(Jr&&Kr&&"object"==typeof global&&global),Xr=et(Hr[typeof self]&&self),Yr=et(Hr[typeof window]&&window),Zr=et(Hr[typeof this]&&this),te=Vr||Yr!==(Zr&&Zr.window)&&Yr||Xr||Zr||Function("return this")(),ne=nt(te,"Map"),re=Object.prototype,ee=re.hasOwnProperty,oe="__lodash_hash_undefined__",ue=Object.prototype,ie=ue.hasOwnProperty,ce="__lodash_hash_undefined__";vt.prototype.clear=ot,vt.prototype["delete"]=at,vt.prototype.get=lt,vt.prototype.has=st,vt.prototype.set=ht;var ae=200;mt.prototype.clear=N,mt.prototype["delete"]=J,mt.prototype.get=V,mt.prototype.has=Y,mt.prototype.set=dt;var fe=Object.prototype,le=fe.hasOwnProperty,se=Object.getOwnPropertySymbols,pe=se||function(){return[]},ye=nt(te,"Set"),he=nt(te,"WeakMap"),ve="[object Map]",de="[object Object]",me="[object Set]",ge="[object WeakMap]",be=Object.prototype,je=Function.prototype.toString,we=be.toString,Oe=ne?je.call(ne):"",Se=ye?je.call(ye):"",_e=he?je.call(he):"";(ne&&kt(new ne)!=ve||ye&&kt(new ye)!=me||he&&kt(new he)!=ge)&&(kt=function(t){var n=we.call(t),r=n==de?t.constructor:null,e="function"==typeof r?je.call(r):"";if(e)switch(e){case Oe:return ve;case Se:return me;case _e:return ge}return n});var ke=kt,Ee=Object.prototype,Ae=Ee.hasOwnProperty,xe=te.Uint8Array,Le=/\w*$/,Ie=te.Symbol,Te=Ie?Ie.prototype:void 0,Fe=Te?Te.valueOf:void 0,Me="[object Boolean]",$e="[object Date]",Ue="[object Map]",Pe="[object Number]",ze="[object RegExp]",Be="[object Set]",Ce="[object String]",qe="[object Symbol]",De="[object ArrayBuffer]",Re="[object Float32Array]",We="[object Float64Array]",Ne="[object Int8Array]",Ge="[object Int16Array]",Qe="[object Int32Array]",He="[object Uint8Array]",Je="[object Uint8ClampedArray]",Ke="[object Uint16Array]",Ve="[object Uint32Array]",Xe=Object.create,Ye=Object.getPrototypeOf,Ze={"function":!0,object:!0},to=Ze[typeof t]&&t&&!t.nodeType?t:void 0,no=Ze[typeof module]&&module&&!module.nodeType?module:void 0,ro=no&&no.exports===to?to:void 0,eo=ro?te.Buffer:void 0,oo=eo?function(t){return t instanceof eo}:Dt(!1),uo="[object Arguments]",io="[object Array]",co="[object Boolean]",ao="[object Date]",fo="[object Error]",lo="[object Function]",so="[object GeneratorFunction]",po="[object Map]",yo="[object Number]",ho="[object Object]",vo="[object RegExp]",mo="[object Set]",go="[object String]",bo="[object Symbol]",jo="[object WeakMap]",wo="[object ArrayBuffer]",Oo="[object Float32Array]",So="[object Float64Array]",_o="[object Int8Array]",ko="[object Int16Array]",Eo="[object Int32Array]",Ao="[object Uint8Array]",xo="[object Uint8ClampedArray]",Lo="[object Uint16Array]",Io="[object Uint32Array]",To={};To[uo]=To[io]=To[wo]=To[co]=To[ao]=To[Oo]=To[So]=To[_o]=To[ko]=To[Eo]=To[po]=To[yo]=To[ho]=To[vo]=To[mo]=To[go]=To[bo]=To[Ao]=To[xo]=To[Lo]=To[Io]=!0,To[fo]=To[lo]=To[jo]=!1;var Fo,Mo=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,$o="function"==typeof setImmediate&&setImmediate;Fo=$o?$o:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:function(t){setTimeout(t,0)};var Uo=i(function(t,n){Fo(function(){t.apply(null,n)})}),Po=Array.prototype.reverse,zo=Xt(Vt),Bo=Yt(Vt),Co=i(function(t){var n=[null].concat(t);return c(function(t,r){return r.apply(this,n)})}),qo=Zt(Ir,$,tn),Do=Zt(I,$,tn),Ro=Zt(Fr,$,tn),Wo=nn("dir"),No=T(fn,1/0),Go=T(fn,1),Qo=Zt(I,sn,sn),Ho=T(Qo,1/0),Jo=T(Qo,1),Ko=yn(pn),Vo=T(Ko,1/0),Xo=T(Ko,1),Yo=nn("log"),Zo=yn(dn),tu=T(Zo,1/0),nu=T(Zo,1),ru="[object Symbol]",eu=Object.prototype,ou=eu.toString,uu=1/0,iu=Ie?Ie.prototype:void 0,cu=iu?iu.toString:void 0,au=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,fu=/\\(\\)?/g,lu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,su=/^\w*$/,pu=T(Tn,1/0),yu=$n(z),hu=Array.prototype.slice,vu=yn(Bn),du=T(vu,1/0),mu=T(vu,1),gu=Zt(I,Boolean,$),bu=T(gu,1/0),ju=T(gu,1),wu=Math.ceil,Ou=Math.max,Su=T(Gn,1/0),_u=T(Gn,1),ku={applyEach:Tr,applyEachSeries:Mr,apply:$r,asyncify:F,auto:R,autoInject:Nt,cargo:Qt,compose:Kt,concat:zo,concatSeries:Bo,constant:Co,detect:qo,detectLimit:Do,detectSeries:Ro,dir:Wo,doDuring:en,doUntil:cn,doWhilst:un,during:rn,each:No,eachLimit:fn,eachOf:Ir,eachOfLimit:I,eachOfSeries:Fr,eachSeries:Go,ensureAsync:ln,every:Ho,everyLimit:Qo,everySeries:Jo,filter:Vo,filterLimit:Ko,filterSeries:Xo,forever:hn,iterator:vn,log:Yo,map:tu,mapLimit:Zo,mapSeries:nu,memoize:Ln,nextTick:Uo,parallel:pu,parallelLimit:Tn,priorityQueue:Mn,queue:Fn,race:Pn,reduce:Ht,reduceRight:zn,reject:du,rejectLimit:vu,rejectSeries:mu,retry:qn,retryable:Dn,seq:Jt,series:Cn,setImmediate:Uo,some:bu,someLimit:gu,someSeries:ju,sortBy:Rn,timeout:Wn,times:Su,timesLimit:Gn,timesSeries:_u,transform:Qn,unmemoize:Hn,until:Jn,waterfall:Kn,whilst:on,all:Ho,any:bu,forEach:No,forEachSeries:Go,forEachLimit:fn,forEachOf:Ir,forEachOfSeries:Fr,forEachOfLimit:I,inject:Ht,foldl:Ht,foldr:zn,select:Vo,selectLimit:Ko,selectSeries:Xo,wrapSync:F};t["default"]=ku,t.applyEach=Tr,t.applyEachSeries=Mr,t.apply=$r,t.asyncify=F,t.auto=R,t.autoInject=Nt,t.cargo=Qt,t.compose=Kt,t.concat=zo,t.concatSeries=Bo,t.constant=Co,t.detect=qo,t.detectLimit=Do,t.detectSeries=Ro,t.dir=Wo,t.doDuring=en,t.doUntil=cn,t.doWhilst=un,t.during=rn,t.each=No,t.eachLimit=fn,t.eachOf=Ir,t.eachOfLimit=I,t.eachOfSeries=Fr,t.eachSeries=Go,t.ensureAsync=ln,t.every=Ho,t.everyLimit=Qo,t.everySeries=Jo,t.filter=Vo,t.filterLimit=Ko,t.filterSeries=Xo,t.forever=hn,t.iterator=vn,t.log=Yo,t.map=tu,t.mapLimit=Zo,t.mapSeries=nu,t.memoize=Ln,t.nextTick=Uo,t.parallel=pu,t.parallelLimit=Tn,t.priorityQueue=Mn,t.queue=Fn,t.race=Pn,t.reduce=Ht,t.reduceRight=zn,t.reject=du,t.rejectLimit=vu,t.rejectSeries=mu,t.retry=qn,t.retryable=Dn,t.seq=Jt,t.series=Cn,t.setImmediate=Uo,t.some=bu,t.someLimit=gu,t.someSeries=ju,t.sortBy=Rn,t.timeout=Wn,t.times=Su,t.timesLimit=Gn,t.timesSeries=_u,t.transform=Qn,t.unmemoize=Hn,t.until=Jn,t.waterfall=Kn,t.whilst=on,t.all=Ho,t.allLimit=Qo,t.allSeries=Jo,t.any=bu,t.anyLimit=gu,t.anySeries=ju,t.find=qo,t.findLimit=Do,t.findSeries=Ro,t.forEach=No,t.forEachSeries=Go,t.forEachLimit=fn,t.forEachOf=Ir,t.forEachOfSeries=Fr,t.forEachOfLimit=I,t.inject=Ht,t.foldl=Ht,t.foldr=zn,t.select=Vo,t.selectLimit=Ko,t.selectSeries=Xo,t.wrapSync=F});
+//# sourceMappingURL=dist/async.min.map
\ No newline at end of file
diff --git a/public/assets/bitcore-mnemonic.min.js b/public/assets/bitcore-mnemonic.min.js
new file mode 100644
index 00000000..fb8bf55e
--- /dev/null
+++ b/public/assets/bitcore-mnemonic.min.js
@@ -0,0 +1,15 @@
+require=function e(t,r,i){function n(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var u=r[o]={exports:{}};t[o][0].call(u.exports,function(e){var r=t[o][1][e];return n(r?r:e)},u,u.exports,e,t,r,i)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;on)throw new i.errors.InvalidArgument("ENT","Values must be ENT > 128 and ENT % 32 == 0");s=s||h._mnemonic(n,t),Object.defineProperty(this,"wordlist",{configurable:!1,value:t}),Object.defineProperty(this,"phrase",{configurable:!1,value:s})};h.Words=e("./words"),h.isValid=function(e,t){if(e=a.nfkd(e),t=t||h._getDictionary(e),!t)return!1;for(var i=e.split(" "),n="",o=0;os)return!1;n+=("00000000000"+s.toString(2)).slice(-11)}var c=n.length/33,f=n.slice(-c),u=n.slice(0,n.length-c),d=new r(u.length/8);for(o=0;on)return!1}return!0},h._getDictionary=function(e){if(!e)return null;for(var t=Object.keys(h.Words),r=0;r"},h._mnemonic=function(e,t){var r=u.getRandomBuffer(e/8);return h._entropy2mnemonic(r,t)},h._entropy2mnemonic=function(e,t){for(var r="",i=0;i(Math.pow(2,32)-1)*o)throw Error("Requested key length too long");if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError("key must a string or Buffer");if("string"!=typeof t&&!r.isBuffer(t))throw new TypeError("salt must a string or Buffer");"string"==typeof e&&(e=new r(e)),"string"==typeof t&&(t=new r(t));var s=new r(a),c=new r(o),f=new r(o),u=new r(t.length+4),d=Math.ceil(a/o),h=a-(d-1)*o;t.copy(u,0,0,t.length);for(var l=1;d>=l;l++){u[t.length+0]=l>>24&255,u[t.length+1]=l>>16&255,u[t.length+2]=l>>8&255,u[t.length+3]=l>>0&255,c=n.createHmac("sha512",e).update(u).digest(),c.copy(f,0,0,o);for(var p=1;i>p;p++){c=n.createHmac("sha512",e).update(c).digest();for(var b=0;o>b;b++)f[b]^=c[b]}var m=(l-1)*o,g=l===d?h:o;f.copy(s,m,0,g)}return s}var n=e("crypto");t.exports=i}).call(this,e("buffer").Buffer)},{buffer:11,crypto:15}],4:[function(e,t,r){"use strict";var i=["的","一","是","在","不","了","有","和","人","这","中","大","为","上","个","国","我","以","要","他","时","来","用","们","生","到","作","地","于","出","就","分","对","成","会","可","主","发","年","动","同","工","也","能","下","过","子","说","产","种","面","而","方","后","多","定","行","学","法","所","民","得","经","十","三","之","进","着","等","部","度","家","电","力","里","如","水","化","高","自","二","理","起","小","物","现","实","加","量","都","两","体","制","机","当","使","点","从","业","本","去","把","性","好","应","开","它","合","还","因","由","其","些","然","前","外","天","政","四","日","那","社","义","事","平","形","相","全","表","间","样","与","关","各","重","新","线","内","数","正","心","反","你","明","看","原","又","么","利","比","或","但","质","气","第","向","道","命","此","变","条","只","没","结","解","问","意","建","月","公","无","系","军","很","情","者","最","立","代","想","已","通","并","提","直","题","党","程","展","五","果","料","象","员","革","位","入","常","文","总","次","品","式","活","设","及","管","特","件","长","求","老","头","基","资","边","流","路","级","少","图","山","统","接","知","较","将","组","见","计","别","她","手","角","期","根","论","运","农","指","几","九","区","强","放","决","西","被","干","做","必","战","先","回","则","任","取","据","处","队","南","给","色","光","门","即","保","治","北","造","百","规","热","领","七","海","口","东","导","器","压","志","世","金","增","争","济","阶","油","思","术","极","交","受","联","什","认","六","共","权","收","证","改","清","美","再","采","转","更","单","风","切","打","白","教","速","花","带","安","场","身","车","例","真","务","具","万","每","目","至","达","走","积","示","议","声","报","斗","完","类","八","离","华","名","确","才","科","张","信","马","节","话","米","整","空","元","况","今","集","温","传","土","许","步","群","广","石","记","需","段","研","界","拉","林","律","叫","且","究","观","越","织","装","影","算","低","持","音","众","书","布","复","容","儿","须","际","商","非","验","连","断","深","难","近","矿","千","周","委","素","技","备","半","办","青","省","列","习","响","约","支","般","史","感","劳","便","团","往","酸","历","市","克","何","除","消","构","府","称","太","准","精","值","号","率","族","维","划","选","标","写","存","候","毛","亲","快","效","斯","院","查","江","型","眼","王","按","格","养","易","置","派","层","片","始","却","专","状","育","厂","京","识","适","属","圆","包","火","住","调","满","县","局","照","参","红","细","引","听","该","铁","价","严","首","底","液","官","德","随","病","苏","失","尔","死","讲","配","女","黄","推","显","谈","罪","神","艺","呢","席","含","企","望","密","批","营","项","防","举","球","英","氧","势","告","李","台","落","木","帮","轮","破","亚","师","围","注","远","字","材","排","供","河","态","封","另","施","减","树","溶","怎","止","案","言","士","均","武","固","叶","鱼","波","视","仅","费","紧","爱","左","章","早","朝","害","续","轻","服","试","食","充","兵","源","判","护","司","足","某","练","差","致","板","田","降","黑","犯","负","击","范","继","兴","似","余","坚","曲","输","修","故","城","夫","够","送","笔","船","占","右","财","吃","富","春","职","觉","汉","画","功","巴","跟","虽","杂","飞","检","吸","助","升","阳","互","初","创","抗","考","投","坏","策","古","径","换","未","跑","留","钢","曾","端","责","站","简","述","钱","副","尽","帝","射","草","冲","承","独","令","限","阿","宣","环","双","请","超","微","让","控","州","良","轴","找","否","纪","益","依","优","顶","础","载","倒","房","突","坐","粉","敌","略","客","袁","冷","胜","绝","析","块","剂","测","丝","协","诉","念","陈","仍","罗","盐","友","洋","错","苦","夜","刑","移","频","逐","靠","混","母","短","皮","终","聚","汽","村","云","哪","既","距","卫","停","烈","央","察","烧","迅","境","若","印","洲","刻","括","激","孔","搞","甚","室","待","核","校","散","侵","吧","甲","游","久","菜","味","旧","模","湖","货","损","预","阻","毫","普","稳","乙","妈","植","息","扩","银","语","挥","酒","守","拿","序","纸","医","缺","雨","吗","针","刘","啊","急","唱","误","训","愿","审","附","获","茶","鲜","粮","斤","孩","脱","硫","肥","善","龙","演","父","渐","血","欢","械","掌","歌","沙","刚","攻","谓","盾","讨","晚","粒","乱","燃","矛","乎","杀","药","宁","鲁","贵","钟","煤","读","班","伯","香","介","迫","句","丰","培","握","兰","担","弦","蛋","沉","假","穿","执","答","乐","谁","顺","烟","缩","征","脸","喜","松","脚","困","异","免","背","星","福","买","染","井","概","慢","怕","磁","倍","祖","皇","促","静","补","评","翻","肉","践","尼","衣","宽","扬","棉","希","伤","操","垂","秋","宜","氢","套","督","振","架","亮","末","宪","庆","编","牛","触","映","雷","销","诗","座","居","抓","裂","胞","呼","娘","景","威","绿","晶","厚","盟","衡","鸡","孙","延","危","胶","屋","乡","临","陆","顾","掉","呀","灯","岁","措","束","耐","剧","玉","赵","跳","哥","季","课","凯","胡","额","款","绍","卷","齐","伟","蒸","殖","永","宗","苗","川","炉","岩","弱","零","杨","奏","沿","露","杆","探","滑","镇","饭","浓","航","怀","赶","库","夺","伊","灵","税","途","灭","赛","归","召","鼓","播","盘","裁","险","康","唯","录","菌","纯","借","糖","盖","横","符","私","努","堂","域","枪","润","幅","哈","竟","熟","虫","泽","脑","壤","碳","欧","遍","侧","寨","敢","彻","虑","斜","薄","庭","纳","弹","饲","伸","折","麦","湿","暗","荷","瓦","塞","床","筑","恶","户","访","塔","奇","透","梁","刀","旋","迹","卡","氯","遇","份","毒","泥","退","洗","摆","灰","彩","卖","耗","夏","择","忙","铜","献","硬","予","繁","圈","雪","函","亦","抽","篇","阵","阴","丁","尺","追","堆","雄","迎","泛","爸","楼","避","谋","吨","野","猪","旗","累","偏","典","馆","索","秦","脂","潮","爷","豆","忽","托","惊","塑","遗","愈","朱","替","纤","粗","倾","尚","痛","楚","谢","奋","购","磨","君","池","旁","碎","骨","监","捕","弟","暴","割","贯","殊","释","词","亡","壁","顿","宝","午","尘","闻","揭","炮","残","冬","桥","妇","警","综","招","吴","付","浮","遭","徐","您","摇","谷","赞","箱","隔","订","男","吹","园","纷","唐","败","宋","玻","巨","耕","坦","荣","闭","湾","键","凡","驻","锅","救","恩","剥","凝","碱","齿","截","炼","麻","纺","禁","废","盛","版","缓","净","睛","昌","婚","涉","筒","嘴","插","岸","朗","庄","街","藏","姑","贸","腐","奴","啦","惯","乘","伙","恢","匀","纱","扎","辩","耳","彪","臣","亿","璃","抵","脉","秀","萨","俄","网","舞","店","喷","纵","寸","汗","挂","洪","贺","闪","柬","爆","烯","津","稻","墙","软","勇","像","滚","厘","蒙","芳","肯","坡","柱","荡","腿","仪","旅","尾","轧","冰","贡","登","黎","削","钻","勒","逃","障","氨","郭","峰","币","港","伏","轨","亩","毕","擦","莫","刺","浪","秘","援","株","健","售","股","岛","甘","泡","睡","童","铸","汤","阀","休","汇","舍","牧","绕","炸","哲","磷","绩","朋","淡","尖","启","陷","柴","呈","徒","颜","泪","稍","忘","泵","蓝","拖","洞","授","镜","辛","壮","锋","贫","虚","弯","摩","泰","幼","廷","尊","窗","纲","弄","隶","疑","氏","宫","姐","震","瑞","怪","尤","琴","循","描","膜","违","夹","腰","缘","珠","穷","森","枝","竹","沟","催","绳","忆","邦","剩","幸","浆","栏","拥","牙","贮","礼","滤","钠","纹","罢","拍","咱","喊","袖","埃","勤","罚","焦","潜","伍","墨","欲","缝","姓","刊","饱","仿","奖","铝","鬼","丽","跨","默","挖","链","扫","喝","袋","炭","污","幕","诸","弧","励","梅","奶","洁","灾","舟","鉴","苯","讼","抱","毁","懂","寒","智","埔","寄","届","跃","渡","挑","丹","艰","贝","碰","拔","爹","戴","码","梦","芽","熔","赤","渔","哭","敬","颗","奔","铅","仲","虎","稀","妹","乏","珍","申","桌","遵","允","隆","螺","仓","魏","锐","晓","氮","兼","隐","碍","赫","拨","忠","肃","缸","牵","抢","博","巧","壳","兄","杜","讯","诚","碧","祥","柯","页","巡","矩","悲","灌","龄","伦","票","寻","桂","铺","圣","恐","恰","郑","趣","抬","荒","腾","贴","柔","滴","猛","阔","辆","妻","填","撤","储","签","闹","扰","紫","砂","递","戏","吊","陶","伐","喂","疗","瓶","婆","抚","臂","摸","忍","虾","蜡","邻","胸","巩","挤","偶","弃","槽","劲","乳","邓","吉","仁","烂","砖","租","乌","舰","伴","瓜","浅","丙","暂","燥","橡","柳","迷","暖","牌","秧","胆","详","簧","踏","瓷","谱","呆","宾","糊","洛","辉","愤","竞","隙","怒","粘","乃","绪","肩","籍","敏","涂","熙","皆","侦","悬","掘","享","纠","醒","狂","锁","淀","恨","牲","霸","爬","赏","逆","玩","陵","祝","秒","浙","貌","役","彼","悉","鸭","趋","凤","晨","畜","辈","秩","卵","署","梯","炎","滩","棋","驱","筛","峡","冒","啥","寿","译","浸","泉","帽","迟","硅","疆","贷","漏","稿","冠","嫩","胁","芯","牢","叛","蚀","奥","鸣","岭","羊","凭","串","塘","绘","酵","融","盆","锡","庙","筹","冻","辅","摄","袭","筋","拒","僚","旱","钾","鸟","漆","沈","眉","疏","添","棒","穗","硝","韩","逼","扭","侨","凉","挺","碗","栽","炒","杯","患","馏","劝","豪","辽","勃","鸿","旦","吏","拜","狗","埋","辊","掩","饮","搬","骂","辞","勾","扣","估","蒋","绒","雾","丈","朵","姆","拟","宇","辑","陕","雕","偿","蓄","崇","剪","倡","厅","咬","驶","薯","刷","斥","番","赋","奉","佛","浇","漫","曼","扇","钙","桃","扶","仔","返","俗","亏","腔","鞋","棱","覆","框","悄","叔","撞","骗","勘","旺","沸","孤","吐","孟","渠","屈","疾","妙","惜","仰","狠","胀","谐","抛","霉","桑","岗","嘛","衰","盗","渗","脏","赖","涌","甜","曹","阅","肌","哩","厉","烃","纬","毅","昨","伪","症","煮","叹","钉","搭","茎","笼","酷","偷","弓","锥","恒","杰","坑","鼻","翼","纶","叙","狱","逮","罐","络","棚","抑","膨","蔬","寺","骤","穆","冶","枯","册","尸","凸","绅","坯","牺","焰","轰","欣","晋","瘦","御","锭","锦","丧","旬","锻","垄","搜","扑","邀","亭","酯","迈","舒","脆","酶","闲","忧","酚","顽","羽","涨","卸","仗","陪","辟","惩","杭","姚","肚","捉","飘","漂","昆","欺","吾","郎","烷","汁","呵","饰","萧","雅","邮","迁","燕","撒","姻","赴","宴","烦","债","帐","斑","铃","旨","醇","董","饼","雏","姿","拌","傅","腹","妥","揉","贤","拆","歪","葡","胺","丢","浩","徽","昂","垫","挡","览","贪","慰","缴","汪","慌","冯","诺","姜","谊","凶","劣","诬","耀","昏","躺","盈","骑","乔","溪","丛","卢","抹","闷","咨","刮","驾","缆","悟","摘","铒","掷","颇","幻","柄","惠","惨","佳","仇","腊","窝","涤","剑","瞧","堡","泼","葱","罩","霍","捞","胎","苍","滨","俩","捅","湘","砍","霞","邵","萄","疯","淮","遂","熊","粪","烘","宿","档","戈","驳","嫂","裕","徙","箭","捐","肠","撑","晒","辨","殿","莲","摊","搅","酱","屏","疫","哀","蔡","堵","沫","皱","畅","叠","阁","莱","敲","辖","钩","痕","坝","巷","饿","祸","丘","玄","溜","曰","逻","彭","尝","卿","妨","艇","吞","韦","怨","矮","歇"];t.exports=i},{}],5:[function(e,t,r){"use strict";var i=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];t.exports=i},{}],6:[function(e,t,r){"use string";var i=["abaisser","abandon","abdiquer","abeille","abolir","aborder","aboutir","aboyer","abrasif","abreuver","abriter","abroger","abrupt","absence","absolu","absurde","abusif","abyssal","académie","acajou","acarien","accabler","accepter","acclamer","accolade","accroche","accuser","acerbe","achat","acheter","aciduler","acier","acompte","acquérir","acronyme","acteur","actif","actuel","adepte","adéquat","adhésif","adjectif","adjuger","admettre","admirer","adopter","adorer","adoucir","adresse","adroit","adulte","adverbe","aérer","aéronef","affaire","affecter","affiche","affreux","affubler","agacer","agencer","agile","agiter","agrafer","agréable","agrume","aider","aiguille","ailier","aimable","aisance","ajouter","ajuster","alarmer","alchimie","alerte","algèbre","algue","aliéner","aliment","alléger","alliage","allouer","allumer","alourdir","alpaga","altesse","alvéole","amateur","ambigu","ambre","aménager","amertume","amidon","amiral","amorcer","amour","amovible","amphibie","ampleur","amusant","analyse","anaphore","anarchie","anatomie","ancien","anéantir","angle","angoisse","anguleux","animal","annexer","annonce","annuel","anodin","anomalie","anonyme","anormal","antenne","antidote","anxieux","apaiser","apéritif","aplanir","apologie","appareil","appeler","apporter","appuyer","aquarium","aqueduc","arbitre","arbuste","ardeur","ardoise","argent","arlequin","armature","armement","armoire","armure","arpenter","arracher","arriver","arroser","arsenic","artériel","article","aspect","asphalte","aspirer","assaut","asservir","assiette","associer","assurer","asticot","astre","astuce","atelier","atome","atrium","atroce","attaque","attentif","attirer","attraper","aubaine","auberge","audace","audible","augurer","aurore","automne","autruche","avaler","avancer","avarice","avenir","averse","aveugle","aviateur","avide","avion","aviser","avoine","avouer","avril","axial","axiome","badge","bafouer","bagage","baguette","baignade","balancer","balcon","baleine","balisage","bambin","bancaire","bandage","banlieue","bannière","banquier","barbier","baril","baron","barque","barrage","bassin","bastion","bataille","bateau","batterie","baudrier","bavarder","belette","bélier","belote","bénéfice","berceau","berger","berline","bermuda","besace","besogne","bétail","beurre","biberon","bicycle","bidule","bijou","bilan","bilingue","billard","binaire","biologie","biopsie","biotype","biscuit","bison","bistouri","bitume","bizarre","blafard","blague","blanchir","blessant","blinder","blond","bloquer","blouson","bobard","bobine","boire","boiser","bolide","bonbon","bondir","bonheur","bonifier","bonus","bordure","borne","botte","boucle","boueux","bougie","boulon","bouquin","bourse","boussole","boutique","boxeur","branche","brasier","brave","brebis","brèche","breuvage","bricoler","brigade","brillant","brioche","brique","brochure","broder","bronzer","brousse","broyeur","brume","brusque","brutal","bruyant","buffle","buisson","bulletin","bureau","burin","bustier","butiner","butoir","buvable","buvette","cabanon","cabine","cachette","cadeau","cadre","caféine","caillou","caisson","calculer","calepin","calibre","calmer","calomnie","calvaire","camarade","caméra","camion","campagne","canal","caneton","canon","cantine","canular","capable","caporal","caprice","capsule","capter","capuche","carabine","carbone","caresser","caribou","carnage","carotte","carreau","carton","cascade","casier","casque","cassure","causer","caution","cavalier","caverne","caviar","cédille","ceinture","céleste","cellule","cendrier","censurer","central","cercle","cérébral","cerise","cerner","cerveau","cesser","chagrin","chaise","chaleur","chambre","chance","chapitre","charbon","chasseur","chaton","chausson","chavirer","chemise","chenille","chéquier","chercher","cheval","chien","chiffre","chignon","chimère","chiot","chlorure","chocolat","choisir","chose","chouette","chrome","chute","cigare","cigogne","cimenter","cinéma","cintrer","circuler","cirer","cirque","citerne","citoyen","citron","civil","clairon","clameur","claquer","classe","clavier","client","cligner","climat","clivage","cloche","clonage","cloporte","cobalt","cobra","cocasse","cocotier","coder","codifier","coffre","cogner","cohésion","coiffer","coincer","colère","colibri","colline","colmater","colonel","combat","comédie","commande","compact","concert","conduire","confier","congeler","connoter","consonne","contact","convexe","copain","copie","corail","corbeau","cordage","corniche","corpus","correct","cortège","cosmique","costume","coton","coude","coupure","courage","couteau","couvrir","coyote","crabe","crainte","cravate","crayon","créature","créditer","crémeux","creuser","crevette","cribler","crier","cristal","critère","croire","croquer","crotale","crucial","cruel","crypter","cubique","cueillir","cuillère","cuisine","cuivre","culminer","cultiver","cumuler","cupide","curatif","curseur","cyanure","cycle","cylindre","cynique","daigner","damier","danger","danseur","dauphin","débattre","débiter","déborder","débrider","débutant","décaler","décembre","déchirer","décider","déclarer","décorer","décrire","décupler","dédale","déductif","déesse","défensif","défiler","défrayer","dégager","dégivrer","déglutir","dégrafer","déjeuner","délice","déloger","demander","demeurer","démolir","dénicher","dénouer","dentelle","dénuder","départ","dépenser","déphaser","déplacer","déposer","déranger","dérober","désastre","descente","désert","désigner","désobéir","dessiner","destrier","détacher","détester","détourer","détresse","devancer","devenir","deviner","devoir","diable","dialogue","diamant","dicter","différer","digérer","digital","digne","diluer","dimanche","diminuer","dioxyde","directif","diriger","discuter","disposer","dissiper","distance","divertir","diviser","docile","docteur","dogme","doigt","domaine","domicile","dompter","donateur","donjon","donner","dopamine","dortoir","dorure","dosage","doseur","dossier","dotation","douanier","double","douceur","douter","doyen","dragon","draper","dresser","dribbler","droiture","duperie","duplexe","durable","durcir","dynastie","éblouir","écarter","écharpe","échelle","éclairer","éclipse","éclore","écluse","école","économie","écorce","écouter","écraser","écrémer","écrivain","écrou","écume","écureuil","édifier","éduquer","effacer","effectif","effigie","effort","effrayer","effusion","égaliser","égarer","éjecter","élaborer","élargir","électron","élégant","éléphant","élève","éligible","élitisme","éloge","élucider","éluder","emballer","embellir","embryon","émeraude","émission","emmener","émotion","émouvoir","empereur","employer","emporter","emprise","émulsion","encadrer","enchère","enclave","encoche","endiguer","endosser","endroit","enduire","énergie","enfance","enfermer","enfouir","engager","engin","englober","énigme","enjamber","enjeu","enlever","ennemi","ennuyeux","enrichir","enrobage","enseigne","entasser","entendre","entier","entourer","entraver","énumérer","envahir","enviable","envoyer","enzyme","éolien","épaissir","épargne","épatant","épaule","épicerie","épidémie","épier","épilogue","épine","épisode","épitaphe","époque","épreuve","éprouver","épuisant","équerre","équipe","ériger","érosion","erreur","éruption","escalier","espadon","espèce","espiègle","espoir","esprit","esquiver","essayer","essence","essieu","essorer","estime","estomac","estrade","étagère","étaler","étanche","étatique","éteindre","étendoir","éternel","éthanol","éthique","ethnie","étirer","étoffer","étoile","étonnant","étourdir","étrange","étroit","étude","euphorie","évaluer","évasion","éventail","évidence","éviter","évolutif","évoquer","exact","exagérer","exaucer","exceller","excitant","exclusif","excuse","exécuter","exemple","exercer","exhaler","exhorter","exigence","exiler","exister","exotique","expédier","explorer","exposer","exprimer","exquis","extensif","extraire","exulter","fable","fabuleux","facette","facile","facture","faiblir","falaise","fameux","famille","farceur","farfelu","farine","farouche","fasciner","fatal","fatigue","faucon","fautif","faveur","favori","fébrile","féconder","fédérer","félin","femme","fémur","fendoir","féodal","fermer","féroce","ferveur","festival","feuille","feutre","février","fiasco","ficeler","fictif","fidèle","figure","filature","filetage","filière","filleul","filmer","filou","filtrer","financer","finir","fiole","firme","fissure","fixer","flairer","flamme","flasque","flatteur","fléau","flèche","fleur","flexion","flocon","flore","fluctuer","fluide","fluvial","folie","fonderie","fongible","fontaine","forcer","forgeron","formuler","fortune","fossile","foudre","fougère","fouiller","foulure","fourmi","fragile","fraise","franchir","frapper","frayeur","frégate","freiner","frelon","frémir","frénésie","frère","friable","friction","frisson","frivole","froid","fromage","frontal","frotter","fruit","fugitif","fuite","fureur","furieux","furtif","fusion","futur","gagner","galaxie","galerie","gambader","garantir","gardien","garnir","garrigue","gazelle","gazon","géant","gélatine","gélule","gendarme","général","génie","genou","gentil","géologie","géomètre","géranium","germe","gestuel","geyser","gibier","gicler","girafe","givre","glace","glaive","glisser","globe","gloire","glorieux","golfeur","gomme","gonfler","gorge","gorille","goudron","gouffre","goulot","goupille","gourmand","goutte","graduel","graffiti","graine","grand","grappin","gratuit","gravir","grenat","griffure","griller","grimper","grogner","gronder","grotte","groupe","gruger","grutier","gruyère","guépard","guerrier","guide","guimauve","guitare","gustatif","gymnaste","gyrostat","habitude","hachoir","halte","hameau","hangar","hanneton","haricot","harmonie","harpon","hasard","hélium","hématome","herbe","hérisson","hermine","héron","hésiter","heureux","hiberner","hibou","hilarant","histoire","hiver","homard","hommage","homogène","honneur","honorer","honteux","horde","horizon","horloge","hormone","horrible","houleux","housse","hublot","huileux","humain","humble","humide","humour","hurler","hydromel","hygiène","hymne","hypnose","idylle","ignorer","iguane","illicite","illusion","image","imbiber","imiter","immense","immobile","immuable","impact","impérial","implorer","imposer","imprimer","imputer","incarner","incendie","incident","incliner","incolore","indexer","indice","inductif","inédit","ineptie","inexact","infini","infliger","informer","infusion","ingérer","inhaler","inhiber","injecter","injure","innocent","inoculer","inonder","inscrire","insecte","insigne","insolite","inspirer","instinct","insulter","intact","intense","intime","intrigue","intuitif","inutile","invasion","inventer","inviter","invoquer","ironique","irradier","irréel","irriter","isoler","ivoire","ivresse","jaguar","jaillir","jambe","janvier","jardin","jauger","jaune","javelot","jetable","jeton","jeudi","jeunesse","joindre","joncher","jongler","joueur","jouissif","journal","jovial","joyau","joyeux","jubiler","jugement","junior","jupon","juriste","justice","juteux","juvénile","kayak","kimono","kiosque","label","labial","labourer","lacérer","lactose","lagune","laine","laisser","laitier","lambeau","lamelle","lampe","lanceur","langage","lanterne","lapin","largeur","larme","laurier","lavabo","lavoir","lecture","légal","léger","légume","lessive","lettre","levier","lexique","lézard","liasse","libérer","libre","licence","licorne","liège","lièvre","ligature","ligoter","ligue","limer","limite","limonade","limpide","linéaire","lingot","lionceau","liquide","lisière","lister","lithium","litige","littoral","livreur","logique","lointain","loisir","lombric","loterie","louer","lourd","loutre","louve","loyal","lubie","lucide","lucratif","lueur","lugubre","luisant","lumière","lunaire","lundi","luron","lutter","luxueux","machine","magasin","magenta","magique","maigre","maillon","maintien","mairie","maison","majorer","malaxer","maléfice","malheur","malice","mallette","mammouth","mandater","maniable","manquant","manteau","manuel","marathon","marbre","marchand","mardi","maritime","marqueur","marron","marteler","mascotte","massif","matériel","matière","matraque","maudire","maussade","mauve","maximal","méchant","méconnu","médaille","médecin","méditer","méduse","meilleur","mélange","mélodie","membre","mémoire","menacer","mener","menhir","mensonge","mentor","mercredi","mérite","merle","messager","mesure","métal","météore","méthode","métier","meuble","miauler","microbe","miette","mignon","migrer","milieu","million","mimique","mince","minéral","minimal","minorer","minute","miracle","miroiter","missile","mixte","mobile","moderne","moelleux","mondial","moniteur","monnaie","monotone","monstre","montagne","monument","moqueur","morceau","morsure","mortier","moteur","motif","mouche","moufle","moulin","mousson","mouton","mouvant","multiple","munition","muraille","murène","murmure","muscle","muséum","musicien","mutation","muter","mutuel","myriade","myrtille","mystère","mythique","nageur","nappe","narquois","narrer","natation","nation","nature","naufrage","nautique","navire","nébuleux","nectar","néfaste","négation","négliger","négocier","neige","nerveux","nettoyer","neurone","neutron","neveu","niche","nickel","nitrate","niveau","noble","nocif","nocturne","noirceur","noisette","nomade","nombreux","nommer","normatif","notable","notifier","notoire","nourrir","nouveau","novateur","novembre","novice","nuage","nuancer","nuire","nuisible","numéro","nuptial","nuque","nutritif","obéir","objectif","obliger","obscur","observer","obstacle","obtenir","obturer","occasion","occuper","océan","octobre","octroyer","octupler","oculaire","odeur","odorant","offenser","officier","offrir","ogive","oiseau","oisillon","olfactif","olivier","ombrage","omettre","onctueux","onduler","onéreux","onirique","opale","opaque","opérer","opinion","opportun","opprimer","opter","optique","orageux","orange","orbite","ordonner","oreille","organe","orgueil","orifice","ornement","orque","ortie","osciller","osmose","ossature","otarie","ouragan","ourson","outil","outrager","ouvrage","ovation","oxyde","oxygène","ozone","paisible","palace","palmarès","palourde","palper","panache","panda","pangolin","paniquer","panneau","panorama","pantalon","papaye","papier","papoter","papyrus","paradoxe","parcelle","paresse","parfumer","parler","parole","parrain","parsemer","partager","parure","parvenir","passion","pastèque","paternel","patience","patron","pavillon","pavoiser","payer","paysage","peigne","peintre","pelage","pélican","pelle","pelouse","peluche","pendule","pénétrer","pénible","pensif","pénurie","pépite","péplum","perdrix","perforer","période","permuter","perplexe","persil","perte","peser","pétale","petit","pétrir","peuple","pharaon","phobie","phoque","photon","phrase","physique","piano","pictural","pièce","pierre","pieuvre","pilote","pinceau","pipette","piquer","pirogue","piscine","piston","pivoter","pixel","pizza","placard","plafond","plaisir","planer","plaque","plastron","plateau","pleurer","plexus","pliage","plomb","plonger","pluie","plumage","pochette","poésie","poète","pointe","poirier","poisson","poivre","polaire","policier","pollen","polygone","pommade","pompier","ponctuel","pondérer","poney","portique","position","posséder","posture","potager","poteau","potion","pouce","poulain","poumon","pourpre","poussin","pouvoir","prairie","pratique","précieux","prédire","préfixe","prélude","prénom","présence","prétexte","prévoir","primitif","prince","prison","priver","problème","procéder","prodige","profond","progrès","proie","projeter","prologue","promener","propre","prospère","protéger","prouesse","proverbe","prudence","pruneau","psychose","public","puceron","puiser","pulpe","pulsar","punaise","punitif","pupitre","purifier","puzzle","pyramide","quasar","querelle","question","quiétude","quitter","quotient","racine","raconter","radieux","ragondin","raideur","raisin","ralentir","rallonge","ramasser","rapide","rasage","ratisser","ravager","ravin","rayonner","réactif","réagir","réaliser","réanimer","recevoir","réciter","réclamer","récolter","recruter","reculer","recycler","rédiger","redouter","refaire","réflexe","réformer","refrain","refuge","régalien","région","réglage","régulier","réitérer","rejeter","rejouer","relatif","relever","relief","remarque","remède","remise","remonter","remplir","remuer","renard","renfort","renifler","renoncer","rentrer","renvoi","replier","reporter","reprise","reptile","requin","réserve","résineux","résoudre","respect","rester","résultat","rétablir","retenir","réticule","retomber","retracer","réunion","réussir","revanche","revivre","révolte","révulsif","richesse","rideau","rieur","rigide","rigoler","rincer","riposter","risible","risque","rituel","rival","rivière","rocheux","romance","rompre","ronce","rondin","roseau","rosier","rotatif","rotor","rotule","rouge","rouille","rouleau","routine","royaume","ruban","rubis","ruche","ruelle","rugueux","ruiner","ruisseau","ruser","rustique","rythme","sabler","saboter","sabre","sacoche","safari","sagesse","saisir","salade","salive","salon","saluer","samedi","sanction","sanglier","sarcasme","sardine","saturer","saugrenu","saumon","sauter","sauvage","savant","savonner","scalpel","scandale","scélérat","scénario","sceptre","schéma","science","scinder","score","scrutin","sculpter","séance","sécable","sécher","secouer","sécréter","sédatif","séduire","seigneur","séjour","sélectif","semaine","sembler","semence","séminal","sénateur","sensible","sentence","séparer","séquence","serein","sergent","sérieux","serrure","sérum","service","sésame","sévir","sevrage","sextuple","sidéral","siècle","siéger","siffler","sigle","signal","silence","silicium","simple","sincère","sinistre","siphon","sirop","sismique","situer","skier","social","socle","sodium","soigneux","soldat","soleil","solitude","soluble","sombre","sommeil","somnoler","sonde","songeur","sonnette","sonore","sorcier","sortir","sosie","sottise","soucieux","soudure","souffle","soulever","soupape","source","soutirer","souvenir","spacieux","spatial","spécial","sphère","spiral","stable","station","sternum","stimulus","stipuler","strict","studieux","stupeur","styliste","sublime","substrat","subtil","subvenir","succès","sucre","suffixe","suggérer","suiveur","sulfate","superbe","supplier","surface","suricate","surmener","surprise","sursaut","survie","suspect","syllabe","symbole","symétrie","synapse","syntaxe","système","tabac","tablier","tactile","tailler","talent","talisman","talonner","tambour","tamiser","tangible","tapis","taquiner","tarder","tarif","tartine","tasse","tatami","tatouage","taupe","taureau","taxer","témoin","temporel","tenaille","tendre","teneur","tenir","tension","terminer","terne","terrible","tétine","texte","thème","théorie","thérapie","thorax","tibia","tiède","timide","tirelire","tiroir","tissu","titane","titre","tituber","toboggan","tolérant","tomate","tonique","tonneau","toponyme","torche","tordre","tornade","torpille","torrent","torse","tortue","totem","toucher","tournage","tousser","toxine","traction","trafic","tragique","trahir","train","trancher","travail","trèfle","tremper","trésor","treuil","triage","tribunal","tricoter","trilogie","triomphe","tripler","triturer","trivial","trombone","tronc","tropical","troupeau","tuile","tulipe","tumulte","tunnel","turbine","tuteur","tutoyer","tuyau","tympan","typhon","typique","tyran","ubuesque","ultime","ultrason","unanime","unifier","union","unique","unitaire","univers","uranium","urbain","urticant","usage","usine","usuel","usure","utile","utopie","vacarme","vaccin","vagabond","vague","vaillant","vaincre","vaisseau","valable","valise","vallon","valve","vampire","vanille","vapeur","varier","vaseux","vassal","vaste","vecteur","vedette","végétal","véhicule","veinard","véloce","vendredi","vénérer","venger","venimeux","ventouse","verdure","vérin","vernir","verrou","verser","vertu","veston","vétéran","vétuste","vexant","vexer","viaduc","viande","victoire","vidange","vidéo","vignette","vigueur","vilain","village","vinaigre","violon","vipère","virement","virtuose","virus","visage","viseur","vision","visqueux","visuel","vital","vitesse","viticole","vitrine","vivace","vivipare","vocation","voguer","voile","voisin","voiture","volaille","volcan","voltiger","volume","vorace","vortex","voter","vouloir","voyage","voyelle","wagon","xénon","yacht","zèbre","zénith","zeste","zoologie"];
+t.exports=i},{}],7:[function(e,t,r){t.exports={CHINESE:e("./chinese"),ENGLISH:e("./english"),FRENCH:e("./french"),JAPANESE:e("./japanese"),SPANISH:e("./spanish")}},{"./chinese":4,"./english":5,"./french":6,"./japanese":8,"./spanish":9}],8:[function(e,t,r){"use strict";var i=["あいこくしん","あいさつ","あいだ","あおぞら","あかちゃん","あきる","あけがた","あける","あこがれる","あさい","あさひ","あしあと","あじわう","あずかる","あずき","あそぶ","あたえる","あたためる","あたりまえ","あたる","あつい","あつかう","あっしゅく","あつまり","あつめる","あてな","あてはまる","あひる","あぶら","あぶる","あふれる","あまい","あまど","あまやかす","あまり","あみもの","あめりか","あやまる","あゆむ","あらいぐま","あらし","あらすじ","あらためる","あらゆる","あらわす","ありがとう","あわせる","あわてる","あんい","あんがい","あんこ","あんぜん","あんてい","あんない","あんまり","いいだす","いおん","いがい","いがく","いきおい","いきなり","いきもの","いきる","いくじ","いくぶん","いけばな","いけん","いこう","いこく","いこつ","いさましい","いさん","いしき","いじゅう","いじょう","いじわる","いずみ","いずれ","いせい","いせえび","いせかい","いせき","いぜん","いそうろう","いそがしい","いだい","いだく","いたずら","いたみ","いたりあ","いちおう","いちじ","いちど","いちば","いちぶ","いちりゅう","いつか","いっしゅん","いっせい","いっそう","いったん","いっち","いってい","いっぽう","いてざ","いてん","いどう","いとこ","いない","いなか","いねむり","いのち","いのる","いはつ","いばる","いはん","いびき","いひん","いふく","いへん","いほう","いみん","いもうと","いもたれ","いもり","いやがる","いやす","いよかん","いよく","いらい","いらすと","いりぐち","いりょう","いれい","いれもの","いれる","いろえんぴつ","いわい","いわう","いわかん","いわば","いわゆる","いんげんまめ","いんさつ","いんしょう","いんよう","うえき","うえる","うおざ","うがい","うかぶ","うかべる","うきわ","うくらいな","うくれれ","うけたまわる","うけつけ","うけとる","うけもつ","うける","うごかす","うごく","うこん","うさぎ","うしなう","うしろがみ","うすい","うすぎ","うすぐらい","うすめる","うせつ","うちあわせ","うちがわ","うちき","うちゅう","うっかり","うつくしい","うったえる","うつる","うどん","うなぎ","うなじ","うなずく","うなる","うねる","うのう","うぶげ","うぶごえ","うまれる","うめる","うもう","うやまう","うよく","うらがえす","うらぐち","うらない","うりあげ","うりきれ","うるさい","うれしい","うれゆき","うれる","うろこ","うわき","うわさ","うんこう","うんちん","うんてん","うんどう","えいえん","えいが","えいきょう","えいご","えいせい","えいぶん","えいよう","えいわ","えおり","えがお","えがく","えきたい","えくせる","えしゃく","えすて","えつらん","えのぐ","えほうまき","えほん","えまき","えもじ","えもの","えらい","えらぶ","えりあ","えんえん","えんかい","えんぎ","えんげき","えんしゅう","えんぜつ","えんそく","えんちょう","えんとつ","おいかける","おいこす","おいしい","おいつく","おうえん","おうさま","おうじ","おうせつ","おうたい","おうふく","おうべい","おうよう","おえる","おおい","おおう","おおどおり","おおや","おおよそ","おかえり","おかず","おがむ","おかわり","おぎなう","おきる","おくさま","おくじょう","おくりがな","おくる","おくれる","おこす","おこなう","おこる","おさえる","おさない","おさめる","おしいれ","おしえる","おじぎ","おじさん","おしゃれ","おそらく","おそわる","おたがい","おたく","おだやか","おちつく","おっと","おつり","おでかけ","おとしもの","おとなしい","おどり","おどろかす","おばさん","おまいり","おめでとう","おもいで","おもう","おもたい","おもちゃ","おやつ","おやゆび","およぼす","おらんだ","おろす","おんがく","おんけい","おんしゃ","おんせん","おんだん","おんちゅう","おんどけい","かあつ","かいが","がいき","がいけん","がいこう","かいさつ","かいしゃ","かいすいよく","かいぜん","かいぞうど","かいつう","かいてん","かいとう","かいふく","がいへき","かいほう","かいよう","がいらい","かいわ","かえる","かおり","かかえる","かがく","かがし","かがみ","かくご","かくとく","かざる","がぞう","かたい","かたち","がちょう","がっきゅう","がっこう","がっさん","がっしょう","かなざわし","かのう","がはく","かぶか","かほう","かほご","かまう","かまぼこ","かめれおん","かゆい","かようび","からい","かるい","かろう","かわく","かわら","がんか","かんけい","かんこう","かんしゃ","かんそう","かんたん","かんち","がんばる","きあい","きあつ","きいろ","ぎいん","きうい","きうん","きえる","きおう","きおく","きおち","きおん","きかい","きかく","きかんしゃ","ききて","きくばり","きくらげ","きけんせい","きこう","きこえる","きこく","きさい","きさく","きさま","きさらぎ","ぎじかがく","ぎしき","ぎじたいけん","ぎじにってい","ぎじゅつしゃ","きすう","きせい","きせき","きせつ","きそう","きぞく","きぞん","きたえる","きちょう","きつえん","ぎっちり","きつつき","きつね","きてい","きどう","きどく","きない","きなが","きなこ","きぬごし","きねん","きのう","きのした","きはく","きびしい","きひん","きふく","きぶん","きぼう","きほん","きまる","きみつ","きむずかしい","きめる","きもだめし","きもち","きもの","きゃく","きやく","ぎゅうにく","きよう","きょうりゅう","きらい","きらく","きりん","きれい","きれつ","きろく","ぎろん","きわめる","ぎんいろ","きんかくじ","きんじょ","きんようび","ぐあい","くいず","くうかん","くうき","くうぐん","くうこう","ぐうせい","くうそう","ぐうたら","くうふく","くうぼ","くかん","くきょう","くげん","ぐこう","くさい","くさき","くさばな","くさる","くしゃみ","くしょう","くすのき","くすりゆび","くせげ","くせん","ぐたいてき","くださる","くたびれる","くちこみ","くちさき","くつした","ぐっすり","くつろぐ","くとうてん","くどく","くなん","くねくね","くのう","くふう","くみあわせ","くみたてる","くめる","くやくしょ","くらす","くらべる","くるま","くれる","くろう","くわしい","ぐんかん","ぐんしょく","ぐんたい","ぐんて","けあな","けいかく","けいけん","けいこ","けいさつ","げいじゅつ","けいたい","げいのうじん","けいれき","けいろ","けおとす","けおりもの","げきか","げきげん","げきだん","げきちん","げきとつ","げきは","げきやく","げこう","げこくじょう","げざい","けさき","げざん","けしき","けしごむ","けしょう","げすと","けたば","けちゃっぷ","けちらす","けつあつ","けつい","けつえき","けっこん","けつじょ","けっせき","けってい","けつまつ","げつようび","げつれい","けつろん","げどく","けとばす","けとる","けなげ","けなす","けなみ","けぬき","げねつ","けねん","けはい","げひん","けぶかい","げぼく","けまり","けみかる","けむし","けむり","けもの","けらい","けろけろ","けわしい","けんい","けんえつ","けんお","けんか","げんき","けんげん","けんこう","けんさく","けんしゅう","けんすう","げんそう","けんちく","けんてい","けんとう","けんない","けんにん","げんぶつ","けんま","けんみん","けんめい","けんらん","けんり","こあくま","こいぬ","こいびと","ごうい","こうえん","こうおん","こうかん","ごうきゅう","ごうけい","こうこう","こうさい","こうじ","こうすい","ごうせい","こうそく","こうたい","こうちゃ","こうつう","こうてい","こうどう","こうない","こうはい","ごうほう","ごうまん","こうもく","こうりつ","こえる","こおり","ごかい","ごがつ","ごかん","こくご","こくさい","こくとう","こくない","こくはく","こぐま","こけい","こける","ここのか","こころ","こさめ","こしつ","こすう","こせい","こせき","こぜん","こそだて","こたい","こたえる","こたつ","こちょう","こっか","こつこつ","こつばん","こつぶ","こてい","こてん","ことがら","ことし","ことば","ことり","こなごな","こねこね","このまま","このみ","このよ","ごはん","こひつじ","こふう","こふん","こぼれる","ごまあぶら","こまかい","ごますり","こまつな","こまる","こむぎこ","こもじ","こもち","こもの","こもん","こやく","こやま","こゆう","こゆび","こよい","こよう","こりる","これくしょん","ころっけ","こわもて","こわれる","こんいん","こんかい","こんき","こんしゅう","こんすい","こんだて","こんとん","こんなん","こんびに","こんぽん","こんまけ","こんや","こんれい","こんわく","ざいえき","さいかい","さいきん","ざいげん","ざいこ","さいしょ","さいせい","ざいたく","ざいちゅう","さいてき","ざいりょう","さうな","さかいし","さがす","さかな","さかみち","さがる","さぎょう","さくし","さくひん","さくら","さこく","さこつ","さずかる","ざせき","さたん","さつえい","ざつおん","ざっか","ざつがく","さっきょく","ざっし","さつじん","ざっそう","さつたば","さつまいも","さてい","さといも","さとう","さとおや","さとし","さとる","さのう","さばく","さびしい","さべつ","さほう","さほど","さます","さみしい","さみだれ","さむけ","さめる","さやえんどう","さゆう","さよう","さよく","さらだ","ざるそば","さわやか","さわる","さんいん","さんか","さんきゃく","さんこう","さんさい","ざんしょ","さんすう","さんせい","さんそ","さんち","さんま","さんみ","さんらん","しあい","しあげ","しあさって","しあわせ","しいく","しいん","しうち","しえい","しおけ","しかい","しかく","じかん","しごと","しすう","じだい","したうけ","したぎ","したて","したみ","しちょう","しちりん","しっかり","しつじ","しつもん","してい","してき","してつ","じてん","じどう","しなぎれ","しなもの","しなん","しねま","しねん","しのぐ","しのぶ","しはい","しばかり","しはつ","しはらい","しはん","しひょう","しふく","じぶん","しへい","しほう","しほん","しまう","しまる","しみん","しむける","じむしょ","しめい","しめる","しもん","しゃいん","しゃうん","しゃおん","じゃがいも","しやくしょ","しゃくほう","しゃけん","しゃこ","しゃざい","しゃしん","しゃせん","しゃそう","しゃたい","しゃちょう","しゃっきん","じゃま","しゃりん","しゃれい","じゆう","じゅうしょ","しゅくはく","じゅしん","しゅっせき","しゅみ","しゅらば","じゅんばん","しょうかい","しょくたく","しょっけん","しょどう","しょもつ","しらせる","しらべる","しんか","しんこう","じんじゃ","しんせいじ","しんちく","しんりん","すあげ","すあし","すあな","ずあん","すいえい","すいか","すいとう","ずいぶん","すいようび","すうがく","すうじつ","すうせん","すおどり","すきま","すくう","すくない","すける","すごい","すこし","ずさん","すずしい","すすむ","すすめる","すっかり","ずっしり","ずっと","すてき","すてる","すねる","すのこ","すはだ","すばらしい","ずひょう","ずぶぬれ","すぶり","すふれ","すべて","すべる","ずほう","すぼん","すまい","すめし","すもう","すやき","すらすら","するめ","すれちがう","すろっと","すわる","すんぜん","すんぽう","せあぶら","せいかつ","せいげん","せいじ","せいよう","せおう","せかいかん","せきにん","せきむ","せきゆ","せきらんうん","せけん","せこう","せすじ","せたい","せたけ","せっかく","せっきゃく","ぜっく","せっけん","せっこつ","せっさたくま","せつぞく","せつだん","せつでん","せっぱん","せつび","せつぶん","せつめい","せつりつ","せなか","せのび","せはば","せびろ","せぼね","せまい","せまる","せめる","せもたれ","せりふ","ぜんあく","せんい","せんえい","せんか","せんきょ","せんく","せんげん","ぜんご","せんさい","せんしゅ","せんすい","せんせい","せんぞ","せんたく","せんちょう","せんてい","せんとう","せんぬき","せんねん","せんぱい","ぜんぶ","ぜんぽう","せんむ","せんめんじょ","せんもん","せんやく","せんゆう","せんよう","ぜんら","ぜんりゃく","せんれい","せんろ","そあく","そいとげる","そいね","そうがんきょう","そうき","そうご","そうしん","そうだん","そうなん","そうび","そうめん","そうり","そえもの","そえん","そがい","そげき","そこう","そこそこ","そざい","そしな","そせい","そせん","そそぐ","そだてる","そつう","そつえん","そっかん","そつぎょう","そっけつ","そっこう","そっせん","そっと","そとがわ","そとづら","そなえる","そなた","そふぼ","そぼく","そぼろ","そまつ","そまる","そむく","そむりえ","そめる","そもそも","そよかぜ","そらまめ","そろう","そんかい","そんけい","そんざい","そんしつ","そんぞく","そんちょう","ぞんび","ぞんぶん","そんみん","たあい","たいいん","たいうん","たいえき","たいおう","だいがく","たいき","たいぐう","たいけん","たいこ","たいざい","だいじょうぶ","だいすき","たいせつ","たいそう","だいたい","たいちょう","たいてい","だいどころ","たいない","たいねつ","たいのう","たいはん","だいひょう","たいふう","たいへん","たいほ","たいまつばな","たいみんぐ","たいむ","たいめん","たいやき","たいよう","たいら","たいりょく","たいる","たいわん","たうえ","たえる","たおす","たおる","たおれる","たかい","たかね","たきび","たくさん","たこく","たこやき","たさい","たしざん","だじゃれ","たすける","たずさわる","たそがれ","たたかう","たたく","ただしい","たたみ","たちばな","だっかい","だっきゃく","だっこ","だっしゅつ","だったい","たてる","たとえる","たなばた","たにん","たぬき","たのしみ","たはつ","たぶん","たべる","たぼう","たまご","たまる","だむる","ためいき","ためす","ためる","たもつ","たやすい","たよる","たらす","たりきほんがん","たりょう","たりる","たると","たれる","たれんと","たろっと","たわむれる","だんあつ","たんい","たんおん","たんか","たんき","たんけん","たんご","たんさん","たんじょうび","だんせい","たんそく","たんたい","だんち","たんてい","たんとう","だんな","たんにん","だんねつ","たんのう","たんぴん","だんぼう","たんまつ","たんめい","だんれつ","だんろ","だんわ","ちあい","ちあん","ちいき","ちいさい","ちえん","ちかい","ちから","ちきゅう","ちきん","ちけいず","ちけん","ちこく","ちさい","ちしき","ちしりょう","ちせい","ちそう","ちたい","ちたん","ちちおや","ちつじょ","ちてき","ちてん","ちぬき","ちぬり","ちのう","ちひょう","ちへいせん","ちほう","ちまた","ちみつ","ちみどろ","ちめいど","ちゃんこなべ","ちゅうい","ちゆりょく","ちょうし","ちょさくけん","ちらし","ちらみ","ちりがみ","ちりょう","ちるど","ちわわ","ちんたい","ちんもく","ついか","ついたち","つうか","つうじょう","つうはん","つうわ","つかう","つかれる","つくね","つくる","つけね","つける","つごう","つたえる","つづく","つつじ","つつむ","つとめる","つながる","つなみ","つねづね","つのる","つぶす","つまらない","つまる","つみき","つめたい","つもり","つもる","つよい","つるぼ","つるみく","つわもの","つわり","てあし","てあて","てあみ","ていおん","ていか","ていき","ていけい","ていこく","ていさつ","ていし","ていせい","ていたい","ていど","ていねい","ていひょう","ていへん","ていぼう","てうち","ておくれ","てきとう","てくび","でこぼこ","てさぎょう","てさげ","てすり","てそう","てちがい","てちょう","てつがく","てつづき","でっぱ","てつぼう","てつや","でぬかえ","てぬき","てぬぐい","てのひら","てはい","てぶくろ","てふだ","てほどき","てほん","てまえ","てまきずし","てみじか","てみやげ","てらす","てれび","てわけ","てわたし","でんあつ","てんいん","てんかい","てんき","てんぐ","てんけん","てんごく","てんさい","てんし","てんすう","でんち","てんてき","てんとう","てんない","てんぷら","てんぼうだい","てんめつ","てんらんかい","でんりょく","でんわ","どあい","といれ","どうかん","とうきゅう","どうぐ","とうし","とうむぎ","とおい","とおか","とおく","とおす","とおる","とかい","とかす","ときおり","ときどき","とくい","とくしゅう","とくてん","とくに","とくべつ","とけい","とける","とこや","とさか","としょかん","とそう","とたん","とちゅう","とっきゅう","とっくん","とつぜん","とつにゅう","とどける","ととのえる","とない","となえる","となり","とのさま","とばす","どぶがわ","とほう","とまる","とめる","ともだち","ともる","どようび","とらえる","とんかつ","どんぶり","ないかく","ないこう","ないしょ","ないす","ないせん","ないそう","なおす","ながい","なくす","なげる","なこうど","なさけ","なたでここ","なっとう","なつやすみ","ななおし","なにごと","なにもの","なにわ","なのか","なふだ","なまいき","なまえ","なまみ","なみだ","なめらか","なめる","なやむ","ならう","ならび","ならぶ","なれる","なわとび","なわばり","にあう","にいがた","にうけ","におい","にかい","にがて","にきび","にくしみ","にくまん","にげる","にさんかたんそ","にしき","にせもの","にちじょう","にちようび","にっか","にっき","にっけい","にっこう","にっさん","にっしょく","にっすう","にっせき","にってい","になう","にほん","にまめ","にもつ","にやり","にゅういん","にりんしゃ","にわとり","にんい","にんか","にんき","にんげん","にんしき","にんずう","にんそう","にんたい","にんち","にんてい","にんにく","にんぷ","にんまり","にんむ","にんめい","にんよう","ぬいくぎ","ぬかす","ぬぐいとる","ぬぐう","ぬくもり","ぬすむ","ぬまえび","ぬめり","ぬらす","ぬんちゃく","ねあげ","ねいき","ねいる","ねいろ","ねぐせ","ねくたい","ねくら","ねこぜ","ねこむ","ねさげ","ねすごす","ねそべる","ねだん","ねつい","ねっしん","ねつぞう","ねったいぎょ","ねぶそく","ねふだ","ねぼう","ねほりはほり","ねまき","ねまわし","ねみみ","ねむい","ねむたい","ねもと","ねらう","ねわざ","ねんいり","ねんおし","ねんかん","ねんきん","ねんぐ","ねんざ","ねんし","ねんちゃく","ねんど","ねんぴ","ねんぶつ","ねんまつ","ねんりょう","ねんれい","のいず","のおづま","のがす","のきなみ","のこぎり","のこす","のこる","のせる","のぞく","のぞむ","のたまう","のちほど","のっく","のばす","のはら","のべる","のぼる","のみもの","のやま","のらいぬ","のらねこ","のりもの","のりゆき","のれん","のんき","ばあい","はあく","ばあさん","ばいか","ばいく","はいけん","はいご","はいしん","はいすい","はいせん","はいそう","はいち","ばいばい","はいれつ","はえる","はおる","はかい","ばかり","はかる","はくしゅ","はけん","はこぶ","はさみ","はさん","はしご","ばしょ","はしる","はせる","ぱそこん","はそん","はたん","はちみつ","はつおん","はっかく","はづき","はっきり","はっくつ","はっけん","はっこう","はっさん","はっしん","はったつ","はっちゅう","はってん","はっぴょう","はっぽう","はなす","はなび","はにかむ","はぶらし","はみがき","はむかう","はめつ","はやい","はやし","はらう","はろうぃん","はわい","はんい","はんえい","はんおん","はんかく","はんきょう","ばんぐみ","はんこ","はんしゃ","はんすう","はんだん","ぱんち","ぱんつ","はんてい","はんとし","はんのう","はんぱ","はんぶん","はんぺん","はんぼうき","はんめい","はんらん","はんろん","ひいき","ひうん","ひえる","ひかく","ひかり","ひかる","ひかん","ひくい","ひけつ","ひこうき","ひこく","ひさい","ひさしぶり","ひさん","びじゅつかん","ひしょ","ひそか","ひそむ","ひたむき","ひだり","ひたる","ひつぎ","ひっこし","ひっし","ひつじゅひん","ひっす","ひつぜん","ぴったり","ぴっちり","ひつよう","ひてい","ひとごみ","ひなまつり","ひなん","ひねる","ひはん","ひびく","ひひょう","ひほう","ひまわり","ひまん","ひみつ","ひめい","ひめじし","ひやけ","ひやす","ひよう","びょうき","ひらがな","ひらく","ひりつ","ひりょう","ひるま","ひるやすみ","ひれい","ひろい","ひろう","ひろき","ひろゆき","ひんかく","ひんけつ","ひんこん","ひんしゅ","ひんそう","ぴんち","ひんぱん","びんぼう","ふあん","ふいうち","ふうけい","ふうせん","ぷうたろう","ふうとう","ふうふ","ふえる","ふおん","ふかい","ふきん","ふくざつ","ふくぶくろ","ふこう","ふさい","ふしぎ","ふじみ","ふすま","ふせい","ふせぐ","ふそく","ぶたにく","ふたん","ふちょう","ふつう","ふつか","ふっかつ","ふっき","ふっこく","ぶどう","ふとる","ふとん","ふのう","ふはい","ふひょう","ふへん","ふまん","ふみん","ふめつ","ふめん","ふよう","ふりこ","ふりる","ふるい","ふんいき","ぶんがく","ぶんぐ","ふんしつ","ぶんせき","ふんそう","ぶんぽう","へいあん","へいおん","へいがい","へいき","へいげん","へいこう","へいさ","へいしゃ","へいせつ","へいそ","へいたく","へいてん","へいねつ","へいわ","へきが","へこむ","べにいろ","べにしょうが","へらす","へんかん","べんきょう","べんごし","へんさい","へんたい","べんり","ほあん","ほいく","ぼうぎょ","ほうこく","ほうそう","ほうほう","ほうもん","ほうりつ","ほえる","ほおん","ほかん","ほきょう","ぼきん","ほくろ","ほけつ","ほけん","ほこう","ほこる","ほしい","ほしつ","ほしゅ","ほしょう","ほせい","ほそい","ほそく","ほたて","ほたる","ぽちぶくろ","ほっきょく","ほっさ","ほったん","ほとんど","ほめる","ほんい","ほんき","ほんけ","ほんしつ","ほんやく","まいにち","まかい","まかせる","まがる","まける","まこと","まさつ","まじめ","ますく","まぜる","まつり","まとめ","まなぶ","まぬけ","まねく","まほう","まもる","まゆげ","まよう","まろやか","まわす","まわり","まわる","まんが","まんきつ","まんぞく","まんなか","みいら","みうち","みえる","みがく","みかた","みかん","みけん","みこん","みじかい","みすい","みすえる","みせる","みっか","みつかる","みつける","みてい","みとめる","みなと","みなみかさい","みねらる","みのう","みのがす","みほん","みもと","みやげ","みらい","みりょく","みわく","みんか","みんぞく","むいか","むえき","むえん","むかい","むかう","むかえ","むかし","むぎちゃ","むける","むげん","むさぼる","むしあつい","むしば","むじゅん","むしろ","むすう","むすこ","むすぶ","むすめ","むせる","むせん","むちゅう","むなしい","むのう","むやみ","むよう","むらさき","むりょう","むろん","めいあん","めいうん","めいえん","めいかく","めいきょく","めいさい","めいし","めいそう","めいぶつ","めいれい","めいわく","めぐまれる","めざす","めした","めずらしい","めだつ","めまい","めやす","めんきょ","めんせき","めんどう","もうしあげる","もうどうけん","もえる","もくし","もくてき","もくようび","もちろん","もどる","もらう","もんく","もんだい","やおや","やける","やさい","やさしい","やすい","やすたろう","やすみ","やせる","やそう","やたい","やちん","やっと","やっぱり","やぶる","やめる","ややこしい","やよい","やわらかい","ゆうき","ゆうびんきょく","ゆうべ","ゆうめい","ゆけつ","ゆしゅつ","ゆせん","ゆそう","ゆたか","ゆちゃく","ゆでる","ゆにゅう","ゆびわ","ゆらい","ゆれる","ようい","ようか","ようきゅう","ようじ","ようす","ようちえん","よかぜ","よかん","よきん","よくせい","よくぼう","よけい","よごれる","よさん","よしゅう","よそう","よそく","よっか","よてい","よどがわく","よねつ","よやく","よゆう","よろこぶ","よろしい","らいう","らくがき","らくご","らくさつ","らくだ","らしんばん","らせん","らぞく","らたい","らっか","られつ","りえき","りかい","りきさく","りきせつ","りくぐん","りくつ","りけん","りこう","りせい","りそう","りそく","りてん","りねん","りゆう","りゅうがく","りよう","りょうり","りょかん","りょくちゃ","りょこう","りりく","りれき","りろん","りんご","るいけい","るいさい","るいじ","るいせき","るすばん","るりがわら","れいかん","れいぎ","れいせい","れいぞうこ","れいとう","れいぼう","れきし","れきだい","れんあい","れんけい","れんこん","れんさい","れんしゅう","れんぞく","れんらく","ろうか","ろうご","ろうじん","ろうそく","ろくが","ろこつ","ろじうら","ろしゅつ","ろせん","ろてん","ろめん","ろれつ","ろんぎ","ろんぱ","ろんぶん","ろんり","わかす","わかめ","わかやま","わかれる","わしつ","わじまし","わすれもの","わらう","われる"];t.exports=i},{}],9:[function(e,t,r){"use strict";var i=["ábaco","abdomen","abeja","abierto","abogado","abono","aborto","abrazo","abrir","abuelo","abuso","acabar","academia","acceso","acción","aceite","acelga","acento","aceptar","ácido","aclarar","acné","acoger","acoso","activo","acto","actriz","actuar","acudir","acuerdo","acusar","adicto","admitir","adoptar","adorno","aduana","adulto","aéreo","afectar","afición","afinar","afirmar","ágil","agitar","agonía","agosto","agotar","agregar","agrio","agua","agudo","águila","aguja","ahogo","ahorro","aire","aislar","ajedrez","ajeno","ajuste","alacrán","alambre","alarma","alba","álbum","alcalde","aldea","alegre","alejar","alerta","aleta","alfiler","alga","algodón","aliado","aliento","alivio","alma","almeja","almíbar","altar","alteza","altivo","alto","altura","alumno","alzar","amable","amante","amapola","amargo","amasar","ámbar","ámbito","ameno","amigo","amistad","amor","amparo","amplio","ancho","anciano","ancla","andar","andén","anemia","ángulo","anillo","ánimo","anís","anotar","antena","antiguo","antojo","anual","anular","anuncio","añadir","añejo","año","apagar","aparato","apetito","apio","aplicar","apodo","aporte","apoyo","aprender","aprobar","apuesta","apuro","arado","araña","arar","árbitro","árbol","arbusto","archivo","arco","arder","ardilla","arduo","área","árido","aries","armonía","arnés","aroma","arpa","arpón","arreglo","arroz","arruga","arte","artista","asa","asado","asalto","ascenso","asegurar","aseo","asesor","asiento","asilo","asistir","asno","asombro","áspero","astilla","astro","astuto","asumir","asunto","atajo","ataque","atar","atento","ateo","ático","atleta","átomo","atraer","atroz","atún","audaz","audio","auge","aula","aumento","ausente","autor","aval","avance","avaro","ave","avellana","avena","avestruz","avión","aviso","ayer","ayuda","ayuno","azafrán","azar","azote","azúcar","azufre","azul","baba","babor","bache","bahía","baile","bajar","balanza","balcón","balde","bambú","banco","banda","baño","barba","barco","barniz","barro","báscula","bastón","basura","batalla","batería","batir","batuta","baúl","bazar","bebé","bebida","bello","besar","beso","bestia","bicho","bien","bingo","blanco","bloque","blusa","boa","bobina","bobo","boca","bocina","boda","bodega","boina","bola","bolero","bolsa","bomba","bondad","bonito","bono","bonsái","borde","borrar","bosque","bote","botín","bóveda","bozal","bravo","brazo","brecha","breve","brillo","brinco","brisa","broca","broma","bronce","brote","bruja","brusco","bruto","buceo","bucle","bueno","buey","bufanda","bufón","búho","buitre","bulto","burbuja","burla","burro","buscar","butaca","buzón","caballo","cabeza","cabina","cabra","cacao","cadáver","cadena","caer","café","caída","caimán","caja","cajón","cal","calamar","calcio","caldo","calidad","calle","calma","calor","calvo","cama","cambio","camello","camino","campo","cáncer","candil","canela","canguro","canica","canto","caña","cañón","caoba","caos","capaz","capitán","capote","captar","capucha","cara","carbón","cárcel","careta","carga","cariño","carne","carpeta","carro","carta","casa","casco","casero","caspa","castor","catorce","catre","caudal","causa","cazo","cebolla","ceder","cedro","celda","célebre","celoso","célula","cemento","ceniza","centro","cerca","cerdo","cereza","cero","cerrar","certeza","césped","cetro","chacal","chaleco","champú","chancla","chapa","charla","chico","chiste","chivo","choque","choza","chuleta","chupar","ciclón","ciego","cielo","cien","cierto","cifra","cigarro","cima","cinco","cine","cinta","ciprés","circo","ciruela","cisne","cita","ciudad","clamor","clan","claro","clase","clave","cliente","clima","clínica","cobre","cocción","cochino","cocina","coco","código","codo","cofre","coger","cohete","cojín","cojo","cola","colcha","colegio","colgar","colina","collar","colmo","columna","combate","comer","comida","cómodo","compra","conde","conejo","conga","conocer","consejo","contar","copa","copia","corazón","corbata","corcho","cordón","corona","correr","coser","cosmos","costa","cráneo","cráter","crear","crecer","creído","crema","cría","crimen","cripta","crisis","cromo","crónica","croqueta","crudo","cruz","cuadro","cuarto","cuatro","cubo","cubrir","cuchara","cuello","cuento","cuerda","cuesta","cueva","cuidar","culebra","culpa","culto","cumbre","cumplir","cuna","cuneta","cuota","cupón","cúpula","curar","curioso","curso","curva","cutis","dama","danza","dar","dardo","dátil","deber","débil","década","decir","dedo","defensa","definir","dejar","delfín","delgado","delito","demora","denso","dental","deporte","derecho","derrota","desayuno","deseo","desfile","desnudo","destino","desvío","detalle","detener","deuda","día","diablo","diadema","diamante","diana","diario","dibujo","dictar","diente","dieta","diez","difícil","digno","dilema","diluir","dinero","directo","dirigir","disco","diseño","disfraz","diva","divino","doble","doce","dolor","domingo","don","donar","dorado","dormir","dorso","dos","dosis","dragón","droga","ducha","duda","duelo","dueño","dulce","dúo","duque","durar","dureza","duro","ébano","ebrio","echar","eco","ecuador","edad","edición","edificio","editor","educar","efecto","eficaz","eje","ejemplo","elefante","elegir","elemento","elevar","elipse","élite","elixir","elogio","eludir","embudo","emitir","emoción","empate","empeño","empleo","empresa","enano","encargo","enchufe","encía","enemigo","enero","enfado","enfermo","engaño","enigma","enlace","enorme","enredo","ensayo","enseñar","entero","entrar","envase","envío","época","equipo","erizo","escala","escena","escolar","escribir","escudo","esencia","esfera","esfuerzo","espada","espejo","espía","esposa","espuma","esquí","estar","este","estilo","estufa","etapa","eterno","ética","etnia","evadir","evaluar","evento","evitar","exacto","examen","exceso","excusa","exento","exigir","exilio","existir","éxito","experto","explicar","exponer","extremo","fábrica","fábula","fachada","fácil","factor","faena","faja","falda","fallo","falso","faltar","fama","familia","famoso","faraón","farmacia","farol","farsa","fase","fatiga","fauna","favor","fax","febrero","fecha","feliz","feo","feria","feroz","fértil","fervor","festín","fiable","fianza","fiar","fibra","ficción","ficha","fideo","fiebre","fiel","fiera","fiesta","figura","fijar","fijo","fila","filete","filial","filtro","fin","finca","fingir","finito","firma","flaco","flauta","flecha","flor","flota","fluir","flujo","flúor","fobia","foca","fogata","fogón","folio","folleto","fondo","forma","forro","fortuna","forzar","fosa","foto","fracaso","frágil","franja","frase","fraude","freír","freno","fresa","frío","frito","fruta","fuego","fuente","fuerza","fuga","fumar","función","funda","furgón","furia","fusil","fútbol","futuro","gacela","gafas","gaita","gajo","gala","galería","gallo","gamba","ganar","gancho","ganga","ganso","garaje","garza","gasolina","gastar","gato","gavilán","gemelo","gemir","gen","género","genio","gente","geranio","gerente","germen","gesto","gigante","gimnasio","girar","giro","glaciar","globo","gloria","gol","golfo","goloso","golpe","goma","gordo","gorila","gorra","gota","goteo","gozar","grada","gráfico","grano","grasa","gratis","grave","grieta","grillo","gripe","gris","grito","grosor","grúa","grueso","grumo","grupo","guante","guapo","guardia","guerra","guía","guiño","guion","guiso","guitarra","gusano","gustar","haber","hábil","hablar","hacer","hacha","hada","hallar","hamaca","harina","haz","hazaña","hebilla","hebra","hecho","helado","helio","hembra","herir","hermano","héroe","hervir","hielo","hierro","hígado","higiene","hijo","himno","historia","hocico","hogar","hoguera","hoja","hombre","hongo","honor","honra","hora","hormiga","horno","hostil","hoyo","hueco","huelga","huerta","hueso","huevo","huida","huir","humano","húmedo","humilde","humo","hundir","huracán","hurto","icono","ideal","idioma","ídolo","iglesia","iglú","igual","ilegal","ilusión","imagen","imán","imitar","impar","imperio","imponer","impulso","incapaz","índice","inerte","infiel","informe","ingenio","inicio","inmenso","inmune","innato","insecto","instante","interés","íntimo","intuir","inútil","invierno","ira","iris","ironía","isla","islote","jabalí","jabón","jamón","jarabe","jardín","jarra","jaula","jazmín","jefe","jeringa","jinete","jornada","joroba","joven","joya","juerga","jueves","juez","jugador","jugo","juguete","juicio","junco","jungla","junio","juntar","júpiter","jurar","justo","juvenil","juzgar","kilo","koala","labio","lacio","lacra","lado","ladrón","lagarto","lágrima","laguna","laico","lamer","lámina","lámpara","lana","lancha","langosta","lanza","lápiz","largo","larva","lástima","lata","látex","latir","laurel","lavar","lazo","leal","lección","leche","lector","leer","legión","legumbre","lejano","lengua","lento","leña","león","leopardo","lesión","letal","letra","leve","leyenda","libertad","libro","licor","líder","lidiar","lienzo","liga","ligero","lima","límite","limón","limpio","lince","lindo","línea","lingote","lino","linterna","líquido","liso","lista","litera","litio","litro","llaga","llama","llanto","llave","llegar","llenar","llevar","llorar","llover","lluvia","lobo","loción","loco","locura","lógica","logro","lombriz","lomo","lonja","lote","lucha","lucir","lugar","lujo","luna","lunes","lupa","lustro","luto","luz","maceta","macho","madera","madre","maduro","maestro","mafia","magia","mago","maíz","maldad","maleta","malla","malo","mamá","mambo","mamut","manco","mando","manejar","manga","maniquí","manjar","mano","manso","manta","mañana","mapa","máquina","mar","marco","marea","marfil","margen","marido","mármol","marrón","martes","marzo","masa","máscara","masivo","matar","materia","matiz","matriz","máximo","mayor","mazorca","mecha","medalla","medio","médula","mejilla","mejor","melena","melón","memoria","menor","mensaje","mente","menú","mercado","merengue","mérito","mes","mesón","meta","meter","método","metro","mezcla","miedo","miel","miembro","miga","mil","milagro","militar","millón","mimo","mina","minero","mínimo","minuto","miope","mirar","misa","miseria","misil","mismo","mitad","mito","mochila","moción","moda","modelo","moho","mojar","molde","moler","molino","momento","momia","monarca","moneda","monja","monto","moño","morada","morder","moreno","morir","morro","morsa","mortal","mosca","mostrar","motivo","mover","móvil","mozo","mucho","mudar","mueble","muela","muerte","muestra","mugre","mujer","mula","muleta","multa","mundo","muñeca","mural","muro","músculo","museo","musgo","música","muslo","nácar","nación","nadar","naipe","naranja","nariz","narrar","nasal","natal","nativo","natural","náusea","naval","nave","navidad","necio","néctar","negar","negocio","negro","neón","nervio","neto","neutro","nevar","nevera","nicho","nido","niebla","nieto","niñez","niño","nítido","nivel","nobleza","noche","nómina","noria","norma","norte","nota","noticia","novato","novela","novio","nube","nuca","núcleo","nudillo","nudo","nuera","nueve","nuez","nulo","número","nutria","oasis","obeso","obispo","objeto","obra","obrero","observar","obtener","obvio","oca","ocaso","océano","ochenta","ocho","ocio","ocre","octavo","octubre","oculto","ocupar","ocurrir","odiar","odio","odisea","oeste","ofensa","oferta","oficio","ofrecer","ogro","oído","oír","ojo","ola","oleada","olfato","olivo","olla","olmo","olor","olvido","ombligo","onda","onza","opaco","opción","ópera","opinar","oponer","optar","óptica","opuesto","oración","orador","oral","órbita","orca","orden","oreja","órgano","orgía","orgullo","oriente","origen","orilla","oro","orquesta","oruga","osadía","oscuro","osezno","oso","ostra","otoño","otro","oveja","óvulo","óxido","oxígeno","oyente","ozono","pacto","padre","paella","página","pago","país","pájaro","palabra","palco","paleta","pálido","palma","paloma","palpar","pan","panal","pánico","pantera","pañuelo","papá","papel","papilla","paquete","parar","parcela","pared","parir","paro","párpado","parque","párrafo","parte","pasar","paseo","pasión","paso","pasta","pata","patio","patria","pausa","pauta","pavo","payaso","peatón","pecado","pecera","pecho","pedal","pedir","pegar","peine","pelar","peldaño","pelea","peligro","pellejo","pelo","peluca","pena","pensar","peñón","peón","peor","pepino","pequeño","pera","percha","perder","pereza","perfil","perico","perla","permiso","perro","persona","pesa","pesca","pésimo","pestaña","pétalo","petróleo","pez","pezuña","picar","pichón","pie","piedra","pierna","pieza","pijama","pilar","piloto","pimienta","pino","pintor","pinza","piña","piojo","pipa","pirata","pisar","piscina","piso","pista","pitón","pizca","placa","plan","plata","playa","plaza","pleito","pleno","plomo","pluma","plural","pobre","poco","poder","podio","poema","poesía","poeta","polen","policía","pollo","polvo","pomada","pomelo","pomo","pompa","poner","porción","portal","posada","poseer","posible","poste","potencia","potro","pozo","prado","precoz","pregunta","premio","prensa","preso","previo","primo","príncipe","prisión","privar","proa","probar","proceso","producto","proeza","profesor","programa","prole","promesa","pronto","propio","próximo","prueba","público","puchero","pudor","pueblo","puerta","puesto","pulga","pulir","pulmón","pulpo","pulso","puma","punto","puñal","puño","pupa","pupila","puré","quedar","queja","quemar","querer","queso","quieto","química","quince","quitar","rábano","rabia","rabo","ración","radical","raíz","rama","rampa","rancho","rango","rapaz","rápido","rapto","rasgo","raspa","rato","rayo","raza","razón","reacción","realidad","rebaño","rebote","recaer","receta","rechazo","recoger","recreo","recto","recurso","red","redondo","reducir","reflejo","reforma","refrán","refugio","regalo","regir","regla","regreso","rehén","reino","reír","reja","relato","relevo","relieve","relleno","reloj","remar","remedio","remo","rencor","rendir","renta","reparto","repetir","reposo","reptil","res","rescate","resina","respeto","resto","resumen","retiro","retorno","retrato","reunir","revés","revista","rey","rezar","rico","riego","rienda","riesgo","rifa","rígido","rigor","rincón","riñón","río","riqueza","risa","ritmo","rito","rizo","roble","roce","rociar","rodar","rodeo","rodilla","roer","rojizo","rojo","romero","romper","ron","ronco","ronda","ropa","ropero","rosa","rosca","rostro","rotar","rubí","rubor","rudo","rueda","rugir","ruido","ruina","ruleta","rulo","rumbo","rumor","ruptura","ruta","rutina","sábado","saber","sabio","sable","sacar","sagaz","sagrado","sala","saldo","salero","salir","salmón","salón","salsa","salto","salud","salvar","samba","sanción","sandía","sanear","sangre","sanidad","sano","santo","sapo","saque","sardina","sartén","sastre","satán","sauna","saxofón","sección","seco","secreto","secta","sed","seguir","seis","sello","selva","semana","semilla","senda","sensor","señal","señor","separar","sepia","sequía","ser","serie","sermón","servir","sesenta","sesión","seta","setenta","severo","sexo","sexto","sidra","siesta","siete","siglo","signo","sílaba","silbar","silencio","silla","símbolo","simio","sirena","sistema","sitio","situar","sobre","socio","sodio","sol","solapa","soldado","soledad","sólido","soltar","solución","sombra","sondeo","sonido","sonoro","sonrisa","sopa","soplar","soporte","sordo","sorpresa","sorteo","sostén","sótano","suave","subir","suceso","sudor","suegra","suelo","sueño","suerte","sufrir","sujeto","sultán","sumar","superar","suplir","suponer","supremo","sur","surco","sureño","surgir","susto","sutil","tabaco","tabique","tabla","tabú","taco","tacto","tajo","talar","talco","talento","talla","talón","tamaño","tambor","tango","tanque","tapa","tapete","tapia","tapón","taquilla","tarde","tarea","tarifa","tarjeta","tarot","tarro","tarta","tatuaje","tauro","taza","tazón","teatro","techo","tecla","técnica","tejado","tejer","tejido","tela","teléfono","tema","temor","templo","tenaz","tender","tener","tenis","tenso","teoría","terapia","terco","término","ternura","terror","tesis","tesoro","testigo","tetera","texto","tez","tibio","tiburón","tiempo","tienda","tierra","tieso","tigre","tijera","tilde","timbre","tímido","timo","tinta","tío","típico","tipo","tira","tirón","titán","títere","título","tiza","toalla","tobillo","tocar","tocino","todo","toga","toldo","tomar","tono","tonto","topar","tope","toque","tórax","torero","tormenta","torneo","toro","torpedo","torre","torso","tortuga","tos","tosco","toser","tóxico","trabajo","tractor","traer","tráfico","trago","traje","tramo","trance","trato","trauma","trazar","trébol","tregua","treinta","tren","trepar","tres","tribu","trigo","tripa","triste","triunfo","trofeo","trompa","tronco","tropa","trote","trozo","truco","trueno","trufa","tubería","tubo","tuerto","tumba","tumor","túnel","túnica","turbina","turismo","turno","tutor","ubicar","úlcera","umbral","unidad","unir","universo","uno","untar","uña","urbano","urbe","urgente","urna","usar","usuario","útil","utopía","uva","vaca","vacío","vacuna","vagar","vago","vaina","vajilla","vale","válido","valle","valor","válvula","vampiro","vara","variar","varón","vaso","vecino","vector","vehículo","veinte","vejez","vela","velero","veloz","vena","vencer","venda","veneno","vengar","venir","venta","venus","ver","verano","verbo","verde","vereda","verja","verso","verter","vía","viaje","vibrar","vicio","víctima","vida","vídeo","vidrio","viejo","viernes","vigor","vil","villa","vinagre","vino","viñedo","violín","viral","virgo","virtud","visor","víspera","vista","vitamina","viudo","vivaz","vivero","vivir","vivo","volcán","volumen","volver","voraz","votar","voto","voz","vuelo","vulgar","yacer","yate","yegua","yema","yerno","yeso","yodo","yoga","yogur","zafiro","zanja","zapato","zarza","zona","zorro","zumo","zurdo"];
+t.exports=i},{}],10:[function(e,t,r){},{}],11:[function(e,t,r){(function(t){function i(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function n(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e){return this instanceof a?(this.length=0,this.parent=void 0,"number"==typeof e?o(this,e):"string"==typeof e?s(this,e,arguments.length>1?arguments[1]:"utf8"):c(this,e)):arguments.length>1?new a(e,arguments[1]):new a(e)}function o(e,t){if(e=b(e,0>t?0:0|m(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function s(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var i=0|v(t,r);return e=b(e,i),e.write(t,r),e}function c(e,t){if(a.isBuffer(t))return f(e,t);if(G(t))return u(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return d(e,t);if(t instanceof ArrayBuffer)return h(e,t)}return t.length?l(e,t):p(e,t)}function f(e,t){var r=0|m(t.length);return e=b(e,r),t.copy(e,0,0,r),e}function u(e,t){var r=0|m(t.length);e=b(e,r);for(var i=0;r>i;i+=1)e[i]=255&t[i];return e}function d(e,t){var r=0|m(t.length);e=b(e,r);for(var i=0;r>i;i+=1)e[i]=255&t[i];return e}function h(e,t){return a.TYPED_ARRAY_SUPPORT?(t.byteLength,e=a._augment(new Uint8Array(t))):e=d(e,new Uint8Array(t)),e}function l(e,t){var r=0|m(t.length);e=b(e,r);for(var i=0;r>i;i+=1)e[i]=255&t[i];return e}function p(e,t){var r,i=0;"Buffer"===t.type&&G(t.data)&&(r=t.data,i=0|m(r.length)),e=b(e,i);for(var n=0;i>n;n+=1)e[n]=255&r[n];return e}function b(e,t){a.TYPED_ARRAY_SUPPORT?(e=a._augment(new Uint8Array(t)),e.__proto__=a.prototype):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=a.poolSize>>>1;return r&&(e.parent=Z),e}function m(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e,t){if(!(this instanceof g))return new g(e,t);var r=new a(e,t);return delete r.parent,r}function v(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(i)return F(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,r){var i=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return j(this,t,r);case"ascii":return I(this,t,r);case"binary":return z(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function w(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;i>o;o++){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))throw new Error("Invalid hex string");e[r+o]=s}return o}function _(e,t,r,i){return V(F(t,e.length-r),e,r,i)}function S(e,t,r,i){return V(H(t),e,r,i)}function k(e,t,r,i){return S(e,t,r,i)}function E(e,t,r,i){return V(W(t),e,r,i)}function x(e,t,r,i){return V(Y(t,e.length-r),e,r,i)}function A(e,t,r){return 0===t&&r===e.length?X.fromByteArray(e):X.fromByteArray(e.slice(t,r))}function j(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;r>n;){var a=e[n],o=null,s=a>239?4:a>223?3:a>191?2:1;if(r>=n+s){var c,f,u,d;switch(s){case 1:128>a&&(o=a);break;case 2:c=e[n+1],128===(192&c)&&(d=(31&a)<<6|63&c,d>127&&(o=d));break;case 3:c=e[n+1],f=e[n+2],128===(192&c)&&128===(192&f)&&(d=(15&a)<<12|(63&c)<<6|63&f,d>2047&&(55296>d||d>57343)&&(o=d));break;case 4:c=e[n+1],f=e[n+2],u=e[n+3],128===(192&c)&&128===(192&f)&&128===(192&u)&&(d=(15&a)<<18|(63&c)<<12|(63&f)<<6|63&u,d>65535&&1114112>d&&(o=d))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=s}return B(i)}function B(e){var t=e.length;if($>=t)return String.fromCharCode.apply(String,e);for(var r="",i=0;t>i;)r+=String.fromCharCode.apply(String,e.slice(i,i+=$));return r}function I(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;r>n;n++)i+=String.fromCharCode(127&e[n]);return i}function z(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;r>n;n++)i+=String.fromCharCode(e[n]);return i}function R(e,t,r){var i=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>i)&&(r=i);for(var n="",a=t;r>a;a++)n+=K(e[a]);return n}function M(e,t,r){for(var i=e.slice(t,r),n="",a=0;ae)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,r,i,n,o){if(!a.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>n||o>t)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range")}function P(e,t,r,i){0>t&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);a>n;n++)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function L(e,t,r,i){0>t&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);a>n;n++)e[r+n]=t>>>8*(i?n:3-n)&255}function D(e,t,r,i,n,a){if(t>n||a>t)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function T(e,t,r,i,n){return n||D(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,n){return n||D(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,r,i,52,8),r+8}function O(e){if(e=N(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function N(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function K(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var r,i=e.length,n=null,a=[],o=0;i>o;o++){if(r=e.charCodeAt(o),r>55295&&57344>r){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=n-55296<<10|r-56320|65536}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){for(var t=[],r=0;r>8,n=r%256,a.push(n),a.push(i);return a}function W(e){return X.toByteArray(O(e))}function V(e,t,r,i){for(var n=0;i>n&&!(n+r>=t.length||n>=e.length);n++)t[n+r]=e[n];return n}var X=e("base64-js"),J=e("ieee754"),G=e("is-array");r.Buffer=a,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,a.poolSize=8192;var Z={};a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array),a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);o>n&&e[n]===t[n];)++n;return n!==o&&(r=e[n],i=t[n]),i>r?-1:r>i?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!G(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new a(0);var r;if(void 0===t)for(t=0,r=0;r0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:a.compare(this,e)},a.prototype.indexOf=function(e,t){function r(e,t,r){for(var i=-1,n=0;r+n2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(a.isBuffer(e))return r(this,e,t);if("number"==typeof e)return a.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},a.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},a.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},a.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===i&&(i="utf8")):(i=r,r=void 0);else{var n=i;i=t,t=0|r,r=n}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return S(this,e,t,r);case"binary":return k(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var i;if(a.TYPED_ARRAY_SUPPORT)i=a._augment(this.subarray(e,t));else{var n=t-e;i=new a(n,void 0);for(var o=0;n>o;o++)i[o]=this[o+e]}return i.length&&(i.parent=this.parent||this),i},a.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||q(e,t,this.length);for(var i=this[e],n=1,a=0;++a0&&(n*=256);)i+=this[e+--t]*n;return i},a.prototype.readUInt8=function(e,t){return t||q(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||q(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||q(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||q(e,t,this.length);for(var i=this[e],n=1,a=0;++a=n&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||q(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return n*=128,a>=n&&(a-=Math.pow(2,8*t)),a},a.prototype.readInt8=function(e,t){return t||q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||q(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){t||q(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return t||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||q(e,4,this.length),J.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||q(e,4,this.length),J.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||q(e,8,this.length),J.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||q(e,8,this.length),J.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,i){e=+e,t=0|t,r=0|r,i||C(this,e,t,r,Math.pow(2,8*r),0);var n=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+n]=e/a&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t=0|t,!i){var n=Math.pow(2,8*r-1);C(this,e,t,r,n-1,-n)}var a=0,o=1,s=0>e?1:0;for(this[t]=255&e;++a>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t=0|t,!i){var n=Math.pow(2,8*r-1);C(this,e,t,r,n-1,-n)}var a=r-1,o=1,s=0>e?1:0;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=(e/o>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||C(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,r){return T(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return T(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&r>i&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=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),e.length-tr&&i>t)for(n=o-1;n>=0;n--)e[n+t]=this[n+r];else if(1e3>o||!a.TYPED_ARRAY_SUPPORT)for(n=0;o>n;n++)e[n+t]=this[n+r];else e._set(this.subarray(r,r+o),t);return o},a.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var i;if("number"==typeof e)for(i=t;r>i;i++)this[i]=e;else{var n=F(e.toString()),a=n.length;for(i=t;r>i;i++)this[i]=n[i%a]}return this}},a.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(a.TYPED_ARRAY_SUPPORT)return new a(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Q=a.prototype;a._augment=function(e){return e.constructor=a,e._isBuffer=!0,e._set=e.set,e.get=Q.get,e.set=Q.set,e.write=Q.write,e.toString=Q.toString,e.toLocaleString=Q.toString,e.toJSON=Q.toJSON,e.equals=Q.equals,e.compare=Q.compare,e.indexOf=Q.indexOf,e.copy=Q.copy,e.slice=Q.slice,e.readUIntLE=Q.readUIntLE,e.readUIntBE=Q.readUIntBE,e.readUInt8=Q.readUInt8,e.readUInt16LE=Q.readUInt16LE,e.readUInt16BE=Q.readUInt16BE,e.readUInt32LE=Q.readUInt32LE,e.readUInt32BE=Q.readUInt32BE,e.readIntLE=Q.readIntLE,e.readIntBE=Q.readIntBE,e.readInt8=Q.readInt8,e.readInt16LE=Q.readInt16LE,e.readInt16BE=Q.readInt16BE,e.readInt32LE=Q.readInt32LE,e.readInt32BE=Q.readInt32BE,e.readFloatLE=Q.readFloatLE,e.readFloatBE=Q.readFloatBE,e.readDoubleLE=Q.readDoubleLE,e.readDoubleBE=Q.readDoubleBE,e.writeUInt8=Q.writeUInt8,e.writeUIntLE=Q.writeUIntLE,e.writeUIntBE=Q.writeUIntBE,e.writeUInt16LE=Q.writeUInt16LE,e.writeUInt16BE=Q.writeUInt16BE,e.writeUInt32LE=Q.writeUInt32LE,e.writeUInt32BE=Q.writeUInt32BE,e.writeIntLE=Q.writeIntLE,e.writeIntBE=Q.writeIntBE,e.writeInt8=Q.writeInt8,e.writeInt16LE=Q.writeInt16LE,e.writeInt16BE=Q.writeInt16BE,e.writeInt32LE=Q.writeInt32LE,e.writeInt32BE=Q.writeInt32BE,e.writeFloatLE=Q.writeFloatLE,e.writeFloatBE=Q.writeFloatBE,e.writeDoubleLE=Q.writeDoubleLE,e.writeDoubleBE=Q.writeDoubleBE,e.fill=Q.fill,e.inspect=Q.inspect,e.toArrayBuffer=Q.toArrayBuffer,e};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":12,ieee754:13,"is-array":14}],12:[function(e,t,r){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===o||t===d?62:t===s||t===h?63:c>t?-1:c+10>t?t-c+26+26:u+26>t?t-u:f+26>t?t-f+26:void 0}function r(e){function r(e){f[d++]=e}var i,n,o,s,c,f;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=e.length;c="="===e.charAt(u-2)?2:"="===e.charAt(u-1)?1:0,f=new a(3*e.length/4-c),o=c>0?e.length-4:e.length;var d=0;for(i=0,n=0;o>i;i+=4,n+=3)s=t(e.charAt(i))<<18|t(e.charAt(i+1))<<12|t(e.charAt(i+2))<<6|t(e.charAt(i+3)),r((16711680&s)>>16),r((65280&s)>>8),r(255&s);return 2===c?(s=t(e.charAt(i))<<2|t(e.charAt(i+1))>>4,r(255&s)):1===c&&(s=t(e.charAt(i))<<10|t(e.charAt(i+1))<<4|t(e.charAt(i+2))>>2,r(s>>8&255),r(255&s)),f}function n(e){function t(e){return i.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var n,a,o,s=e.length%3,c="";for(n=0,o=e.length-s;o>n;n+=3)a=(e[n]<<16)+(e[n+1]<<8)+e[n+2],c+=r(a);switch(s){case 1:a=e[e.length-1],c+=t(a>>2),c+=t(a<<4&63),c+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],c+=t(a>>10),c+=t(a>>4&63),c+=t(a<<2&63),c+="="}return c}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),s="/".charCodeAt(0),c="0".charCodeAt(0),f="a".charCodeAt(0),u="A".charCodeAt(0),d="-".charCodeAt(0),h="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=n}("undefined"==typeof r?this.base64js={}:r)},{}],13:[function(e,t,r){r.read=function(e,t,r,i,n){var a,o,s=8*n-i-1,c=(1<>1,u=-7,d=r?n-1:0,h=r?-1:1,l=e[t+d];for(d+=h,a=l&(1<<-u)-1,l>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=i;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===a)a=1-f;else{if(a===c)return o?NaN:(l?-1:1)*(1/0);o+=Math.pow(2,i),a-=f}return(l?-1:1)*o*Math.pow(2,a-i)},r.write=function(e,t,r,i,n,a){var o,s,c,f=8*a-n-1,u=(1<>1,h=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,l=i?0:a-1,p=i?1:-1,b=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),t+=o+d>=1?h/c:h*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*Math.pow(2,n),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;e[r+l]=255&s,l+=p,s/=256,n-=8);for(o=o<0;e[r+l]=255&o,l+=p,o/=256,f-=8);e[r+l-p]|=128*b}},{}],14:[function(e,t,r){var i=Array.isArray,n=Object.prototype.toString;t.exports=i||function(e){return!!e&&"[object Array]"==n.call(e)}},{}],15:[function(e,t,r){"use strict";r.randomBytes=r.rng=r.pseudoRandomBytes=r.prng=e("randombytes"),r.createHash=r.Hash=e("create-hash"),r.createHmac=r.Hmac=e("create-hmac");var i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(e("browserify-sign/algos")));r.getHashes=function(){return i};var n=e("pbkdf2");r.pbkdf2=n.pbkdf2,r.pbkdf2Sync=n.pbkdf2Sync;var a=e("browserify-cipher");["Cipher","createCipher","Cipheriv","createCipheriv","Decipher","createDecipher","Decipheriv","createDecipheriv","getCiphers","listCiphers"].forEach(function(e){r[e]=a[e]});var o=e("diffie-hellman");["DiffieHellmanGroup","createDiffieHellmanGroup","getDiffieHellman","createDiffieHellman","DiffieHellman"].forEach(function(e){r[e]=o[e]});var s=e("browserify-sign");["createSign","Sign","createVerify","Verify"].forEach(function(e){r[e]=s[e]}),r.createECDH=e("create-ecdh");var c=e("public-encrypt");["publicEncrypt","privateEncrypt","publicDecrypt","privateDecrypt"].forEach(function(e){r[e]=c[e]}),["createCredentials"].forEach(function(e){r[e]=function(){throw new Error(["sorry, "+e+" is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))}})},{"browserify-cipher":16,"browserify-sign":46,"browserify-sign/algos":45,"create-ecdh":110,"create-hash":133,"create-hmac":146,"diffie-hellman":147,pbkdf2:154,"public-encrypt":155,randombytes:200}],16:[function(e,t,r){function i(e,t){var r,i;if(e=e.toLowerCase(),h[e])r=h[e].key,i=h[e].iv;else{if(!d[e])throw new TypeError("invalid suite type");r=8*d[e].key,i=d[e].iv}var n=c(t,!1,r,i);return a(e,n.key,n.iv)}function n(e,t){var r,i;if(e=e.toLowerCase(),h[e])r=h[e].key,i=h[e].iv;else{if(!d[e])throw new TypeError("invalid suite type");r=8*d[e].key,i=d[e].iv}var n=c(t,!1,r,i);return o(e,n.key,n.iv)}function a(e,t,r){if(e=e.toLowerCase(),h[e])return f.createCipheriv(e,t,r);if(d[e])return new u({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function o(e,t,r){if(e=e.toLowerCase(),h[e])return f.createDecipheriv(e,t,r);if(d[e])return new u({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function s(){return Object.keys(d).concat(f.getCiphers())}var c=e("evp_bytestokey"),f=e("browserify-aes/browser"),u=e("browserify-des"),d=e("browserify-des/modes"),h=e("browserify-aes/modes");r.createCipher=r.Cipher=i,r.createCipheriv=r.Cipheriv=a,r.createDecipher=r.Decipher=n,r.createDecipheriv=r.Decipheriv=o,r.listCiphers=r.getCiphers=s},{"browserify-aes/browser":19,"browserify-aes/modes":23,"browserify-des":34,"browserify-des/modes":35,evp_bytestokey:44}],17:[function(e,t,r){(function(e){function t(e){var t,r;return t=e>s||0>e?(r=Math.abs(e)%s,0>e?s-r:r):e}function i(e){for(var t=0;te;t=++e)128>t?r.push(t<<1):r.push(t<<1^283);return r}(),n=0,c=0,t=f=0;256>f;t=++f)r=c^c<<1^c<<2^c<<3^c<<4,r=r>>>8^255&r^99,this.SBOX[n]=r,this.INV_SBOX[r]=n,a=e[n],o=e[a],s=e[o],i=257*e[r]^16843008*r,this.SUB_MIX[0][n]=i<<24|i>>>8,this.SUB_MIX[1][n]=i<<16|i>>>16,this.SUB_MIX[2][n]=i<<8|i>>>24,this.SUB_MIX[3][n]=i,i=16843009*s^65537*o^257*a^16843008*n,this.INV_SUB_MIX[0][r]=i<<24|i>>>8,this.INV_SUB_MIX[1][r]=i<<16|i>>>16,this.INV_SUB_MIX[2][r]=i<<8|i>>>24,this.INV_SUB_MIX[3][r]=i,0===n?n=c=1:(n=a^e[e[e[s^a]]],c^=e[e[c]]);return!0};var c=new n;o.blockSize=16,o.prototype.blockSize=o.blockSize,o.keySize=32,o.prototype.keySize=o.keySize,o.prototype._doReset=function(){var e,t,r,i,n,a;for(r=this._key,t=r.length,this._nRounds=t+6,n=4*(this._nRounds+1),this._keySchedule=[],i=0;n>i;i++)this._keySchedule[i]=t>i?r[i]:(a=this._keySchedule[i-1],i%t===0?(a=a<<8|a>>>24,a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a],a^=c.RCON[i/t|0]<<24):t>6&&i%t===4?a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a]:void 0,this._keySchedule[i-t]^a);for(this._invKeySchedule=[],e=0;n>e;e++)i=n-e,a=this._keySchedule[i-(e%4?0:4)],this._invKeySchedule[e]=4>e||4>=i?a:c.INV_SUB_MIX[0][c.SBOX[a>>>24]]^c.INV_SUB_MIX[1][c.SBOX[a>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[a>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&a]];return!0},o.prototype.encryptBlock=function(t){t=a(new e(t));var r=this._doCryptBlock(t,this._keySchedule,c.SUB_MIX,c.SBOX),i=new e(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[1],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[3],12),i},o.prototype.decryptBlock=function(t){t=a(new e(t));var r=[t[3],t[1]];t[1]=r[0],t[3]=r[1];var i=this._doCryptBlock(t,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX),n=new e(16);return n.writeUInt32BE(i[0],0),n.writeUInt32BE(i[3],4),n.writeUInt32BE(i[2],8),n.writeUInt32BE(i[1],12),n},o.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},o.prototype._doCryptBlock=function(e,r,i,n){var a,o,s,c,f,u,d,h,l;o=e[0]^r[0],s=e[1]^r[1],c=e[2]^r[2],f=e[3]^r[3],a=4;for(var p=1;p>>24]^i[1][s>>>16&255]^i[2][c>>>8&255]^i[3][255&f]^r[a++],d=i[0][s>>>24]^i[1][c>>>16&255]^i[2][f>>>8&255]^i[3][255&o]^r[a++],h=i[0][c>>>24]^i[1][f>>>16&255]^i[2][o>>>8&255]^i[3][255&s]^r[a++],l=i[0][f>>>24]^i[1][o>>>16&255]^i[2][s>>>8&255]^i[3][255&c]^r[a++],o=u,s=d,c=h,f=l;return u=(n[o>>>24]<<24|n[s>>>16&255]<<16|n[c>>>8&255]<<8|n[255&f])^r[a++],d=(n[s>>>24]<<24|n[c>>>16&255]<<16|n[f>>>8&255]<<8|n[255&o])^r[a++],h=(n[c>>>24]<<24|n[f>>>16&255]<<16|n[o>>>8&255]<<8|n[255&s])^r[a++],l=(n[f>>>24]<<24|n[o>>>16&255]<<16|n[s>>>8&255]<<8|n[255&c])^r[a++],[t(u),t(d),t(h),t(l)]},r.AES=o}).call(this,e("buffer").Buffer)},{buffer:11}],18:[function(e,t,r){(function(r){function i(e,t,n,s){if(!(this instanceof i))return new i(e,t,n);o.call(this),this._finID=r.concat([n,new r([0,0,0,1])]),n=r.concat([n,new r([0,0,0,2])]),this._cipher=new a.AES(t),this._prev=new r(n.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=s,this._alen=0,this._len=0,n.copy(this._prev),this._mode=e;var f=new r(4);f.fill(0),this._ghash=new c(this._cipher.encryptBlock(f)),this._authTag=null,this._called=!1}function n(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=-1;++nt&&(t=new r(t),t.fill(0),this._ghash.update(t))}this._called=!0;var i=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(i),this._len+=e.length,i},i.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=f(this._ghash["final"](8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt){if(n(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data")}else this._authTag=e;this._cipher.scrub()},i.prototype.getAuthTag=function(){if(!this._decrypt&&r.isBuffer(this._authTag))return this._authTag;throw new Error("Attempting to get auth tag in unsupported state")},i.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},i.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length}}).call(this,e("buffer").Buffer)},{"./aes":17,"./ghash":22,buffer:11,"buffer-xor":31,"cipher-base":32,inherits:202}],19:[function(e,t,r){function i(){return Object.keys(o)}var n=e("./encrypter");r.createCipher=r.Cipher=n.createCipher,r.createCipheriv=r.Cipheriv=n.createCipheriv;var a=e("./decrypter");r.createDecipher=r.Decipher=a.createDecipher,r.createDecipheriv=r.Decipheriv=a.createDecipheriv;var o=e("./modes");r.listCiphers=r.getCiphers=i},{"./decrypter":20,"./encrypter":21,"./modes":23}],20:[function(e,t,r){(function(t){function i(e,r,a){return this instanceof i?(f.call(this),this._cache=new n,this._last=void 0,this._cipher=new c.AES(r),this._prev=new t(a.length),a.copy(this._prev),this._mode=e,void(this._autopadding=!0)):new i(e,r,a)}function n(){return this instanceof n?void(this.cache=new t("")):new n}function a(e){for(var t=e[15],r=-1;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},n.prototype.flush=function(){return this.cache.length?this.cache:void 0};var b={ECB:e("./modes/ecb"),CBC:e("./modes/cbc"),CFB:e("./modes/cfb"),CFB8:e("./modes/cfb8"),CFB1:e("./modes/cfb1"),OFB:e("./modes/ofb"),CTR:e("./modes/ctr"),GCM:e("./modes/ctr")};r.createDecipher=s,r.createDecipheriv=o}).call(this,e("buffer").Buffer)},{"./aes":17,"./authCipher":18,"./modes":23,"./modes/cbc":24,"./modes/cfb":25,"./modes/cfb1":26,"./modes/cfb8":27,"./modes/ctr":28,"./modes/ecb":29,"./modes/ofb":30,"./streamCipher":33,buffer:11,"cipher-base":32,evp_bytestokey:44,inherits:202}],21:[function(e,t,r){(function(t){function i(e,r,a){return this instanceof i?(c.call(this),this._cache=new n,this._cipher=new s.AES(r),
+this._prev=new t(a.length),a.copy(this._prev),this._mode=e,void(this._autopadding=!0)):new i(e,r,a)}function n(){return this instanceof n?void(this.cache=new t("")):new n}function a(e,r,n){var a=u[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=new t(n)),"string"==typeof r&&(r=new t(r)),r.length!==a.key/8)throw new TypeError("invalid key length "+r.length);if(n.length!==a.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===a.type?new h(p[a.mode],r,n):"auth"===a.type?new l(p[a.mode],r,n):new i(p[a.mode],r,n)}function o(e,t){var r=u[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=d(t,!1,r.key,r.iv);return a(e,i.key,i.iv)}var s=e("./aes"),c=e("cipher-base"),f=e("inherits"),u=e("./modes"),d=e("evp_bytestokey"),h=e("./streamCipher"),l=e("./authCipher");f(i,c),i.prototype._update=function(e){this._cache.add(e);for(var r,i,n=[];r=this._cache.get();)i=this._mode.encrypt(this,r),n.push(i);return t.concat(n)},i.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if("10101010101010101010101010101010"!==e.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},i.prototype.setAutoPadding=function(e){this._autopadding=!!e},n.prototype.add=function(e){this.cache=t.concat([this.cache,e])},n.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},n.prototype.flush=function(){for(var e=16-this.cache.length,r=new t(e),i=-1;++ic||0>e?(r=Math.abs(e)%c,0>e?c-r:r):e}function o(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}var s=new e(16);s.fill(0),t.exports=r,r.prototype.ghash=function(e){for(var t=-1;++t0;e--)a[e]=a[e]>>>1|(1&a[e-1])<<31;a[0]=a[0]>>>1,r&&(a[0]=a[0]^225<<24)}this.state=n(s)},r.prototype.update=function(t){this.cache=e.concat([this.cache,t]);for(var r;this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},r.prototype["final"]=function(t,r){return this.cache.length&&this.ghash(e.concat([this.cache,s],16)),this.ghash(n([0,t,0,r])),this.state};var c=Math.pow(2,32)}).call(this,e("buffer").Buffer)},{buffer:11}],23:[function(e,t,r){r["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},r["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},r["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},r["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},r["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},r["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},r.aes128=r["aes-128-cbc"],r.aes192=r["aes-192-cbc"],r.aes256=r["aes-256-cbc"],r["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},r["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},r["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},r["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},r["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},r["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},r["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},r["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},r["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},r["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},r["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},r["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},r["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},r["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},r["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},r["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},r["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},r["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],24:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":31}],25:[function(e,t,r){(function(t){function i(e,r,i){var a=r.length,o=n(r,e._cache);return e._cache=e._cache.slice(a),e._prev=t.concat([e._prev,i?r:o]),o}var n=e("buffer-xor");r.encrypt=function(e,r,n){for(var a,o=new t("");r.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=new t("")),!(e._cache.length<=r.length)){o=t.concat([o,i(e,r,n)]);break}a=e._cache.length,o=t.concat([o,i(e,r.slice(0,a),n)]),r=r.slice(a)}return o}}).call(this,e("buffer").Buffer)},{buffer:11,"buffer-xor":31}],26:[function(e,t,r){(function(e){function t(e,t,r){for(var n,a,o,s=-1,c=8,f=0;++s>s%8,e._prev=i(e._prev,r?a:o);return f}function i(t,r){var i=t.length,n=-1,a=new e(t.length);for(t=e.concat([t,new e([r])]);++n>7;return a}r.encrypt=function(r,i,n){for(var a=i.length,o=new e(a),s=-1;++sa;++a)n[a]=t[a]^r[a];return n}}).call(this,e("buffer").Buffer)},{buffer:11}],32:[function(e,t,r){(function(r){function i(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this["final"]=this._finalOrDigest,this._decoder=null,this._encoding=null}var n=e("stream").Transform,a=e("inherits"),o=e("string_decoder").StringDecoder;t.exports=i,a(i,n),i.prototype.update=function(e,t,i){"string"==typeof e&&(e=new r(e,t));var n=this._update(e);return this.hashMode?this:(i&&(n=this._toString(n,i)),n)},i.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(n){i=n}finally{r(i)}},i.prototype._flush=function(e){var t;try{this.push(this._final())}catch(r){t=r}finally{e(t)}},i.prototype._finalOrDigest=function(e){var t=this._final()||new r("");return e&&(t=this._toString(t,e,!0)),t},i.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i}}).call(this,e("buffer").Buffer)},{buffer:11,inherits:202,stream:219,string_decoder:220}],33:[function(e,t,r){(function(r){function i(e,t,o,s){return this instanceof i?(a.call(this),this._cipher=new n.AES(t),this._prev=new r(o.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=s,o.copy(this._prev),void(this._mode=e)):new i(e,t,o)}var n=e("./aes"),a=e("cipher-base"),o=e("inherits");o(i,a),t.exports=i,i.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},i.prototype._final=function(){this._cipher.scrub()}}).call(this,e("buffer").Buffer)},{"./aes":17,buffer:11,"cipher-base":32,inherits:202}],34:[function(e,t,r){(function(r){function i(e){n.call(this);var t,i=e.mode.toLowerCase(),a=s[i];t=e.decrypt?"decrypt":"encrypt";var o=e.key;("des-ede"===i||"des-ede-cbc"===i)&&(o=r.concat([o,o.slice(0,8)]));var c=e.iv;this._des=a.create({key:o,iv:c,type:t})}var n=e("cipher-base"),a=e("des.js"),o=e("inherits"),s={"des-ede3-cbc":a.CBC.instantiate(a.EDE),"des-ede3":a.EDE,"des-ede-cbc":a.CBC.instantiate(a.EDE),"des-ede":a.EDE,"des-cbc":a.CBC.instantiate(a.DES),"des-ecb":a.DES};s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=i,o(i,n),i.prototype._update=function(e){return new r(this._des.update(e))},i.prototype._final=function(){return new r(this._des["final"]())}}).call(this,e("buffer").Buffer)},{buffer:11,"cipher-base":36,"des.js":37,inherits:202}],35:[function(e,t,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],36:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{buffer:11,dup:32,inherits:202,stream:219,string_decoder:220}],37:[function(e,t,r){"use strict";r.utils=e("./des/utils"),r.Cipher=e("./des/cipher"),r.DES=e("./des/des"),r.CBC=e("./des/cbc"),r.EDE=e("./des/ede")},{"./des/cbc":38,"./des/cipher":39,"./des/des":40,"./des/ede":41,"./des/utils":42}],38:[function(e,t,r){"use strict";function i(e){a.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;ti;i++)this.buffer[this.bufferOff+i]=e[t+i];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(e){var t=0,r=0,i=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(i*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var a=e.length-(e.length-t)%this.blockSize;a>t;t+=this.blockSize)this._update(e,t,n,r),r+=this.blockSize;for(;t0;i--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},i.prototype["final"]=function(e){var t;e&&(t=this.update(e));var r;return r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];r=c.r28shl(r,o),i=c.r28shl(i,o),c.pc2(r,i,e.keys,n)}},n.prototype._update=function(e,t,r,i){var n=this._desState,a=c.readUInt32BE(e,t),o=c.readUInt32BE(e,t+4);c.ip(a,o,n.tmp,0),a=n.tmp[0],o=n.tmp[1],"encrypt"===this.type?this._encrypt(n,a,o,n.tmp,0):this._decrypt(n,a,o,n.tmp,0),a=n.tmp[0],o=n.tmp[1],c.writeUInt32BE(r,a,i),c.writeUInt32BE(r,o,i+4)},n.prototype._pad=function(e,t){for(var r=e.length-t,i=t;i>>0,a=l}c.rip(o,a,i,n)},n.prototype._decrypt=function(e,t,r,i,n){for(var a=r,o=t,s=e.keys.length-2;s>=0;s-=2){var f=e.keys[s],u=e.keys[s+1];c.expand(a,e.tmp,0),f^=e.tmp[0],u^=e.tmp[1];var d=c.substitute(f,u),h=c.permute(d),l=a;a=(o^h)>>>0,o=l}c.rip(a,o,i,n)}},{"../des":37,inherits:202,"minimalistic-assert":43}],41:[function(e,t,r){"use strict";function i(e,t){a.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),i=t.slice(8,16),n=t.slice(16,24);"encrypt"===e?this.ciphers=[f.create({type:"encrypt",key:r}),f.create({type:"decrypt",key:i}),f.create({type:"encrypt",key:n})]:this.ciphers=[f.create({type:"decrypt",key:n}),f.create({type:"encrypt",key:i}),f.create({type:"decrypt",key:r})]}function n(e){c.call(this,e);var t=new i(this.type,this.options.key);this._edeState=t}var a=e("minimalistic-assert"),o=e("inherits"),s=e("../des"),c=s.Cipher,f=s.DES;o(n,c),t.exports=n,n.create=function(e){return new n(e)},n.prototype._update=function(e,t,r,i){var n=this._edeState;n.ciphers[0]._update(e,t,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},n.prototype._pad=f.prototype._pad,n.prototype._unpad=f.prototype._unpad},{"../des":37,inherits:202,"minimalistic-assert":43}],42:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){var r=e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t];return r>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var s=0;24>=s;s+=8)n<<=1,n|=t>>>s+o&1;for(var s=0;24>=s;s+=8)n<<=1,n|=e>>>s+o&1}for(var o=6;o>=0;o-=2){for(var s=1;25>=s;s+=8)a<<=1,a|=t>>>s+o&1;for(var s=1;25>=s;s+=8)a<<=1,a|=e>>>s+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},r.rip=function(e,t,r,i){for(var n=0,a=0,o=0;4>o;o++)for(var s=24;s>=0;s-=8)n<<=1,n|=t>>>s+o&1,n<<=1,n|=e>>>s+o&1;for(var o=4;8>o;o++)for(var s=24;s>=0;s-=8)a<<=1,a|=t>>>s+o&1,a<<=1,a|=e>>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},r.pc1=function(e,t,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var s=0;24>=s;s+=8)n<<=1,n|=t>>s+o&1;for(var s=0;24>=s;s+=8)n<<=1,n|=e>>s+o&1}for(var s=0;24>=s;s+=8)n<<=1,n|=t>>s+o&1;for(var o=1;3>=o;o++){for(var s=0;24>=s;s+=8)a<<=1,a|=t>>s+o&1;for(var s=0;24>=s;s+=8)a<<=1,a|=e>>s+o&1}for(var s=0;24>=s;s+=8)a<<=1,a|=e>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},r.r28shl=function(e,t){return e<>>28-t};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var a=0,o=0,s=i.length>>>1,c=0;s>c;c++)a<<=1,a|=e>>>i[c]&1;for(var c=s;c>>i[c]&1;r[n+0]=a>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var i=0,n=0;i=(1&e)<<5|e>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=e>>>a&63;for(var a=11;a>=3;a-=4)n|=e>>>a&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=i>>>0,t[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,i=0;4>i;i++){var a=e>>>18-6*i&63,o=n[64*i+a];r<<=4,r|=o}for(var i=0;4>i;i++){var a=t>>>18-6*i&63,o=n[256+64*i+a];r<<=4,r|=o}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>a[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var i=e.toString(2);i.lengtha;a+=r)n.push(i.slice(a,a+r));return n.join(" ")}},{}],43:[function(e,t,r){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=i,i.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],44:[function(e,t,r){(function(r){function i(e,t,i,a){r.isBuffer(e)||(e=new r(e,"binary")),t&&!r.isBuffer(t)&&(t=new r(t,"binary")),i/=8,a=a||0;for(var o,s,c=0,f=0,u=new r(i),d=new r(a),h=0,l=[];;){if(h++>0&&l.push(o),l.push(e),t&&l.push(t),o=n(r.concat(l)),l=[],s=0,i>0)for(;;){if(0===i)break;if(s===o.length)break;u[c++]=o[s],i--,s++}if(a>0&&s!==o.length)for(;;){if(0===a)break;if(s===o.length)break;d[f++]=o[s],a--,s++}if(0===i&&0===a)break}for(s=0;sa;a++){var o=e.charCodeAt(a)-48;i<<=4,i|=o>=49&&54>=o?o-49+10:o>=17&&22>=o?o-17+10:15&o}return i}function o(e,t,r,i){for(var n=0,a=Math.min(e.length,r),o=t;a>o;o++){var s=e.charCodeAt(o)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}function s(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function c(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function u(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function d(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function h(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else this.m=e,this.prime=null}function l(e){h.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26,n.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&36>=t),e=e.toString().replace(/\s+/g,"");var n=0;"-"===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),"-"===e[0]&&(this.sign=!0),this.strip(),"le"===i&&this._initArray(this.toArray(),t,i)},n.prototype._initNumber=function(e,t,i){0>e&&(this.sign=!0,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),t,i)},n.prototype._initArray=function(e,t,i){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3){var s=e[n]|e[n-1]<<8|e[n-2]<<16;this.words[o]|=s<>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}else if("le"===i)for(var n=0,o=0;n>>26-a&67108863,a+=24,a>=26&&(a-=26,o++)}return this.strip()},n.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6){var o=a(e,r,r+6);this.words[n]|=o<>>26-i&4194303,i+=24,i>=26&&(i-=26,n++)}if(r+6!==t){var o=a(e,t,r+6);this.words[n]|=o<>>26-i&4194303}this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;67108863>=n;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,c=Math.min(a,a-s)+r,f=0,u=r;c>u;u+=i)f=o(e,u,u+i,t),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){for(var d=1,f=o(e,u,e.length,t),u=0;s>u;u++)d*=t;this.imuln(d),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},n.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},n.prototype.inspect=function(){return(this.red?""};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(e,t){if(e=e||10,16===e||"hex"===e){for(var i="",n=0,t=0|t||1,a=0,o=0;o>>24-n&16777215,i=0!==a||o!==this.length-1?p[6-c.length]+c+i:c+i,n+=2,n>=26&&(n-=26,o--)}for(0!==a&&(i=a.toString(16)+i);i.length%t!==0;)i="0"+i;return this.sign&&(i="-"+i),i}if(e===(0|e)&&e>=2&&36>=e){var f=b[e],u=m[e],i="",d=this.clone();for(d.sign=!1;0!==d.cmpn(0);){var h=d.modn(u).toString(e);d=d.idivn(u),i=0!==d.cmpn(0)?p[f-h.length]+h+i:h+i}return 0===this.cmpn(0)&&(i="0"+i),this.sign&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toArray=function(e){this.strip();var t=new Array(this.byteLength());t[0]=0;var r=this.clone();if("le"!==e)for(var i=0;0!==r.cmpn(0);i++){var n=r.andln(255);r.ishrn(8),t[t.length-i-1]=n}else for(var i=0;0!==r.cmpn(0);i++){var n=r.andln(255);r.ishrn(8),t[i]=n}return t},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0===(8191&t)&&(r+=13,t>>>=13),0===(127&t)&&(r+=7,t>>>=7),0===(15&t)&&(r+=4,t>>>=4),0===(3&t)&&(r+=2,t>>>=2),0===(1&t)&&r++,r},n.prototype.bitLength=function(){var e=0,t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.iand=function(e){this.sign=this.sign&&e.sign;var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.ixor=function(e){this.sign=this.sign||e.sign;var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);for(var i=e/26|0,n=e%26;this.length<=i;)this.words[this.length++]=0;return t?this.words[i]=this.words[i]|1<e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a>>26}for(;0!==n&&a>>26}if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ae.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(e.sign){e.sign=!1;var t=this.iadd(e);return e.sign=!0,t._normSign()}if(this.sign)return this.sign=!1,this.iadd(e),this.sign=!0,this._normSign();var r=this.cmp(e);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var i,n;r>0?(i=this,n=e):(i=e,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&t}for(;0!==a&&o>26,this.words[o]=67108863&t}if(0===a&&o>>26,a=67108863&r,o=Math.min(i,e.length-1),s=Math.max(0,i-this.length+1);o>=s;s++){var c=i-s,f=0|this.words[c],u=0|e.words[s],d=f*u,h=67108863&d;n=n+(d/67108864|0)|0,h=h+a|0,a=67108863&h,n=n+(h>>>26)|0}t.words[i]=a,r=n}return 0!==r?t.words[i]=r:t.length--,t.strip()},n.prototype._bigMulTo=function(e,t){t.sign=e.sign!==this.sign,t.length=this.length+e.length;for(var r=0,i=0,n=0;n=c;c++){var f=n-c,u=0|this.words[f],d=0|e.words[c],h=u*d,l=67108863&h;a=a+(h/67108864|0)|0,l=l+o|0,o=67108863&l,a=a+(l>>>26)|0,i+=a>>>26,a&=67108863}t.words[n]=o,r=a,a=i}return 0!==r?t.words[n]=r:t.length--,t.strip()},n.prototype.mulTo=function(e,t){var r;return r=this.length+e.length<63?this._smallMulTo(e,t):this._bigMulTo(e,t)},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.imul=function(e){if(0===this.cmpn(0)||0===e.cmpn(0))return this.words[0]=0,this.length=1,this;var t=this.length,r=e.length;this.sign=e.sign!==this.sign,this.length=this.length+e.length,this.words[this.length-1]=0;for(var i=this.length-2;i>=0;i--){for(var n=0,a=0,o=Math.min(i,r-1),s=Math.max(0,i-t+1);o>=s;s++){var c=i-s,f=this.words[c],u=e.words[s],d=f*u,h=67108863&d;n+=d/67108864|0,h+=a,a=67108863&h,n+=h>>>26}this.words[i]=a,this.words[i+1]+=n,n=0}for(var n=0,c=1;c>>26}return this.strip()},n.prototype.imuln=function(e){r("number"==typeof e);for(var t=0,i=0;i>=26,t+=n/67108864|0,t+=a>>>26,this.words[i]=67108863&a}return 0!==t&&(this.words[i]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.mul(this)},n.prototype.ishln=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26,n=67108863>>>26-t<<26-t;if(0!==t){for(var a=0,o=0;o>>26-t}a&&(this.words[o]=a,this.length++)}if(0!==i){for(var o=this.length-1;o>=0;o--)this.words[o+i]=this.words[o];for(var o=0;i>o;o++)this.words[o]=0;this.length+=i}return this.strip()},n.prototype.ishrn=function(e,t,i){r("number"==typeof e&&e>=0);var n;n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<f;f++)c.words[f]=this.words[f];c.length=o}if(0===o);else if(this.length>o){this.length-=o;for(var f=0;f=0&&(0!==u||f>=n);f--){var d=this.words[f];this.words[f]=u<<26-a|d>>>a,u=d&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26,n=1<=0);var t=e%26,i=(e-t)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==t&&i++,this.length=Math.min(i,this.length),0!==t){var n=67108863^67108863>>>t<e?this.isubn(-e):this.sign?1===this.length&&this.words[0]=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},n.prototype.isubn=function(e){if(r("number"==typeof e),0>e)return this.iaddn(-e);if(this.sign)return this.sign=!1,this.iaddn(e),this.sign=!0,this;this.words[0]-=e;for(var t=0;t>26)-(f/67108864|0),this.words[n+i]=67108863&c}for(;n>26,this.words[n+i]=67108863&c}if(0===s)return this.strip();r(-1===s),s=0;for(var n=0;n>26,this.words[n]=67108863&c}return this.sign=!0,this.strip()},n.prototype._wordDiv=function(e,t){var r=this.length-e.length,i=this.clone(),a=e,o=a.words[a.length-1],s=this._countBits(o);r=26-s,0!==r&&(a=a.shln(r),i.ishln(r),o=a.words[a.length-1]);var c,f=i.length-a.length;if("mod"!==t){c=new n(null),c.length=f+1,c.words=new Array(c.length);for(var u=0;u=0;h--){var l=67108864*i.words[a.length+h]+i.words[a.length+h-1];for(l=Math.min(l/o|0,67108863),i._ishlnsubmul(a,l,h);i.sign;)l--,i.sign=!1,i._ishlnsubmul(a,1,h),0!==i.cmpn(0)&&(i.sign=!i.sign);c&&(c.words[h]=l)}return c&&c.strip(),i.strip(),"div"!==t&&0!==r&&i.ishrn(r),{div:c?c:null,mod:i}},n.prototype.divmod=function(e,t){if(r(0!==e.cmpn(0)),this.sign&&!e.sign){var i,a,o=this.neg().divmod(e,t);return"mod"!==t&&(i=o.div.neg()),"div"!==t&&(a=0===o.mod.cmpn(0)?o.mod:e.sub(o.mod)),{div:i,mod:a}}if(!this.sign&&e.sign){var i,o=this.divmod(e.neg(),t);return"mod"!==t&&(i=o.div.neg()),{div:i,mod:o.mod}}return this.sign&&e.sign?this.neg().divmod(e.neg(),t):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t)},n.prototype.div=function(e){return this.divmod(e,"div").div},n.prototype.mod=function(e){return this.divmod(e,"mod").mod},n.prototype.divRound=function(e){var t=this.divmod(e);if(0===t.mod.cmpn(0))return t.div;var r=t.div.sign?t.mod.isub(e):t.mod,i=e.shrn(1),n=e.andln(1),a=r.cmp(i);return 0>a||1===n&&0===a?t.div:t.div.sign?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(67108863>=e);for(var t=(1<<26)%e,i=0,n=this.length-1;n>=0;n--)i=(t*i+this.words[n])%e;return i},n.prototype.idivn=function(e){r(67108863>=e);for(var t=0,i=this.length-1;i>=0;i--){var n=this.words[i]+67108864*t;this.words[i]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(!e.sign),r(0!==e.cmpn(0));var t=this,i=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),o=new n(0),s=new n(0),c=new n(1),f=0;t.isEven()&&i.isEven();)t.ishrn(1),i.ishrn(1),++f;for(var u=i.clone(),d=t.clone();0!==t.cmpn(0);){for(;t.isEven();)t.ishrn(1),a.isEven()&&o.isEven()?(a.ishrn(1),o.ishrn(1)):(a.iadd(u).ishrn(1),o.isub(d).ishrn(1));for(;i.isEven();)i.ishrn(1),s.isEven()&&c.isEven()?(s.ishrn(1),c.ishrn(1)):(s.iadd(u).ishrn(1),c.isub(d).ishrn(1));t.cmp(i)>=0?(t.isub(i),a.isub(s),o.isub(c)):(i.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:i.ishln(f)}},n.prototype._invmp=function(e){r(!e.sign),r(0!==e.cmpn(0));var t=this,i=e.clone();t=t.sign?t.mod(e):t.clone();for(var a=new n(1),o=new n(0),s=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(;t.isEven();)t.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);for(;i.isEven();)i.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);t.cmp(i)>=0?(t.isub(i),a.isub(o)):(i.isub(t),o.isub(a))}return 0===t.cmpn(1)?a:o},n.prototype.gcd=function(e){if(0===this.cmpn(0))return e.clone();if(0===e.cmpn(0))return this.clone();var t=this.clone(),r=e.clone();t.sign=!1,r.sign=!1;for(var i=0;t.isEven()&&r.isEven();i++)t.ishrn(1),r.ishrn(1);for(;;){for(;t.isEven();)t.ishrn(1);for(;r.isEven();)r.ishrn(1);var n=t.cmp(r);if(0>n){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.ishln(i)},n.prototype.invm=function(e){return this.egcd(e).a.mod(e)},n.prototype.isEven=function(){return 0===(1&this.words[0])},n.prototype.isOdd=function(){return 1===(1&this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,i=(e-t)/26,n=1<a;a++)this.words[a]=0;return this.words[i]|=n,this.length=i+1,this}for(var o=n,a=i;0!==o&&a>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.cmpn=function(e){var t=0>e;if(t&&(e=-e),this.sign&&!t)return-1;if(!this.sign&&t)return 1;e&=67108863,this.strip();var r;if(this.length>1)r=1;else{var i=this.words[0];r=i===e?0:e>i?-1:1}return this.sign&&(r=-r),r},n.prototype.cmp=function(e){if(this.sign&&!e.sign)return-1;if(!this.sign&&e.sign)return 1;var t=this.ucmp(e);return this.sign?-t:t},n.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length=0;r--){var i=this.words[r],n=e.words[r];if(i!==n){n>i?t=-1:i>n&&(t=1);break}}return t},n.red=function(e){return new h(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},s.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),t=r.bitLength();while(t>this.n);var i=t0?r.isub(this.p):r.strip(),r},s.prototype.split=function(e,t){e.ishrn(this.n,0,t)},s.prototype.imulK=function(e){return e.imul(this.k)},i(c,s),c.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;i>n;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];t.words[t.length++]=a&r;for(var n=10;n>>22,a=o}e.words[n-10]=a>>>22,e.length-=9},c.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,r=0,i=0;i>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function v(e){if(g[e])return g[e];var v;if("k256"===e)v=new c;else if("p224"===e)v=new f;else if("p192"===e)v=new u;else{if("p25519"!==e)throw new Error("Unknown prime "+e);v=new d}return g[e]=v,v},h.prototype._verify1=function(e){r(!e.sign,"red works only with positives"),r(e.red,"red works only with red numbers")},h.prototype._verify2=function(e,t){r(!e.sign&&!t.sign,"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},h.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.mod(this.m)._forceRed(this)},h.prototype.neg=function(e){var t=e.clone();return t.sign=!t.sign,t.iadd(this.m)._forceRed(this)},h.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},h.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},h.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},h.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},h.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.shln(t))},h.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},h.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},h.prototype.isqr=function(e){return this.imul(e,e)},h.prototype.sqr=function(e){return this.mul(e,e)},h.prototype.sqrt=function(e){if(0===e.cmpn(0))return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var i=this.m.add(new n(1)).ishrn(2),a=this.pow(e,i);return a}for(var o=this.m.subn(1),s=0;0!==o.cmpn(0)&&0===o.andln(1);)s++,o.ishrn(1);r(0!==o.cmpn(0));var c=new n(1).toRed(this),f=c.redNeg(),u=this.m.subn(1).ishrn(1),d=this.m.bitLength();for(d=new n(2*d*d).toRed(this);0!==this.pow(d,u).cmp(f);)d.redIAdd(f);for(var h=this.pow(d,o),a=this.pow(e,o.addn(1).ishrn(1)),l=this.pow(e,o),p=s;0!==l.cmp(c);){for(var b=l,m=0;0!==b.cmp(c);m++)b=b.redSqr();r(p>m);var g=this.pow(h,new n(1).ishln(p-m-1));a=a.redMul(g),h=g.redSqr(),l=l.redMul(h),p=m}return a},h.prototype.invm=function(e){var t=e._invmp(this.m);return t.sign?(t.sign=!1,this.imod(t).redNeg()):this.imod(t)},h.prototype.pow=function(e,t){var r=[];if(0===t.cmpn(0))return new n(1);for(var i=t.clone();0!==i.cmpn(0);)r.push(i.andln(1)),i.ishrn(1);for(var a=e,o=0;o=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},l.prototype.mul=function(e,t){if(0===e.cmpn(0)||0===t.cmpn(0))return new n(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(i).ishrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},l.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}}("undefined"==typeof t||t,this)},{}],49:[function(e,t,r){(function(r){function i(e){var t=a(e),r=t.toRed(o.mont(e.modulus)).redPow(new o(e.publicExponent)).fromRed();return{blinder:r,unblinder:t.invm(e.modulus)}}function n(e,t){var n=i(t),a=t.modulus.byteLength(),s=(o.mont(t.modulus),new o(e).mul(n.blinder).mod(t.modulus)),c=s.toRed(o.mont(t.prime1)),f=s.toRed(o.mont(t.prime2)),u=t.coefficient,d=t.prime1,h=t.prime2,l=c.redPow(t.exponent1),p=f.redPow(t.exponent2);l=l.fromRed(),p=p.fromRed();var b=l.isub(p).imul(u).mod(d);b.imul(h),p.iadd(b);var m=new r(p.imul(n.unblinder).mod(t.modulus).toArray());if(m.length=0||!r.mod(e.prime1)||!r.mod(e.prime2);)r=new o(s(t));return r}var o=e("bn.js"),s=e("randombytes");t.exports=n,n.getr=a}).call(this,e("buffer").Buffer)},{"bn.js":48,buffer:11,randombytes:200}],50:[function(e,t,r){"use strict";var i=r;i.version=e("../package.json").version,i.utils=e("./elliptic/utils"),i.rand=e("brorand"),i.hmacDRBG=e("./elliptic/hmac-drbg"),i.curve=e("./elliptic/curve"),i.curves=e("./elliptic/curves"),i.ec=e("./elliptic/ec")},{"../package.json":70,"./elliptic/curve":53,"./elliptic/curves":56,"./elliptic/ec":57,"./elliptic/hmac-drbg":60,"./elliptic/utils":62,brorand:63}],51:[function(e,t,r){"use strict";function i(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4)}function n(e,t){this.curve=e,this.type=t,this.precomputed=null}var a=e("bn.js"),o=e("../../elliptic"),s=o.utils.getNAF,c=o.utils.getJSF,f=o.utils.assert;t.exports=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(e,t){f(e.precomputed);var r=e._getDoubles(),i=s(t,1),n=(1<=o;t--)c=(c<<1)+i[t];a.push(c)}for(var u=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=n;h>0;h--){for(var o=0;o=0;c--){for(var t=0;c>=0&&0===a[c];c--)t++;if(c>=0&&t++,o=o.dblp(t),0>c)break;var u=a[c];f(0!==u),o="affine"===e.type?u>0?o.mixedAdd(n[u-1>>1]):o.mixedAdd(n[-u-1>>1].neg()):u>0?o.add(n[u-1>>1]):o.add(n[-u-1>>1].neg())}return"affine"===e.type?o.toP():o},i.prototype._wnafMulAdd=function(e,t,r,i){for(var n=this._wnafT1,a=this._wnafT2,o=this._wnafT3,f=0,u=0;i>u;u++){var d=t[u],h=d._getNAFPoints(e);n[u]=h.wnd,a[u]=h.points}for(var u=i-1;u>=1;u-=2){var l=u-1,p=u;if(1===n[l]&&1===n[p]){var b=[t[l],null,null,t[p]];0===t[l].y.cmp(t[p].y)?(b[1]=t[l].add(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg())):0===t[l].y.cmp(t[p].y.redNeg())?(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].add(t[p].neg())):(b[1]=t[l].toJ().mixedAdd(t[p]),b[2]=t[l].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=c(r[l],r[p]);f=Math.max(g[0].length,f),o[l]=new Array(f),o[p]=new Array(f);for(var v=0;f>v;v++){var y=0|g[0][v],w=0|g[1][v];o[l][v]=m[3*(y+1)+(w+1)],o[p][v]=0,a[l]=b}}else o[l]=s(r[l],n[l]),o[p]=s(r[p],n[p]),f=Math.max(o[l].length,f),f=Math.max(o[p].length,f)}for(var _=this.jpoint(null,null,null),S=this._wnafT4,u=f;u>=0;u--){for(var k=0;u>=0;){for(var E=!0,v=0;i>v;v++)S[v]=0|o[v][u],0!==S[v]&&(E=!1);if(!E)break;k++,u--}if(u>=0&&k++,_=_.dblp(k),0>u)break;for(var v=0;i>v;v++){var d,x=S[v];0!==x&&(x>0?d=a[v][x-1>>1]:0>x&&(d=a[v][-x-1>>1].neg()),_="affine"===d.type?_.mixedAdd(d):_.add(d))}}for(var u=0;i>u;u++)a[u]=null;return _.toP()},i.BasePoint=n,n.prototype.validate=function(){return this.curve.validate(this)},n.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},n.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},n.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;t>n;n+=e){for(var a=0;e>a;a++)i=i.dbl();r.push(i)}return{step:e,points:r}},n.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<n;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},n.prototype._getBeta=function(){return null},n.prototype.dblp=function(e){for(var t=this,r=0;e>r;r++)t=t.dbl();return t}},{"../../elliptic":50,"bn.js":48}],52:[function(e,t,r){"use strict";function i(e){this.twisted=1!==(0|e.a),this.mOneA=this.twisted&&-1===(0|e.a),this.extended=this.mOneA,f.call(this,"edwards",e),this.a=new s(e.a,16).mod(this.red.m).toRed(this.red),this.c=new s(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new s(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|e.c)}function n(e,t,r,i,n){f.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new s(t,16),this.y=new s(r,16),this.z=i?new s(i,16):this.curve.one,this.t=n&&new s(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}var a=e("../curve"),o=e("../../elliptic"),s=e("bn.js"),c=e("inherits"),f=a.base,u=o.utils.assert;c(i,f),t.exports=i,i.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},i.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},i.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},i.prototype.pointFromX=function(e,t){t=new s(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()).redSqrt(),c=o.fromRed().isOdd();return(e&&!c||!e&&c)&&(o=o.redNeg()),this.point(t,o,a.one)},i.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},c(n,f.BasePoint),i.prototype.pointFromJSON=function(e){return n.fromJSON(this,e)},i.prototype.point=function(e,t,r,i){return new n(this,e,t,r,i)},n.fromJSON=function(e,t){return new n(e,t[0],t[1],t[2])},n.prototype.inspect=function(){return this.isInfinity()?"":""},n.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},n.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),o=a.redSub(r),s=i.redSub(t),c=n.redMul(o),f=a.redMul(s),u=n.redMul(s),d=o.redMul(a);return this.curve.point(c,f,d,u)},n.prototype._projDbl=function(){var e,t,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(n),s=o.redAdd(a);if(this.zOne)e=i.redSub(n).redSub(a).redMul(s.redSub(this.curve.two)),t=s.redMul(o.redSub(a)),r=s.redSqr().redSub(s).redSub(s);else{var c=this.z.redSqr(),f=s.redSub(c).redISub(c);e=i.redSub(n).redISub(a).redMul(f),t=s.redMul(o.redSub(a)),r=s.redMul(f)}}else{var o=n.redAdd(a),c=this.curve._mulC(this.c.redMul(this.z)).redSqr(),f=o.redSub(c).redSub(c);e=this.curve._mulC(i.redISub(o)).redMul(f),t=this.curve._mulC(o).redMul(n.redISub(a)),r=o.redMul(f)}return this.curve.point(e,t,r)},n.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},n.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=n.redSub(i),s=n.redAdd(i),c=r.redAdd(t),f=a.redMul(o),u=s.redMul(c),d=a.redMul(c),h=o.redMul(s);return this.curve.point(f,u,h,d)},n.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),c=n.redSub(s),f=n.redAdd(s),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),d=i.redMul(c).redMul(u);return this.curve.twisted?(t=i.redMul(f).redMul(o.redSub(this.curve._mulA(a))),r=c.redMul(f)):(t=i.redMul(f).redMul(o.redSub(a)),r=this.curve._mulC(c).redMul(f)),this.curve.point(d,t,r)},n.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},n.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2)},n.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},n.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()},n.prototype.getY=function(){return this.normalize(),this.y.fromRed()},n.prototype.toP=n.prototype.normalize,n.prototype.mixedAdd=n.prototype.add},{"../../elliptic":50,"../curve":53,"bn.js":48,inherits:202}],53:[function(e,t,r){"use strict";var i=r;i.base=e("./base"),i["short"]=e("./short"),i.mont=e("./mont"),i.edwards=e("./edwards")},{"./base":51,"./edwards":52,"./mont":54,"./short":55}],54:[function(e,t,r){"use strict";function i(e){c.call(this,"mont",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function n(e,t,r){c.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(t,16),this.z=new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var a=e("../curve"),o=e("bn.js"),s=e("inherits"),c=a.base;s(i,c),t.exports=i,i.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t),n=i.redSqrt();return 0===n.redSqr().cmp(i)},s(n,c.BasePoint),i.prototype.point=function(e,t){return new n(this,e,t)},i.prototype.pointFromJSON=function(e){return n.fromJSON(this,e)},n.prototype.precompute=function(){},n.fromJSON=function(e,t){return new n(e,t[0],t[1]||e.one)},n.prototype.inspect=function(){return this.isInfinity()?"":""},n.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},n.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),r=this.x.redSub(this.z),i=r.redSqr(),n=t.redSub(i),a=t.redMul(i),o=n.redMul(i.redAdd(this.curve.a24.redMul(n)));return this.curve.point(a,o)},n.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),a=e.x.redSub(e.z),o=a.redMul(r),s=n.redMul(i),c=t.z.redMul(o.redAdd(s).redSqr()),f=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(c,f)},n.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=this,a=[];0!==t.cmpn(0);t.ishrn(1))a.push(t.andln(1));for(var o=a.length-1;o>=0;o--)0===a[o]?(r=r.diffAdd(i,n),i=i.dbl()):(i=r.diffAdd(i,n),r=r.dbl());return i},n.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":53,"bn.js":48,inherits:202}],55:[function(e,t,r){"use strict";function i(e){u.call(this,"short",e),this.a=new c(e.a,16).toRed(this.red),this.b=new c(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function n(e,t,r,i){u.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new c(t,16),this.y=new c(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function a(e,t,r,i){u.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new c(0)):(this.x=new c(t,16),this.y=new c(r,16),this.z=new c(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var o=e("../curve"),s=e("../../elliptic"),c=e("bn.js"),f=e("inherits"),u=o.base,d=s.utils.assert;
+f(i,u),t.exports=i,i.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new c(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)r=new c(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?r=n[0]:(r=n[1],d(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}var a;return a=e.basis?e.basis.map(function(e){return{a:new c(e.a,16),b:new c(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:a}}},i.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:c.mont(e),r=new c(2).toRed(t).redInvm(),i=r.redNeg(),n=new c(3).toRed(t).redNeg().redSqrt().redMul(r),a=i.redAdd(n).fromRed(),o=i.redSub(n).fromRed();return[a,o]},i.prototype._getEndoBasis=function(e){for(var t,r,i,n,a,o,s,f,u,d=this.n.shrn(Math.floor(this.n.bitLength()/2)),h=e,l=this.n.clone(),p=new c(1),b=new c(0),m=new c(0),g=new c(1),v=0;0!==h.cmpn(0);){var y=l.div(h);f=l.sub(y.mul(h)),u=m.sub(y.mul(p));var w=g.sub(y.mul(b));if(!i&&f.cmp(d)<0)t=s.neg(),r=p,i=f.neg(),n=u;else if(i&&2===++v)break;s=f,l=h,h=f,m=p,p=u,g=b,b=w}a=f.neg(),o=u;var _=i.sqr().add(n.sqr()),S=a.sqr().add(o.sqr());return S.cmp(_)>=0&&(a=t,o=r),i.sign&&(i=i.neg(),n=n.neg()),a.sign&&(a=a.neg(),o=o.neg()),[{a:i,b:n},{a:a,b:o}]},i.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),c=n.mul(r.b),f=a.mul(i.b),u=e.sub(o).sub(s),d=c.add(f).neg();return{k1:u,k2:d}},i.prototype.pointFromX=function(e,t){t=new c(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt(),n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},i.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},i.prototype._endoWnafMulAdd=function(e,t){for(var r=this._endoWnafT1,i=this._endoWnafT2,n=0;nf;f++)r[f]=null,i[f]=null;return c},f(n,u.BasePoint),i.prototype.point=function(e,t,r){return new n(this,e,t,r)},i.prototype.pointFromJSON=function(e,t){return n.fromJSON(this,e,t)},n.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},n.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},n.fromJSON=function(e,t,r){function i(t){return e.point(t[0],t[1],r)}"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(i))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(i))}},n},n.prototype.inspect=function(){return this.isInfinity()?"":""},n.prototype.isInfinity=function(){return this.inf},n.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},n.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},n.prototype.getX=function(){return this.x.fromRed()},n.prototype.getY=function(){return this.y.fromRed()},n.prototype.mul=function(e){return e=new c(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},n.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},n.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},n.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},f(a,u.BasePoint),i.prototype.jpoint=function(e,t,r){return new a(this,e,t,r)},a.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},a.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},a.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),c=a.redSub(o);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),u=f.redMul(s),d=i.redMul(f),h=c.redSqr().redIAdd(u).redISub(d).redISub(d),l=c.redMul(d.redISub(h)).redISub(a.redMul(u)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,l,p)},a.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),f=c.redMul(o),u=r.redMul(c),d=s.redSqr().redIAdd(f).redISub(u).redISub(u),h=s.redMul(u.redISub(d)).redISub(n.redMul(f)),l=this.z.redMul(o);return this.curve.jpoint(d,h,l)},a.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;e>r;r++)t=t.dbl();return t}for(var i=this.curve.a,n=this.curve.tinv,a=this.x,o=this.y,s=this.z,c=s.redSqr().redSqr(),f=o.redAdd(o),r=0;e>r;r++){var u=a.redSqr(),d=f.redSqr(),h=d.redSqr(),l=u.redAdd(u).redIAdd(u).redIAdd(i.redMul(c)),p=a.redMul(d),b=l.redSqr().redISub(p.redAdd(p)),m=p.redISub(b),g=l.redMul(m);g=g.redIAdd(g).redISub(h);var v=f.redMul(s);e>r+1&&(c=c.redMul(h)),a=b,s=v,f=g}return this.curve.jpoint(a,f.redMul(n),s)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},a.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i),c=s.redSqr().redISub(o).redISub(o),f=a.redIAdd(a);f=f.redIAdd(f),f=f.redIAdd(f),e=c,t=s.redMul(o.redISub(c)).redISub(f),r=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),l=this.x.redAdd(d).redSqr().redISub(u).redISub(h);l=l.redIAdd(l);var p=u.redAdd(u).redIAdd(u),b=p.redSqr(),m=h.redIAdd(h);m=m.redIAdd(m),m=m.redIAdd(m),e=b.redISub(l).redISub(l),t=p.redMul(l.redISub(e)).redISub(m),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(e,t,r)},a.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=s.redSqr().redISub(o).redISub(o);e=c;var f=a.redIAdd(a);f=f.redIAdd(f),f=f.redIAdd(f),t=s.redMul(o.redISub(c)).redISub(f),r=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),l=this.x.redSub(u).redMul(this.x.redAdd(u));l=l.redAdd(l).redIAdd(l);var p=h.redIAdd(h);p=p.redIAdd(p);var b=p.redAdd(p);e=l.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var m=d.redSqr();m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m),t=l.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},a.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),a=t.redSqr(),o=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)),c=t.redAdd(t);c=c.redIAdd(c);var f=c.redMul(o),u=s.redSqr().redISub(f.redAdd(f)),d=f.redISub(u),h=o.redSqr();h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var l=s.redMul(d).redISub(h),p=r.redAdd(r).redMul(i);return this.curve.jpoint(u,l,p)},a.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),a=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(a);var s=o.redSqr(),c=i.redIAdd(i);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var f=n.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(c),u=t.redMul(f);u=u.redIAdd(u),u=u.redIAdd(u);var d=this.x.redMul(s).redISub(u);d=d.redIAdd(d),d=d.redIAdd(d);var h=this.y.redMul(f.redMul(c.redISub(f)).redISub(o.redMul(s)));h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var l=this.z.redAdd(o).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,h,l)},a.prototype.mul=function(e,t){return e=new c(e,t),this.curve._wnafMul(this,e)},a.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},a.prototype.inspect=function(){return this.isInfinity()?"":""},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":50,"../curve":53,"bn.js":48,inherits:202}],56:[function(e,t,r){"use strict";function i(e){"short"===e.type?this.curve=new s.curve["short"](e):"edwards"===e.type?this.curve=new s.curve.edwards(e):this.curve=new s.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function n(e,t){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(a,e,{configurable:!0,enumerable:!0,value:r}),r}})}var a=r,o=e("hash.js"),s=e("../elliptic"),c=s.utils.assert;a.PresetCurve=i,n("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),n("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),n("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),n("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),n("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=e("./precomputed/secp256k1")}catch(u){f=void 0}n("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})},{"../elliptic":50,"./precomputed/secp256k1":61,"hash.js":64}],57:[function(e,t,r){"use strict";function i(e){return this instanceof i?("string"==typeof e&&(s(a.curves.hasOwnProperty(e),"Unknown curve "+e),e=a.curves[e]),e instanceof a.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),void(this.hash=e.hash||e.curve.hash)):new i(e)}var n=e("bn.js"),a=e("../../elliptic"),o=a.utils,s=o.assert,c=e("./key"),f=e("./signature");t.exports=i,i.prototype.keyPair=function(e){return new c(this,e)},i.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new a.hmacDRBG({hash:this.hash,pers:e.pers,entropy:e.entropy||a.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new n(2));;){var o=new n(t.generate(r));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},i.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.shrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},i.prototype.sign=function(e,t,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var o=this.n.byteLength(),s=t.getPrivate().toArray(),c=s.length;21>c;c++)s.unshift(0);for(var u=e.toArray(),c=u.length;o>c;c++)u.unshift(0);for(var d=new a.hmacDRBG({hash:this.hash,entropy:s,nonce:u}),h=this.n.sub(new n(1));;){var l=new n(d.generate(this.n.byteLength()));if(l=this._truncateToN(l,!0),!(l.cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.mod(this.n);if(0!==m.cmpn(0)){var g=l.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e)).mod(this.n);if(0!==g.cmpn(0)){i.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g));var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return new f({r:m,s:g,recoveryParam:v})}}}}}},i.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i),t=new f(t,"hex");var a=t.r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s=o.invm(this.n),c=s.mul(e).mod(this.n),u=s.mul(a).mod(this.n),d=this.g.mulAdd(c,r.getPublic(),u);return d.isInfinity()?!1:0===d.getX().mod(this.n).cmp(a)},i.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,"The recovery param is more than two bits"),t=new f(t,i);var a=this.n,o=new n(e),c=t.r,u=t.s,d=1&r,h=r>>1;if(c.cmp(this.curve.p.mod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");c=this.curve.pointFromX(d,c);var l=o.neg().mod(a),p=t.r.invm(a);return c.mul(u).add(this.g.mul(l)).mul(p)},i.prototype.getKeyRecoveryParam=function(e,t,r,i){if(t=new f(t,i),null!==t.recoveryParam)return t.recoveryParam;for(var n=0;4>n;n++){var a=this.recoverPubKey(e,t,n);if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":50,"./key":58,"./signature":59,"bn.js":48}],58:[function(e,t,r){"use strict";function i(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var n=e("bn.js"),a=e("../../elliptic"),o=a.utils;t.exports=i,i.fromPublic=function(e,t,r){return t instanceof i?t:new i(e,{pub:t,pubEnc:r})},i.fromPrivate=function(e,t,r){return t instanceof i?t:new i(e,{priv:t,privEnc:r})},i.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},i.prototype.getPublic=function(e,t){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof e&&(t=e,e=null),!t)return this.pub;for(var r=this.ec.curve.p.byteLength(),i=this.pub.getX().toArray(),n=i.length;r>n;n++)i.unshift(0);var a;if("mont"!==this.ec.curve.type)if(e)a=[this.pub.getY().isEven()?2:3].concat(i);else{for(var s=this.pub.getY().toArray(),n=s.length;r>n;n++)s.unshift(0);var a=[4].concat(i,s)}else a=i;return o.encode(a,t)},i.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},i.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.mod(this.ec.curve.n)},i.prototype._importPublic=function(e,t){return e.x||e.y?void(this.pub=this.ec.curve.point(e.x,e.y)):(e=o.toArray(e,t),"mont"!==this.ec.curve.type?this._importPublicShort(e):this._importPublicMont(e))},i.prototype._importPublicShort=function(e){var t=this.ec.curve.p.byteLength();4===e[0]&&e.length-1===2*t?this.pub=this.ec.curve.point(e.slice(1,1+t),e.slice(1+t,1+2*t)):2!==e[0]&&3!==e[0]||e.length-1!==t||(this.pub=this.ec.curve.pointFromX(3===e[0],e.slice(1,1+t)))},i.prototype._importPublicMont=function(e){this.pub=this.ec.curve.point(e,1)},i.prototype.derive=function(e){return e.mul(this.priv).getX()},i.prototype.sign=function(e){return this.ec.sign(e,this)},i.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},i.prototype.inspect=function(){return""}},{"../../elliptic":50,"bn.js":48}],59:[function(e,t,r){"use strict";function i(e,t){return e instanceof i?e:void(this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),null!==e.recoveryParam?this.recoveryParam=e.recoveryParam:this.recoveryParam=null))}var n=e("bn.js"),a=e("../../elliptic"),o=a.utils,s=o.assert;t.exports=i,i.prototype._importDER=function(e,t){if(e=o.toArray(e,t),e.length<6||48!==e[0]||2!==e[2])return!1;var r=e[1];if(1+r>e.length)return!1;var i=e[3];if(i>=128)return!1;if(4+i+2>=e.length)return!1;if(2!==e[4+i])return!1;var a=e[5+i];return a>=128?!1:4+i+2+a>e.length?!1:(this.r=new n(e.slice(4,4+i)),this.s=new n(e.slice(4+i+2,4+i+2+a)),this.recoveryParam=null,!0)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r));var i=t.length+r.length+4,n=[48,i,2,t.length];return n=n.concat(t,[2,r.length],r),o.encode(n,e)}},{"../../elliptic":50,"bn.js":48}],60:[function(e,t,r){"use strict";function i(e){if(!(this instanceof i))return new i(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc),r=o.toArray(e.nonce,e.nonceEnc),n=o.toArray(e.pers,e.persEnc);s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var n=e("hash.js"),a=e("../elliptic"),o=a.utils,s=o.assert;t.exports=i,i.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this.reseed=1},i.prototype.generate=function(e,t,r,i){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=o.toArray(r,i),this._update(r));for(var n=[];n.length>8,o=255&n;a?r.push(a,o):r.push(o)}return r}function n(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r=0;){var a;if(n.isOdd()){var o=n.andln(i-1);a=o>(i>>1)-1?(i>>1)-o:o,n.isubn(a)}else a=0;r.push(a);for(var s=0!==n.cmpn(0)&&0===n.andln(i-1)?t+1:1,c=1;s>c;c++)r.push(0);n.ishrn(s)}return r}function s(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i=0,n=0;e.cmpn(-i)>0||t.cmpn(-n)>0;){var a=e.andln(3)+i&3,o=t.andln(3)+n&3;3===a&&(a=-1),3===o&&(o=-1);var s;if(0===(1&a))s=0;else{var c=e.andln(7)+i&7;s=3!==c&&5!==c||2!==o?a:-a}r[0].push(s);var f;if(0===(1&o))f=0;else{var c=t.andln(7)+n&7;f=3!==c&&5!==c||2!==a?o:-o}r[1].push(f),2*i===s+1&&(i=1-i),2*n===f+1&&(n=1-n),e.ishrn(1),t.ishrn(1)}return r}var c=r;c.assert=function(e,t){if(!e)throw new Error(t||"Assertion failed")},c.toArray=i,c.zero2=n,c.toHex=a,c.encode=function(e,t){return"hex"===t?a(e):e},c.getNAF=o,c.getJSF=s},{}],63:[function(e,t,r){function i(e){this.rand=e}var n;if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return window.crypto.getRandomValues(t),t}:window.msCrypto&&window.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return window.msCrypto.getRandomValues(t),t}:i.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var a=e("crypto");i.prototype._rand=function(e){return a.randomBytes(e)}}catch(o){i.prototype._rand=function(e){for(var t=new Uint8Array(e),r=0;r=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var i=0;in;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var a=8;a>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else{i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0;for(var a=8;athis.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t=e?t^r^i:31>=e?t&r|~t&i:47>=e?(t|~r)^i:63>=e?t&i|r&~i:t^(r|~i)}function a(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function o(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var s=e("../hash"),c=s.utils,f=c.rotl32,u=c.sum32,d=c.sum32_3,h=c.sum32_4,l=s.common.BlockHash;c.inherits(i,l),r.ripemd160=i,i.blockSize=512,i.outSize=160,i.hmacStrength=192,i.padLength=64,i.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],s=this.h[2],c=this.h[3],l=this.h[4],v=r,y=i,w=s,_=c,S=l,k=0;80>k;k++){var E=u(f(h(r,n(k,i,s,c),e[p[k]+t],a(k)),m[k]),l);r=l,l=c,c=f(s,10),s=i,i=E,E=u(f(h(v,n(79-k,y,w,_),e[b[k]+t],o(k)),g[k]),S),v=S,S=_,_=f(w,10),w=y,y=E}E=d(this.h[1],s,_),this.h[1]=d(this.h[2],c,S),this.h[2]=d(this.h[3],l,v),this.h[3]=d(this.h[4],r,y),this.h[4]=d(this.h[0],i,w),this.h[0]=E},i.prototype._digest=function(e){return"hex"===e?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"../hash":64}],68:[function(e,t,r){function i(){return this instanceof i?(V.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=X,void(this.W=new Array(64))):new i}function n(){return this instanceof n?(i.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new n}function a(){return this instanceof a?(V.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=J,void(this.W=new Array(160))):new a}function o(){return this instanceof o?(a.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new o}function s(){return this instanceof s?(V.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=new Array(80))):new s}function c(e,t,r){return e&t^~e&r}function f(e,t,r){return e&t^e&r^t&r}function u(e,t,r){return e^t^r}function d(e){return R(e,2)^R(e,13)^R(e,22)}function h(e){return R(e,6)^R(e,11)^R(e,25)}function l(e){return R(e,7)^R(e,18)^e>>>3}function p(e){return R(e,17)^R(e,19)^e>>>10}function b(e,t,r,i){return 0===e?c(t,r,i):1===e||3===e?u(t,r,i):2===e?f(t,r,i):void 0}function m(e,t,r,i,n,a){var o=e&r^~e&n;return 0>o&&(o+=4294967296),o}function g(e,t,r,i,n,a){var o=t&i^~t&a;return 0>o&&(o+=4294967296),o}function v(e,t,r,i,n,a){var o=e&r^e&n^r&n;return 0>o&&(o+=4294967296),o}function y(e,t,r,i,n,a){var o=t&i^t&a^i&a;return 0>o&&(o+=4294967296),o}function w(e,t){var r=L(e,t,28),i=L(t,e,2),n=L(t,e,7),a=r^i^n;return 0>a&&(a+=4294967296),a}function _(e,t){var r=D(e,t,28),i=D(t,e,2),n=D(t,e,7),a=r^i^n;return 0>a&&(a+=4294967296),a}function S(e,t){var r=L(e,t,14),i=L(e,t,18),n=L(t,e,9),a=r^i^n;return 0>a&&(a+=4294967296),a}function k(e,t){var r=D(e,t,14),i=D(e,t,18),n=D(t,e,9),a=r^i^n;return 0>a&&(a+=4294967296),a}function E(e,t){var r=L(e,t,1),i=L(e,t,8),n=T(e,t,7),a=r^i^n;return 0>a&&(a+=4294967296),a}function x(e,t){var r=D(e,t,1),i=D(e,t,8),n=U(e,t,7),a=r^i^n;return 0>a&&(a+=4294967296),a}function A(e,t){var r=L(e,t,19),i=L(t,e,29),n=T(e,t,6),a=r^i^n;return 0>a&&(a+=4294967296),a}function j(e,t){var r=D(e,t,19),i=D(t,e,29),n=U(e,t,6),a=r^i^n;return 0>a&&(a+=4294967296),a}var B=e("../hash"),I=B.utils,z=I.assert,R=I.rotr32,M=I.rotl32,q=I.sum32,C=I.sum32_4,P=I.sum32_5,L=I.rotr64_hi,D=I.rotr64_lo,T=I.shr64_hi,U=I.shr64_lo,O=I.sum64,N=I.sum64_hi,K=I.sum64_lo,F=I.sum64_4_hi,H=I.sum64_4_lo,Y=I.sum64_5_hi,W=I.sum64_5_lo,V=B.common.BlockHash,X=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],J=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],G=[1518500249,1859775393,2400959708,3395469782];I.inherits(i,V),r.sha256=i,i.blockSize=512,i.outSize=256,i.hmacStrength=192,i.padLength=64,i.prototype._update=function(e,t){for(var r=this.W,i=0;16>i;i++)r[i]=e[t+i];for(;ii;i++)r[i]=e[t+i];for(;ii;i++)r[i]=e[t+i];for(;i>8,o=255&n;a?r.push(a,o):r.push(o)}else for(var i=0;i>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function o(e,t){for(var r="",i=0;i>>0}return a}function u(e,t){for(var r=new Array(4*e.length),i=0,n=0;i>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r}function d(e,t){return e>>>t|e<<32-t}function h(e,t){return e<>>32-t}function l(e,t){return e+t>>>0}function p(e,t,r){return e+t+r>>>0}function b(e,t,r,i){return e+t+r+i>>>0}function m(e,t,r,i,n){return e+t+r+i+n>>>0}function g(e,t){if(!e)throw new Error(t||"Assertion failed")}function v(e,t,r,i){var n=e[t],a=e[t+1],o=i+a>>>0,s=(i>o?1:0)+r+n;e[t]=s>>>0,e[t+1]=o}function y(e,t,r,i){var n=t+i>>>0,a=(t>n?1:0)+e+r;return a>>>0}function w(e,t,r,i){var n=t+i;return n>>>0}function _(e,t,r,i,n,a,o,s){var c=0,f=t;f=f+i>>>0,c+=t>f?1:0,f=f+a>>>0,c+=a>f?1:0,f=f+s>>>0,c+=s>f?1:0;var u=e+r+n+o+c;return u>>>0}function S(e,t,r,i,n,a,o,s){var c=t+i+a+s;return c>>>0}function k(e,t,r,i,n,a,o,s,c,f){var u=0,d=t;d=d+i>>>0,u+=t>d?1:0,d=d+a>>>0,u+=a>d?1:0,d=d+s>>>0,u+=s>d?1:0,d=d+f>>>0,u+=f>d?1:0;var h=e+r+n+o+c+u;return h>>>0}function E(e,t,r,i,n,a,o,s,c,f){var u=t+i+a+s+f;return u>>>0}function x(e,t,r){var i=t<<32-r|e>>>r;return i>>>0}function A(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}function j(e,t,r){return e>>>r}function B(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}var I=r,z=e("inherits");I.toArray=i,I.toHex=n,I.htonl=a,I.toHex32=o,I.zero2=s,I.zero8=c,I.join32=f,I.split32=u,I.rotr32=d,I.rotl32=h,I.sum32=l,I.sum32_3=p,I.sum32_4=b,I.sum32_5=m,I.assert=g,I.inherits=z,r.sum64=v,r.sum64_hi=y,r.sum64_lo=w,r.sum64_4_hi=_,r.sum64_4_lo=S,r.sum64_5_hi=k,r.sum64_5_lo=E,r.rotr64_hi=x,r.rotr64_lo=A,r.shr64_hi=j,r.shr64_lo=B},{inherits:202}],70:[function(e,t,r){t.exports={name:"elliptic",version:"3.1.0",description:"EC cryptography",main:"lib/elliptic.js",scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},keywords:["EC","Elliptic","curve","Cryptography"],author:{name:"Fedor Indutny",email:"fedor@indutny.com"},license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},dependencies:{"bn.js":"^2.0.3",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},gitHead:"d86cd2a8178f7e7cecbd6dd92eea084e2ab44c13",_id:"elliptic@3.1.0",_shasum:"c21682ef762769b56a74201609105da11d5f60cc",_from:"elliptic@>=3.0.0 <4.0.0",_npmVersion:"2.11.0",_nodeVersion:"2.2.1",_npmUser:{name:"indutny",email:"fedor@indutny.com"},maintainers:[{name:"indutny",email:"fedor@indutny.com"}],dist:{shasum:"c21682ef762769b56a74201609105da11d5f60cc",tarball:"http://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz"},directories:{},_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz"}},{}],71:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],72:[function(e,t,r){var i=e("asn1.js"),n=i.define("RSAPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("modulus")["int"](),this.key("publicExponent")["int"](),this.key("privateExponent")["int"](),this.key("prime1")["int"](),this.key("prime2")["int"](),this.key("exponent1")["int"](),this.key("exponent2")["int"](),this.key("coefficient")["int"]())});r.RSAPrivateKey=n;var a=i.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus")["int"](),this.key("publicExponent")["int"]())});r.RSAPublicKey=a;var o=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});r.PublicKey=o;var s=i.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p")["int"](),this.key("q")["int"](),this.key("g")["int"]()).optional())}),c=i.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version")["int"](),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});r.PrivateKey=c;var f=i.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters")["int"]())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=f;var u=i.define("DSAPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("p")["int"](),this.key("q")["int"](),this.key("g")["int"](),this.key("pub_key")["int"](),this.key("priv_key")["int"]())});r.DSAPrivateKey=u,r.DSAparam=i.define("DSAparam",function(){this["int"]()});var d=i.define("ECPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=d;var h=i.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=i.define("signature",function(){this.seq().obj(this.key("r")["int"](),this.key("s")["int"]())})},{"asn1.js":75}],73:[function(e,t,r){(function(r){var i=/Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m,n=/^-----BEGIN (.*) KEY-----\r?\n/m,a=/^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m,o=e("evp_bytestokey"),s=e("browserify-aes");t.exports=function(e,t){var c,f=e.toString(),u=f.match(i);if(u){var d="aes"+u[1],h=new r(u[2],"hex"),l=new r(u[3].replace(/\r?\n/g,""),"base64"),p=o(t,h.slice(0,8),parseInt(u[1],10)).key,b=[],m=s.createDecipheriv(d,p,h);b.push(m.update(l)),b.push(m["final"]()),c=r.concat(b)}else{var g=f.match(a);c=new r(g[2].replace(/\r?\n/g,""),"base64")}var v=f.match(n)[1]+" KEY";return{tag:v,data:c}}}).call(this,e("buffer").Buffer)},{"browserify-aes":92,buffer:11,evp_bytestokey:107}],74:[function(e,t,r){(function(r){function i(e){var t;"object"!=typeof e||r.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new r(e));var i,o,c=s(e,t),f=c.tag,u=c.data;switch(f){case"PUBLIC KEY":switch(o=a.PublicKey.decode(u,"der"),i=o.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPublicKey.decode(o.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return o.subjectPrivateKey=o.subjectPublicKey,{type:"ec",data:o};case"1.2.840.10040.4.1":return o.algorithm.params.pub_key=a.DSAparam.decode(o.subjectPublicKey.data,"der"),{type:"dsa",data:o.algorithm.params};default:throw new Error("unknown key id "+i)}throw new Error("unknown key type "+f);case"ENCRYPTED PRIVATE KEY":u=a.EncryptedPrivateKey.decode(u,"der"),u=n(u,t);case"PRIVATE KEY":switch(o=a.PrivateKey.decode(u,"der"),i=o.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPrivateKey.decode(o.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:o.algorithm.curve,privateKey:a.ECPrivateKey.decode(o.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return o.algorithm.params.priv_key=a.DSAparam.decode(o.subjectPrivateKey,"der"),{type:"dsa",params:o.algorithm.params};default:throw new Error("unknown key id "+i)}throw new Error("unknown key type "+f);case"RSA PUBLIC KEY":return a.RSAPublicKey.decode(u,"der");case"RSA PRIVATE KEY":return a.RSAPrivateKey.decode(u,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:a.DSAPrivateKey.decode(u,"der")};case"EC PRIVATE KEY":return u=a.ECPrivateKey.decode(u,"der"),{curve:u.parameters.value,privateKey:u.privateKey};default:throw new Error("unknown key type "+f)}}function n(e,t){var i=e.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),a=o[e.algorithm.decrypt.cipher.algo.join(".")],s=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,d=parseInt(a.split("-")[1],10)/8,h=f.pbkdf2Sync(t,i,n,d),l=c.createDecipheriv(a,h,s),p=[];return p.push(l.update(u)),p.push(l["final"]()),r.concat(p)}var a=e("./asn1"),o=e("./aesid.json"),s=e("./fixProc"),c=e("browserify-aes"),f=e("pbkdf2");t.exports=i,i.signature=a.signature}).call(this,e("buffer").Buffer)},{"./aesid.json":71,"./asn1":72,"./fixProc":73,"browserify-aes":92,buffer:11,pbkdf2:154}],75:[function(e,t,r){var i=r;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":76,"./asn1/base":78,"./asn1/constants":82,"./asn1/decoders":84,"./asn1/encoders":87,"bn.js":48}],76:[function(e,t,r){function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var n=e("../asn1"),a=e("inherits"),o=r;o.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(i){r=function(e){this._initNamed(e)}}return a(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},i.prototype._getDecoder=function(e){return this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},i.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},i.prototype._getEncoder=function(e){return this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},i.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":75,inherits:202,vm:221}],77:[function(e,t,r){function i(e,t){return o.call(this,t),s.isBuffer(e)?(this.base=e,this.offset=0,void(this.length=e.length)):void this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof n||(e=new n(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(e>=0&&255>=e))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=s.byteLength(e);else{if(!s.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}var a=e("inherits"),o=e("../base").Reporter,s=e("buffer").Buffer;a(i,o),r.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:o.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,o.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new i(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new s(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):s.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":78,buffer:11,inherits:202}],78:[function(e,t,r){var i=r;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":77,"./node":79,"./reporter":80}],79:[function(e,t,r){function i(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r["default"]=null,r.explicit=null,r.implicit=null,r.parent||(r.children=[],this._wrap())}var n=e("../base").Reporter,a=e("../base").EncoderBuffer,o=e("minimalistic-assert"),s=["seq","seqof","set","setof","octstr","bitstr","objid","bool","gentime","utctime","null_","enum","int","ia5str","utf8str"],c=["key","obj","use","optional","explicit","implicit","def","choice","any"].concat(s),f=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];t.exports=i;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit"];i.prototype.clone=function(){var e=this._baseState,t={};u.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},i.prototype._wrap=function(){var e=this._baseState;c.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},i.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),o.equal(t.children.length,1,"Root node can have only one child")},i.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(o(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(o(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r}),t}))},f.forEach(function(e){i.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),s.forEach(function(e){i.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}}),i.prototype.use=function(e){var t=this._baseState;return o(null===t.use),t.use=e,this},i.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},i.prototype.def=function(e){var t=this._baseState;return o(null===t["default"]),t["default"]=e,t.optional=!0,this},i.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},i.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},i.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},i.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},i.prototype.any=function(){var e=this._baseState;return e.any=!0,this},i.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},i.prototype._decode=function(e){var t=this._baseState;if(null===t.parent)return e.wrapResult(t.children[0]._decode(e));var r,i=t["default"],n=!0;if(null!==t.key&&(r=e.enterKey(t.key)),t.optional){var a=null;if(null!==t.explicit?a=t.explicit:null!==t.implicit?a=t.implicit:null!==t.tag&&(a=t.tag),null!==a||t.any){if(n=this._peekTag(e,a,t.any),e.isError(n))return n}else{var o=e.save();try{null===t.choice?this._decodeGeneric(t.tag,e):this._decodeChoice(e),
+n=!0}catch(s){n=!1}e.restore(o)}}var c;if(t.obj&&n&&(c=e.enterObject()),n){if(null!==t.explicit){var f=this._decodeTag(e,t.explicit);if(e.isError(f))return f;e=f}if(null===t.use&&null===t.choice){if(t.any)var o=e.save();var u=this._decodeTag(e,null!==t.implicit?t.implicit:t.tag,t.any);if(e.isError(u))return u;t.any?i=e.raw(o):e=u}if(i=t.any?i:null===t.choice?this._decodeGeneric(t.tag,e):this._decodeChoice(e),e.isError(i))return i;if(!t.any&&null===t.choice&&null!==t.children){var d=t.children.some(function(t){t._decode(e)});if(d)return err}}return t.obj&&n&&(i=e.leaveObject(c)),null===t.key||null===i&&n!==!0||e.leaveKey(r,t.key,i),i},i.prototype._decodeGeneric=function(e,t){var r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0]):"octstr"===e||"bitstr"===e?this._decodeStr(t,e):"ia5str"===e||"utf8str"===e?this._decodeStr(t,e):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1]):"objid"===e?this._decodeObjid(t,null,null):"gentime"===e||"utctime"===e?this._decodeTime(t,e):"null_"===e?this._decodeNull(t):"bool"===e?this._decodeBool(t):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0]):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t):t.error("unknown tag: "+e)},i.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},i.prototype._decodeChoice=function(e){var t=this._baseState,r=null,i=!1;return Object.keys(t.choice).some(function(n){var a=e.save(),o=t.choice[n];try{var s=o._decode(e);if(e.isError(s))return!1;r={type:n,value:s},i=!0}catch(c){return e.restore(a),!1}return!0},this),i?r:e.error("Choice not matched")},i.prototype._createEncoderBuffer=function(e){return new a(e,this.reporter)},i.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i["default"]||i["default"]!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},i.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);var a=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i["default"])return;e=i["default"]}var o=null,s=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.children)o=i.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)},c))}else null!==i.use?a=this._getUse(i.use,r)._encode(e,t):(o=this._encodePrimitive(i.tag,e),s=!0);var a;if(!i.any&&null===i.choice){var f=null!==i.implicit?i.implicit:i.tag,u=null===i.implicit?"universal":"context";null===f?null===i.use&&t.error("Tag could be ommited only for .use()"):null===i.use&&(a=this._encodeComposite(f,s,u,o))}return null!==i.explicit&&(a=this._encodeComposite(i.explicit,!1,"context",a)),a},i.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},i.prototype._encodePrimitive=function(e,t){var r=this._baseState;if("octstr"===e||"bitstr"===e||"ia5str"===e)return this._encodeStr(t,e);if("utf8str"===e)return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);throw new Error("Unsupported tag: "+e)}},{"../base":78,"minimalistic-assert":89}],80:[function(e,t,r){function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function n(e,t){this.path=e,this.rethrow(t)}var a=e("inherits");r.Reporter=i,i.prototype.isError=function(e){return e instanceof n},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.leaveKey=function(e,t,r){var i=this._reporterState;i.path=i.path.slice(0,e-1),null!==i.obj&&(i.obj[t]=r)},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof n;if(t=i?e:new n(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},a(n,Error),n.prototype.rethrow=function(e){return this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace(this,n),this}},{inherits:202}],81:[function(e,t,r){var i=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=i._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=i._reverse(r.tag)},{"../constants":82}],82:[function(e,t,r){var i=r;i._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r=0|r);var i=e[r];t[i]=r}),t},i.der=e("./der")},{"./der":81}],83:[function(e,t,r){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){f.Node.call(this,"der",e)}function a(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=d.tagClass[r>>6],n=0===(32&r);if(31===(31&r)){var a=r;for(r=0;128===(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}else r&=31;var o=d.tag[r];return{cls:i,primitive:n,tag:r,tagStr:o}}function o(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0===(128&i))return i;var n=127&i;if(n>=4)return e.error("length octect is too long");i=0;for(var a=0;n>a;a++){i<<=8;var o=e.readUInt8(r);if(e.isError(o))return o;i|=o}return i}var s=e("inherits"),c=e("../../asn1"),f=c.base,u=c.bignum,d=c.constants.der;t.exports=i,i.prototype.decode=function(e,t){return e instanceof f.DecoderBuffer||(e=new f.DecoderBuffer(e,t)),this.tree._decode(e,t)},s(n,f.Node),n.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=a(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||r)},n.prototype._decodeTag=function(e,t,r){var i=a(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=o(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var s=e.save(),c=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(c)?c:(n=e.offset-s.offset,e.restore(s),e.skip(n,'Failed to match body of: "'+t+'"'))},n.prototype._skipUntilEnd=function(e,t){for(;;){var r=a(e,t);if(e.isError(r))return r;var i=o(e,r.primitive,t);if(e.isError(i))return i;var n;if(n=r.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(n))return n;if("end"===r.tagStr)break}},n.prototype._decodeList=function(e,t,r){for(var i=[];!e.isEmpty();){var n=this._peekTag(e,"end");if(e.isError(n))return n;var a=r.decode(e,"der");if(e.isError(a)&&n)break;i.push(a)}return i},n.prototype._decodeStr=function(e,t){if("octstr"===t)return e.raw();if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}return"ia5str"===t||"utf8str"===t?e.raw().toString():this.error("Decoding of string type: "+t+" unsupported")},n.prototype._decodeObjid=function(e,t,r){for(var i=[],n=0;!e.isEmpty();){var a=e.readUInt8();n<<=7,n|=127&a,0===(128&a)&&(i.push(n),n=0)}128&a&&i.push(n);var o=i[0]/40|0,s=i[0]%40;return r?result=i:result=[o,s].concat(i.slice(1)),t&&(result=t[result.join(" ")]),result},n.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),a=0|r.slice(6,8),o=0|r.slice(8,10),s=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return this.error("Decoding "+t+" time is not supported yet");var i=0|r.slice(0,2),n=0|r.slice(2,4),a=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),c=0|r.slice(10,12);i=70>i?2e3+i:1900+i}return Date.UTC(i,n-1,a,o,s,c,0)},n.prototype._decodeNull=function(e){return null},n.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},n.prototype._decodeInt=function(e,t){var r=e.raw(),i=new u(r);return t&&(i=t[i.toString(10)]||i),i},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":75,inherits:202}],84:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":83,"./pem":85}],85:[function(e,t,r){function i(e){o.call(this,e),this.enc="pem"}var n=e("inherits"),a=e("buffer").Buffer,o=(e("../../asn1"),e("./der"));n(i,o),t.exports=i,i.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),n=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,f=0;fe?"0"+e:e}function o(e,t,r,i){var n;if("seqof"===e?e="seq":"setof"===e&&(e="set"),d.tagByName.hasOwnProperty(e))n=d.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}return n>=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=d.tagClassByName[r||"universal"]<<6)}var s=e("inherits"),c=e("buffer").Buffer,f=e("../../asn1"),u=f.base,d=(f.bignum,f.constants.der);t.exports=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},s(n,u.Node),n.prototype._encodeComposite=function(e,t,r,i){var n=o(e,t,r,this.reporter);if(i.length<128){var a=new c(2);return a[0]=n,a[1]=i.length,this._createEncoderBuffer([a,i])}for(var s=1,f=i.length;f>=256;f>>=8)s++;var a=new c(2+s);a[0]=n,a[1]=128|s;for(var f=1+s,u=i.length;u>0;f--,u>>=8)a[f]=255&u;return this._createEncoderBuffer([a,i])},n.prototype._encodeStr=function(e,t){return"octstr"===t?this._createEncoderBuffer(e):"bitstr"===t?this._createEncoderBuffer([0|e.unused,e.data]):"ia5str"===t||"utf8str"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},n.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var n=0,i=0;i=128;a>>=7)n++}for(var o=new c(n),s=o.length-1,i=e.length-1;i>=0;i--){var a=e[i];for(o[s--]=127&a;(a>>=7)>0;)o[s--]=128|127&a}return this._createEncoderBuffer(o)},n.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[a(i.getFullYear()),a(i.getUTCMonth()+1),a(i.getUTCDate()),a(i.getUTCHours()),a(i.getUTCMinutes()),a(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[a(i.getFullYear()%100),a(i.getUTCMonth()+1),a(i.getUTCDate()),a(i.getUTCHours()),a(i.getUTCMinutes()),a(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},n.prototype._encodeNull=function(){return this._createEncoderBuffer("")},n.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!c.isBuffer(e)){var r=e.toArray();e.sign===!1&&128&r[0]&&r.unshift(0),e=new c(r)}if(c.isBuffer(e)){var i=e.length;0===e.length&&i++;var n=new c(i);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);for(var i=1,a=e;a>=256;a>>=8)i++;for(var n=new Array(i),a=n.length-1;a>=0;a--)n[a]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new c(n))},n.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},n.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n["default"])return!1;var a=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n["default"],t,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i0&&r.ishrn(i),r}function f(e,t){e=c(e,t),e=e.mod(t);var i=new r(e.toArray());if(i.lengthh&&(b=1),c=Math.min(e.length,d.length),e.length!==d.length&&(b=1),l=-1;++l=t)throw new Error("invalid sig")}var s=e("./curves"),c=e("elliptic"),f=e("parse-asn1"),u=e("bn.js"),d=c.ec;t.exports=i}).call(this,e("buffer").Buffer)},{"./curves":47,"bn.js":48,buffer:11,elliptic:50,"parse-asn1":74}],110:[function(e,t,r){(function(r){function i(e){this.curveType=s[e],this.curveType||(this.curveType={name:e}),this.curve=new a.ec(this.curveType.name),this.keys=void 0}function n(e,t,i){Array.isArray(e)||(e=e.toArray());var n=new r(e);if(i&&n.length>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,i=-271733879,n=-1732584194,u=271733878,d=0;d>16)+(t>>16)+(r>>16);return i<<16|65535&r}function u(e,t){return e<>>32-t}var d=e("./helpers");t.exports=function(e){return d.hash(e,i,16)}},{"./helpers":134}],136:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{buffer:11,dup:32,inherits:202,stream:219,string_decoder:220}],137:[function(e,t,r){(function(e){function r(e){for(var t=[],r=0,i=0;r>>5]|=e[r]<<24-i%32;return t}function i(e){for(var t=[],r=0;r<32*e.length;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t}function n(e,t,r){for(var i=0;16>i;i++){var n=r+i,d=t[n];t[n]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}var v,y,w,_,S,k,E,x,A,j;k=v=e[0],E=y=e[1],x=w=e[2],A=_=e[3],j=S=e[4];var B;for(i=0;80>i;i+=1)B=v+t[r+h[i]]|0,B+=16>i?a(y,w,_)+m[0]:32>i?o(y,w,_)+m[1]:48>i?s(y,w,_)+m[2]:64>i?c(y,w,_)+m[3]:f(y,w,_)+m[4],B=0|B,B=u(B,p[i]),B=B+S|0,v=S,S=_,_=u(w,10),w=y,y=B,B=k+t[r+l[i]]|0,B+=16>i?f(E,x,A)+g[0]:32>i?c(E,x,A)+g[1]:48>i?s(E,x,A)+g[2]:64>i?o(E,x,A)+g[3]:a(E,x,A)+g[4],B=0|B,B=u(B,b[i]),B=B+j|0,k=j,j=A,A=u(x,10),x=E,E=B;B=e[1]+w+A|0,e[1]=e[2]+_+j|0,e[2]=e[3]+S+k|0,e[3]=e[4]+v+E|0,e[4]=e[0]+y+x|0,e[0]=B}function a(e,t,r){return e^t^r}function o(e,t,r){return e&t|~e&r}function s(e,t,r){return(e|~t)^r}function c(e,t,r){return e&r|t&~r}function f(e,t,r){return e^(t|~r)}function u(e,t){return e<>>32-t}function d(t){var a=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof t&&(t=new e(t,"utf8"));var o=r(t),s=8*t.length,c=8*t.length;o[s>>>5]|=128<<24-s%32,o[(s+64>>>9<<4)+14]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8);for(var f=0;ff;f++){var u=a[f];a[f]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var d=i(a);return new e(d)}var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],l=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],m=[0,1518500249,1859775393,2400959708,2840853838],g=[1352829926,1548603684,1836072691,2053994217,0];t.exports=d}).call(this,e("buffer").Buffer)},{buffer:11}],138:[function(e,t,r){(function(e){function r(t,r){this._block=new e(t),this._finalSize=r,this._blockSize=t,this._len=0,this._s=0}r.prototype.update=function(t,r){
+"string"==typeof t&&(r=r||"utf8",t=new e(t,r));for(var i=this._len+=t.length,n=this._s||0,a=0,o=this._block;i>n;){for(var s=Math.min(t.length,a+this._blockSize-n%this._blockSize),c=s-a,f=0;c>f;f++)o[n%this._blockSize+f]=t[f+a];n+=c,a+=c,n%this._blockSize===0&&this._update(o)}return this._s=n,this},r.prototype.digest=function(e){var t=8*this._len;this._block[this._len%this._blockSize]=128,this._block.fill(0,this._len%this._blockSize+1),t%(8*this._blockSize)>=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(t,this._blockSize-4);var r=this._update(this._block)||this._hash();return e?r.toString(e):r},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r}).call(this,e("buffer").Buffer)},{buffer:11}],139:[function(e,t,r){var r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};r.sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":140,"./sha1":141,"./sha224":142,"./sha256":143,"./sha384":144,"./sha512":145}],140:[function(e,t,r){(function(r){function i(){this.init(),this._w=s,o.call(this,64,56)}function n(e,t){return e<>>32-t}var a=e("inherits"),o=e("./hash"),s=new Array(80);a(i,o),i.prototype.init=function(){return this._a=1732584193,this._b=-271733879,this._c=-1732584194,this._d=271733878,this._e=-1009589776,this},i.prototype._update=function(e){function t(){return a[d-3]^a[d-8]^a[d-14]^a[d-16]}function r(e,t){a[d]=e;var r=n(o,5)+t+u+e+i;u=f,f=c,c=n(s,30),s=o,o=r,d++}var i,a=this._w,o=this._a,s=this._b,c=this._c,f=this._d,u=this._e,d=0;for(i=1518500249;16>d;)r(e.readInt32BE(4*d),s&c|~s&f);for(;20>d;)r(t(),s&c|~s&f);for(i=1859775393;40>d;)r(t(),s^c^f);for(i=-1894007588;60>d;)r(t(),s&c|s&f|c&f);for(i=-899497514;80>d;)r(t(),s^c^f);this._a=o+this._a|0,this._b=s+this._b|0,this._c=c+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0},i.prototype._hash=function(){var e=new r(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,buffer:11,inherits:202}],141:[function(e,t,r){(function(r){function i(){this.init(),this._w=s,o.call(this,64,56)}function n(e,t){return e<>>32-t}var a=e("inherits"),o=e("./hash"),s=new Array(80);a(i,o),i.prototype.init=function(){return this._a=1732584193,this._b=-271733879,this._c=-1732584194,this._d=271733878,this._e=-1009589776,this},i.prototype._update=function(e){function t(){return n(a[d-3]^a[d-8]^a[d-14]^a[d-16],1)}function r(e,t){a[d]=e;var r=n(o,5)+t+u+e+i;u=f,f=c,c=n(s,30),s=o,o=r,d++}var i,a=this._w,o=this._a,s=this._b,c=this._c,f=this._d,u=this._e,d=0;for(i=1518500249;16>d;)r(e.readInt32BE(4*d),s&c|~s&f);for(;20>d;)r(t(),s&c|~s&f);for(i=1859775393;40>d;)r(t(),s^c^f);for(i=-1894007588;60>d;)r(t(),s&c|s&f|c&f);for(i=-899497514;80>d;)r(t(),s^c^f);this._a=o+this._a|0,this._b=s+this._b|0,this._c=c+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0},i.prototype._hash=function(){var e=new r(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,buffer:11,inherits:202}],142:[function(e,t,r){(function(r){function i(){this.init(),this._w=s,o.call(this,64,56)}var n=e("inherits"),a=e("./sha256"),o=e("./hash"),s=new Array(64);n(i,a),i.prototype.init=function(){return this._a=-1056596264,this._b=914150663,this._c=812702999,this._d=-150054599,this._e=-4191439,this._f=1750603025,this._g=1694076839,this._h=-1090891868,this},i.prototype._hash=function(){var e=new r(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,"./sha256":143,buffer:11,inherits:202}],143:[function(e,t,r){(function(r){function i(){this.init(),this._w=l,d.call(this,64,56)}function n(e,t,r){return r^e&(t^r)}function a(e,t,r){return e&t|r&(e|t)}function o(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function s(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function c(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function f(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var u=e("inherits"),d=e("./hash"),h=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=new Array(64);u(i,d),i.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this},i.prototype._update=function(e){function t(){return f(i[y-2])+i[y-7]+c(i[y-15])+i[y-16]}function r(e){i[y]=e;var t=v+s(b)+n(b,m,g)+h[y]+e,r=o(u)+a(u,d,l);v=g,g=m,m=b,b=p+t,p=l,l=d,d=u,u=t+r,y++}for(var i=this._w,u=0|this._a,d=0|this._b,l=0|this._c,p=0|this._d,b=0|this._e,m=0|this._f,g=0|this._g,v=0|this._h,y=0;16>y;)r(e.readInt32BE(4*y));for(;64>y;)r(t());this._a=u+this._a|0,this._b=d+this._b|0,this._c=l+this._c|0,this._d=p+this._d|0,this._e=b+this._e|0,this._f=m+this._f|0,this._g=g+this._g|0,this._h=v+this._h|0},i.prototype._hash=function(){var e=new r(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,buffer:11,inherits:202}],144:[function(e,t,r){(function(r){function i(){this.init(),this._w=s,o.call(this,128,112)}var n=e("inherits"),a=e("./sha512"),o=e("./hash"),s=new Array(160);n(i,a),i.prototype.init=function(){return this._a=-876896931,this._b=1654270250,this._c=-1856437926,this._d=355462360,this._e=1731405415,this._f=-1900787065,this._g=-619958771,this._h=1203062813,this._al=-1056596264,this._bl=914150663,this._cl=812702999,this._dl=-150054599,this._el=-4191439,this._fl=1750603025,this._gl=1694076839,this._hl=-1090891868,this},i.prototype._hash=function(){function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}var t=new r(48);return e(this._a,this._al,0),e(this._b,this._bl,8),e(this._c,this._cl,16),e(this._d,this._dl,24),e(this._e,this._el,32),e(this._f,this._fl,40),t},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,"./sha512":145,buffer:11,inherits:202}],145:[function(e,t,r){(function(r){function i(){this.init(),this._w=b,l.call(this,128,112)}function n(e,t,r){return r^e&(t^r)}function a(e,t,r){return e&t|r&(e|t)}function o(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function s(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function c(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function u(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function d(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}var h=e("inherits"),l=e("./hash"),p=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],b=new Array(160);h(i,l),i.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._al=-205731576,this._bl=-2067093701,this._cl=-23791573,this._dl=1595750129,this._el=-1377402159,this._fl=725511199,this._gl=-79577749,this._hl=327033209,this},i.prototype._update=function(e){function t(){var e=l[M-30],t=l[M-30+1],r=c(e,t),n=f(t,e);e=l[M-4],t=l[M-4+1];var a=u(e,t),o=d(t,e),s=l[M-14],p=l[M-14+1],b=l[M-32],m=l[M-32+1];h=n+p,i=r+s+(n>>>0>h>>>0?1:0),h+=o,i=i+a+(o>>>0>h>>>0?1:0),h+=m,i=i+b+(m>>>0>h>>>0?1:0)}function r(){l[M]=i,l[M+1]=h;var e=a(b,m,g),t=a(k,E,x),r=o(b,k),c=o(k,b),f=s(y,j),u=s(j,y),d=p[M],q=p[M+1],C=n(y,w,_),P=n(j,B,I),L=z+u,D=S+f+(z>>>0>L>>>0?1:0);L+=P,D=D+C+(P>>>0>L>>>0?1:0),L+=q,D=D+d+(q>>>0>L>>>0?1:0),L+=h,D=D+i+(h>>>0>L>>>0?1:0);var T=c+t,U=r+e+(c>>>0>T>>>0?1:0);S=_,z=I,_=w,I=B,w=y,B=j,j=A+L|0,y=v+D+(A>>>0>j>>>0?1:0)|0,v=g,A=x,g=m,x=E,m=b,E=k,k=L+T|0,b=D+U+(L>>>0>k>>>0?1:0)|0,R++,M+=2}for(var i,h,l=this._w,b=0|this._a,m=0|this._b,g=0|this._c,v=0|this._d,y=0|this._e,w=0|this._f,_=0|this._g,S=0|this._h,k=0|this._al,E=0|this._bl,x=0|this._cl,A=0|this._dl,j=0|this._el,B=0|this._fl,I=0|this._gl,z=0|this._hl,R=0,M=0;16>R;)i=e.readInt32BE(4*M),h=e.readInt32BE(4*M+4),r();for(;80>R;)t(),r();this._al=this._al+k|0,this._bl=this._bl+E|0,this._cl=this._cl+x|0,this._dl=this._dl+A|0,this._el=this._el+j|0,this._fl=this._fl+B|0,this._gl=this._gl+I|0,this._hl=this._hl+z|0,this._a=this._a+b+(this._al>>>0>>0?1:0)|0,this._b=this._b+m+(this._bl>>>0>>0?1:0)|0,this._c=this._c+g+(this._cl>>>0>>0?1:0)|0,this._d=this._d+v+(this._dl>>>0>>0?1:0)|0,this._e=this._e+y+(this._el>>>0>>0?1:0)|0,this._f=this._f+w+(this._fl>>>0>>0?1:0)|0,this._g=this._g+_+(this._gl>>>0>>0?1:0)|0,this._h=this._h+S+(this._hl>>>0>>0?1:0)|0},i.prototype._hash=function(){function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}var t=new r(64);return e(this._a,this._al,0),e(this._b,this._bl,8),e(this._c,this._cl,16),e(this._d,this._dl,24),e(this._e,this._el,32),e(this._f,this._fl,40),e(this._g,this._gl,48),e(this._h,this._hl,56),t},t.exports=i}).call(this,e("buffer").Buffer)},{"./hash":138,buffer:11,inherits:202}],146:[function(e,t,r){(function(r){"use strict";function i(e,t){o.call(this),e=e.toLowerCase(),"string"==typeof t&&(t=new r(t));var i="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=t,t.length>i?t=n(e).update(t).digest():t.lengthf;f++)a[f]=54^t[f],c[f]=92^t[f];this._hash=n(e).update(a)}var n=e("create-hash/browser"),a=e("inherits"),o=e("stream").Transform,s=new r(128);s.fill(0),a(i,o),i.prototype.update=function(e,t){return this._hash.update(e,t),this},i.prototype._transform=function(e,t,r){this._hash.update(e),r()},i.prototype._flush=function(e){this.push(this.digest()),e()},i.prototype.digest=function(e){var t=this._hash.digest();return n(this._alg).update(this._opad).update(t).digest(e)},t.exports=function(e,t){return new i(e,t)}}).call(this,e("buffer").Buffer)},{buffer:11,"create-hash/browser":133,inherits:202,stream:219}],147:[function(e,t,r){(function(t){function i(e){var r=new t(o[e].prime,"hex"),i=new t(o[e].gen,"hex");return new s(r,i)}function n(e,r,i,n){return(t.isBuffer(r)||"string"==typeof r&&-1===["hex","binary","base64"].indexOf(r))&&(n=i,i=r,r=void 0),r=r||"binary",n=n||"binary",i=i||new t([2]),t.isBuffer(i)||(i=new t(i,n)),"number"==typeof e?new s(a(e,i),i,!0):(t.isBuffer(e)||(e=new t(e,r)),new s(e,i,!0))}var a=e("./lib/generatePrime"),o=e("./lib/primes"),s=e("./lib/dh");r.DiffieHellmanGroup=r.createDiffieHellmanGroup=r.getDiffieHellman=i,r.createDiffieHellman=r.DiffieHellman=n}).call(this,e("buffer").Buffer)},{"./lib/dh":148,"./lib/generatePrime":149,"./lib/primes":150,buffer:11}],148:[function(e,t,r){(function(r){function i(e,t){return t=t||"utf8",r.isBuffer(e)||(e=new r(e,t)),this._pub=new f(e),this}function n(e,t){return t=t||"utf8",r.isBuffer(e)||(e=new r(e,t)),this._priv=new f(e),this}function a(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in y)return y[i];var n=0;if(e.isEven()||!g.simpleSieve||!g.fermatTest(e)||!d.test(e))return n+=1,n+="02"===r||"05"===r?8:4,y[i]=n,n;d.test(e.shrn(1))||(n+=2);var a;switch(r){case"02":e.mod(h).cmp(l)&&(n+=8);break;case"05":a=e.mod(p),a.cmp(b)&&a.cmp(m)&&(n+=8);break;default:n+=4}return y[i]=n,n}function o(e,t){try{Object.defineProperty(e,"verifyError",{enumerable:!0,value:t,writable:!1})}catch(r){e.verifyError=t}}function s(e,t,r){this.setGenerator(t),this.__prime=new f(e),this._prime=f.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,r?(this.setPublicKey=i,this.setPrivateKey=n,o(this,a(this.__prime,t))):o(this,8)}function c(e,t){var i=new r(e.toArray());return t?i.toString(t):i}var f=e("bn.js"),u=e("miller-rabin"),d=new u,h=new f(24),l=new f(11),p=new f(10),b=new f(3),m=new f(7),g=e("./generatePrime"),v=e("randombytes");t.exports=s;var y={};s.prototype.generateKeys=function(){return this._priv||(this._priv=new f(v(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},s.prototype.computeSecret=function(e){e=new f(e),e=e.toRed(this._prime);var t=e.redPow(this._priv).fromRed(),i=new r(t.toArray()),n=this.getPrime();if(i.lengthi;i+=2){for(var n=Math.ceil(Math.sqrt(i)),a=0;r>a&&t[a]<=n&&i%t[a]!==0;a++);r!==a&&t[a]<=n||(t[r++]=i)}return S=t,t}function n(e){for(var t=i(),r=0;re;)r.ishrn(1);if(r.isEven()&&r.iadd(h),r.testn(1)||r.iadd(l),t.cmp(l))if(t.cmp(p))o={major:[w],minor:[l]};else{for(rem=r.mod(g);rem.cmp(v);)r.iadd(w),rem=r.mod(g);o={major:[w,b],minor:[l,m]}}else{for(;r.mod(f).cmp(y);)r.iadd(w);o={major:[f],minor:[_]}}return r}if(16>e)return new c(2===t||5===t?[140,123]:[140,39]);t=new c(t);for(var i,o,u=r(e),S=u.shrn(1);;){for(;u.bitLength()>e;)u=r(e),S=u.shrn(1);if(i++,n(S)&&n(u)&&a(S)&&a(u)&&d.test(S)&&d.test(u))return u;u.iadd(o.major[i%o.major.length]),S.iadd(o.minor[i%o.minor.length])}}var s=e("randombytes");t.exports=o,o.simpleSieve=n,o.fermatTest=a;var c=e("bn.js"),f=new c(24),u=e("miller-rabin"),d=new u,h=new c(1),l=new c(2),p=new c(5),b=new c(16),m=new c(8),g=new c(10),v=new c(3),y=(new c(7),new c(11)),w=new c(4),_=new c(12),S=null},{"bn.js":151,"miller-rabin":152,randombytes:200}],150:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],151:[function(e,t,r){arguments[4][48][0].apply(r,arguments)},{dup:48}],152:[function(e,t,r){function i(e){this.rand=e||new a.Rand}var n=e("bn.js"),a=e("brorand");t.exports=i,i.create=function(e){return new i(e)},i.prototype._rand=function(e){var t=e.bitLength(),r=this.rand.generate(Math.ceil(t/8));r[0]|=3;var i=7&t;return 0!==i&&(r[r.length-1]>>=7-i),new n(r)},i.prototype.test=function(e,t,r){var i=e.bitLength(),a=n.mont(e),o=new n(1).toRed(a);t||(t=Math.max(1,i/48|0));for(var s=e.subn(1),c=s.subn(1),f=0;!s.testn(f);f++);for(var u=e.shrn(f),d=s.toRed(a),h=!0;t>0;t--){var l=this._rand(c);r&&r(l);var p=l.toRed(a).redPow(u);if(0!==p.cmp(o)&&0!==p.cmp(d)){for(var b=1;f>b;b++){if(p=p.redSqr(),0===p.cmp(o))return!1;if(0===p.cmp(d))break}if(b===f)return!1}}return h},i.prototype.getDivisor=function(e,t){var r=e.bitLength(),i=n.mont(e),a=new n(1).toRed(i);t||(t=Math.max(1,r/48|0));for(var o=e.subn(1),s=o.subn(1),c=0;!o.testn(c);c++);for(var f=e.shrn(c),u=o.toRed(i);t>0;t--){var d=this._rand(s),h=e.gcd(d);if(0!==h.cmpn(1))return h;var l=d.toRed(i).redPow(f);if(0!==l.cmp(a)&&0!==l.cmp(u)){for(var p=1;c>p;p++){if(l=l.redSqr(),0===l.cmp(a))return l.fromRed().subn(1).gcd(e);if(0===l.cmp(u))break}if(p===c)return l=l.redSqr(),l.fromRed().subn(1).gcd(e)}}return!1}},{"bn.js":151,brorand:153}],153:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{dup:63}],154:[function(e,t,r){(function(t){function i(e,t,r,i,a,o){if("function"==typeof a&&(o=a,a=void 0),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");var s=n(e,t,r,i,a);setTimeout(function(){o(void 0,s)})}function n(e,r,i,n,s){if("number"!=typeof i)throw new TypeError("Iterations not a number");if(0>i)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(0>n||n>o)throw new TypeError("Bad key length");s=s||"sha1",t.isBuffer(e)||(e=new t(e,"binary")),t.isBuffer(r)||(r=new t(r,"binary"));var c,f=1,u=new t(n),d=new t(r.length+4);r.copy(d,0,0,r.length);for(var h,l,p=1;f>=p;p++){d.writeUInt32BE(p,r.length);var b=a(s,e).update(d).digest();c||(c=b.length,l=new t(c),f=Math.ceil(n/c),h=n-(f-1)*c),b.copy(l,0,0,c);for(var m=1;i>m;m++){b=a(s,e).update(b).digest();for(var g=0;c>g;g++)l[g]^=b[g]}var v=(p-1)*c,y=p===f?h:c;l.copy(u,v,0,y)}return u}var a=e("create-hmac"),o=Math.pow(2,30)-1;r.pbkdf2=i,r.pbkdf2Sync=n}).call(this,e("buffer").Buffer)},{buffer:11,"create-hmac":146}],155:[function(e,t,r){r.publicEncrypt=e("./publicEncrypt"),r.privateDecrypt=e("./privateDecrypt"),r.privateEncrypt=function(e,t){return r.publicEncrypt(e,t,!0)},r.publicDecrypt=function(e,t){return r.privateDecrypt(e,t,!0)}},{"./privateDecrypt":196,"./publicEncrypt":197}],156:[function(e,t,r){(function(r){function i(e){var t=new r(4);return t.writeUInt32BE(e,0),t}var n=e("create-hash");t.exports=function(e,t){for(var a,o=new r(""),s=0;o.length=t.length){a++;break}var o=t.slice(2,n-1);t.slice(n-1,n);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++,o.length<8&&a++,a)throw new Error("decryption error");return t.slice(n)}function a(e,t){e=new r(e),t=new r(t);var i=0,n=e.length;e.length!==t.length&&(i++,n=Math.min(e.length,t.length));for(var a=-1;++ad||new f(t).cmp(c.modulus)>=0)throw new Error("decryption error");var l;l=a?h(new f(t),c):u(t,c);var p=new r(d-l.length);if(p.fill(0),l=r.concat([p,l],d),4===s)return i(c,l);if(1===s)return n(c,l,a);if(3===s)return l;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":156,"./withPublic":198,"./xor":199,"bn.js":157,"browserify-rsa":158,buffer:11,"create-hash":133,"parse-asn1":162}],197:[function(e,t,r){(function(r){function i(e,t){var i=e.modulus.byteLength(),n=t.length,a=c("sha1").update(new r("")).digest(),o=a.length,h=2*o;if(n>i-h-2)throw new Error("message too long");var l=new r(i-n-h-2);l.fill(0);var p=i-o-1,b=s(o),m=u(r.concat([a,l,new r([1]),t],p),f(b,p)),g=u(b,f(m,o));return new d(r.concat([new r([0]),g,m],i))}function n(e,t,i){var n=t.length,o=e.modulus.byteLength();if(n>o-11)throw new Error("message too long");var s;return i?(s=new r(o-n-3),s.fill(255)):s=a(o-n-3),new d(r.concat([new r([0,i?1:2]),s,new r([0]),t],o))}function a(e,t){for(var i,n=new r(e),a=0,o=s(2*e),c=0;e>a;)c===o.length&&(o=s(2*e),c=0),i=o[c++],i&&(n[a++]=i);return n}var o=e("parse-asn1"),s=e("randombytes"),c=e("create-hash"),f=e("./mgf"),u=e("./xor"),d=e("bn.js"),h=e("./withPublic"),l=e("browserify-rsa");t.exports=function(e,t,r){var a;a=e.padding?e.padding:r?1:4;var s,c=o(e);if(4===a)s=i(c,t);else if(1===a)s=n(c,t,r);else{if(3!==a)throw new Error("unknown padding");if(s=new d(t),s.cmp(c.modulus)>=0)throw new Error("data too long for modulus")}return r?l(s,c):h(s,c)}}).call(this,e("buffer").Buffer)},{"./mgf":156,"./withPublic":198,"./xor":199,"bn.js":157,"browserify-rsa":158,buffer:11,"create-hash":133,"parse-asn1":162,randombytes:200}],198:[function(e,t,r){(function(r){function i(e,t){return new r(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}var n=e("bn.js");t.exports=i}).call(this,e("buffer").Buffer)},{"bn.js":157,buffer:11}],199:[function(e,t,r){t.exports=function(e,t){for(var r=e.length,i=-1;++ie||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,r,i,a,c,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),c=1;i>c;c++)a[c-1]=arguments[c];r.apply(this,a)}else if(o(r)){for(i=arguments.length,a=new Array(i-1),c=1;i>c;c++)a[c-1]=arguments[c];for(f=r.slice(),i=f.length,c=0;i>c;c++)f[c].apply(this,a)}return!0},i.prototype.addListener=function(e,t){var r;if(!n(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned){var r;r=s(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){var r,i,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(s=a;s-->0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.listenerCount=function(e,t){var r;return r=e._events&&e._events[t]?n(e._events[t])?1:e._events[t].length:0}},{}],202:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],203:[function(e,t,r){t.exports=function(e){return!(null==e||!(e._isBuffer||e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)))}},{}],204:[function(e,t,r){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],205:[function(e,t,r){function i(){u=!1,s.length?f=s.concat(f):d=-1,f.length&&n()}function n(){if(!u){var e=setTimeout(i);u=!0;for(var t=f.length;t;){for(s=f,f=[];++d1)for(var r=1;r0)if(t.ended&&!n){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&n){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||n||i||(r=t.decoder.write(r)),n||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&d(e)),l(e,t);else n||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length=q)e=q;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function c(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var r=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function u(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(R("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(h,e):h(e))}function h(e){R("emit readable"),e.emit("readable"),y(e)}function l(e,t){t.readingMore||(t.readingMore=!0,x(p,e,t))}function p(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=n)r=a?i.join(""):j.concat(i,n),i.length=0;else if(ef&&e>c;f++){var s=i[0],d=Math.min(e-c,s.length);a?r+=s.slice(0,d):s.copy(r,c,0,d),d0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,x(S,t,e))}function S(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var r=0,i=e.length;i>r;r++)t(e[r],r)}function E(e,t){for(var r=0,i=e.length;i>r;r++)if(e[r]===t)return r;return-1}t.exports=n;var x=e("process-nextick-args"),A=e("isarray"),j=e("buffer").Buffer;n.ReadableState=i;var B=e("events").EventEmitter;B.listenerCount||(B.listenerCount=function(e,t){return e.listeners(t).length});var I;!function(){try{I=e("stream")}catch(t){}finally{I||(I=e("events").EventEmitter)}}();var j=e("buffer").Buffer,z=e("core-util-is");z.inherits=e("inherits");var R=e("util");R=R&&R.debuglog?R.debuglog("stream"):function(){};var M;z.inherits(n,I),n.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding,t!==r.encoding&&(e=new j(e,t),t="")),a(this,r,e,t,!1)},n.prototype.unshift=function(e){var t=this._readableState;return a(this,t,e,"",!0)},n.prototype.isPaused=function(){return this._readableState.flowing===!1},n.prototype.setEncoding=function(t){return M||(M=e("string_decoder/").StringDecoder),this._readableState.decoder=new M(t),this._readableState.encoding=t,this};var q=8388608;n.prototype.read=function(e){R("read",e);var t=this._readableState,r=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return R("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?_(this):d(this),null;if(e=c(e,t),0===e&&t.ended)return 0===t.length&&_(this),null;var i=t.needReadable;R("need readable",i),(0===t.length||t.length-e0?w(e,t):null,null===n&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),r!==e&&t.ended&&0===t.length&&_(this),null!==n&&this.emit("data",n),n},n.prototype._read=function(e){this.emit("error",new Error("not implemented"))},n.prototype.pipe=function(e,t){function i(e){R("onunpipe"),e===d&&a()}function n(){R("onend"),e.end()}function a(){R("cleanup"),e.removeListener("close",c),e.removeListener("finish",f),e.removeListener("drain",m),e.removeListener("error",s),e.removeListener("unpipe",i),d.removeListener("end",n),d.removeListener("end",a),d.removeListener("data",o),!h.awaitDrain||e._writableState&&!e._writableState.needDrain||m()}function o(t){R("ondata");var r=e.write(t);!1===r&&(R("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,d.pause())}function s(t){R("onerror",t),u(),e.removeListener("error",s),0===B.listenerCount(e,"error")&&e.emit("error",t)}function c(){e.removeListener("finish",f),u()}function f(){R("onfinish"),e.removeListener("close",c),u()}function u(){R("unpipe"),d.unpipe(e)}var d=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,R("pipe count=%d opts=%j",h.pipesCount,t);var l=(!t||t.end!==!1)&&e!==r.stdout&&e!==r.stderr,p=l?n:a;h.endEmitted?x(p):d.once("end",p),e.on("unpipe",i);var m=b(d);return e.on("drain",m),d.on("data",o),e._events&&e._events.error?A(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",c),e.once("finish",f),e.emit("pipe",d),h.flowing||(R("pipe resume"),d.resume()),e},n.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var n=0;i>n;n++)r[n].emit("unpipe",this);return this}var n=E(t.pipes,e);return-1===n?this:(t.pipes.splice(n,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},n.prototype.on=function(e,t){var r=I.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var i=this._readableState;i.readableListening||(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading?i.length&&d(this,i):x(m,this))}return r},n.prototype.addListener=n.prototype.on,n.prototype.resume=function(){var e=this._readableState;return e.flowing||(R("resume"),e.flowing=!0,g(this,e)),this},n.prototype.pause=function(){return R("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(R("pause"),this._readableState.flowing=!1,this.emit("pause")),this},n.prototype.wrap=function(e){var t=this._readableState,r=!1,i=this;e.on("end",function(){if(R("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&i.push(e)}i.push(null)}),e.on("data",function(n){if(R("wrapped data"),t.decoder&&(n=t.decoder.write(n)),(!t.objectMode||null!==n&&void 0!==n)&&(t.objectMode||n&&n.length)){var a=i.push(n);a||(r=!0,e.pause())}});for(var n in e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));var a=["error","close","destroy","pause","resume"];return k(a,function(t){e.on(t,i.emit.bind(i,t))}),i._read=function(t){R("wrapped _read",t),r&&(r=!1,e.resume())},i},n._fromList=w}).call(this,e("_process"))},{"./_stream_duplex":207,_process:205,buffer:11,"core-util-is":212,events:201,inherits:202,isarray:204,"process-nextick-args":213,"string_decoder/":220,util:10}],210:[function(e,t,r){"use strict";function i(e){this.afterTransform=function(t,r){return n(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function n(e,t,r){var i=e._transformState;i.transforming=!1;var n=i.writecb;if(!n)return e.emit("error",new Error("no writecb in Transform class"));i.writechunk=null,i.writecb=null,null!==r&&void 0!==r&&e.push(r),n&&n(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},o.prototype._write=function(e,t,r){r(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||_(this,i,r)}},{"./_stream_duplex":207,buffer:11,"core-util-is":212,events:201,inherits:202,"process-nextick-args":213,"util-deprecate":214}],212:[function(e,t,r){(function(e){function t(e){return Array.isArray(e)}function i(e){return"boolean"==typeof e}function n(e){return null===e}function a(e){return null==e}function o(e){return"number"==typeof e}function s(e){return"string"==typeof e}function c(e){return"symbol"==typeof e}function f(e){return void 0===e}function u(e){return d(e)&&"[object RegExp]"===g(e)}function d(e){return"object"==typeof e&&null!==e}function h(e){return d(e)&&"[object Date]"===g(e)}function l(e){return d(e)&&("[object Error]"===g(e)||e instanceof Error)}function p(e){return"function"==typeof e}function b(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function m(t){return e.isBuffer(t)}function g(e){return Object.prototype.toString.call(e)}r.isArray=t,r.isBoolean=i,r.isNull=n,r.isNullOrUndefined=a,r.isNumber=o,r.isString=s,r.isSymbol=c,r.isUndefined=f,r.isRegExp=u,r.isObject=d,r.isDate=h,r.isError=l,r.isFunction=p,r.isPrimitive=b,r.isBuffer=m}).call(this,{isBuffer:e("../../../../insert-module-globals/node_modules/is-buffer/index.js")})},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":203}],213:[function(e,t,r){(function(e){"use strict";function r(t){for(var r=new Array(arguments.length-1),i=0;i=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&56319>=i)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived),t+=e.toString(this.encoding,0,n);var n=t.length-1,i=t.charCodeAt(n);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,n)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,i=this.charBuffer,n=this.encoding;
+t+=i.slice(0,r).toString(n)}return t}},{buffer:11}],221:[function(require,module,exports){function Context(){}var indexOf=require("indexof"),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r>8&255]>h&&(k[t]=i)),i}function i(e,t,r){var i=65280&t,n=S.udata[i]||{},a=n[t];return a?new S(t,a):new S(t,d)}function n(e,t,r){return r?e(t,r):new S(t,null)}function a(e,t,r){var i;if(p>t||t>=p+g&&l>t||t>l+_)return e(t,r);if(t>=p&&p+g>t){var n={},a=(t-p)*v;for(i=0;v>i;++i)n[b+i]=l+y*(i+a);return new S(t,[,,n])}var o=t-l,s=o%y,c=[];if(0!==s)c[0]=[l+o-s,m+s];else for(c[0]=[p+Math.floor(o/w),b+Math.floor(o%w/y)],c[2]={},i=1;y>i;++i)c[2][m+i]=t+i;return new S(t,c)}function o(e,t,r){return 60>t||t>13311&&42607>t?new S(t,d):e(t,r)}function s(e){return M("NFD",e)}function c(e){return M("NFKD",e)}function f(e){return M("NFC",e)}function u(e){return M("NFKC",e)}for(var d=[null,0,{}],h=10,l=44032,p=4352,b=4449,m=4519,g=19,v=21,y=28,w=v*y,_=g*w,S=function(e,t){this.codepoint=e,this.feature=t},k={},E=[],x=0;255>=x;++x)E[x]=0;var A=[o,r,n,a,i];S.fromCharCode=A.reduceRight(function(e,t){return function(r,i){return t(e,r,i)}},null),S.isHighSurrogate=function(e){return e>=55296&&56319>=e},S.isLowSurrogate=function(e){return e>=56320&&57343>=e},S.prototype.prepFeature=function(){this.feature||(this.feature=S.fromCharCode(this.codepoint,!0).feature)},S.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var e=this.codepoint-65536;return String.fromCharCode(Math.floor(e/1024)+55296,e%1024+56320)},S.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},S.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},S.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},S.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},S.prototype.getComposite=function(e){if(this.prepFeature(),!this.feature[2])return null;var t=this.feature[2][e.codepoint];return t?S.fromCharCode(t):null};var j=function(e){this.str=e,this.cursor=0};j.prototype.next=function(){if(this.str&&this.cursor0;--r){var i=this.resBuf[r-1],n=i.getCanonicalClass();if(e>=n)break}this.resBuf.splice(r,0,t)}while(0!==e);return this.resBuf.shift()};var z=function(e){this.it=e,this.procBuf=[],this.resBuf=[],this.lastClass=null};z.prototype.next=function(){for(;0===this.resBuf.length;){var e=this.it.next();if(!e){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=e.getCanonicalClass(),this.procBuf.push(e);else{var t=this.procBuf[0],r=t.getComposite(e),i=e.getCanonicalClass();r&&(this.lastClass"},e.exports=n;var d=t("./script")}).call(this,t("buffer").Buffer)},{"./crypto/hash":8,"./encoding/base58check":13,"./errors":17,"./networks":22,"./publickey":25,"./script":26,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],2:[function(t,e,r){(function(r){"use strict";function n(t){return this instanceof n?(i.extend(this,n._from(t)),this):new n(t)}var i=t("lodash"),s=t("./blockheader"),o=t("../crypto/bn"),a=t("../util/buffer"),f=t("../encoding/bufferreader"),u=t("../encoding/bufferwriter"),c=t("../crypto/hash"),h=t("../transaction"),d=t("../util/preconditions");n.MAX_BLOCK_SIZE=1e6,n._from=function(t){var e={};if(a.isBuffer(t))e=n._fromBufferReader(f(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for Block");e=n._fromObject(t)}return e},n._fromObject=function(t){var e=[];t.transactions.forEach(function(t){t instanceof h?e.push(t):e.push(h().fromObject(t))});var r={header:s.fromObject(t.header),transactions:e};return r},n.fromObject=function(t){var e=n._fromObject(t);return new n(e)},n._fromBufferReader=function(t){var e={};d.checkState(!t.finished(),"No block data received"),e.header=s.fromBufferReader(t);var r=t.readVarintNum();e.transactions=[];for(var n=0;r>n;n++)e.transactions.push(h().fromBufferReader(t));return e},n.fromBufferReader=function(t){d.checkArgument(t,"br is required");var e=n._fromBufferReader(t);return new n(e)},n.fromBuffer=function(t){return n.fromBufferReader(new f(t))},n.fromString=function(t){var e=new r(t,"hex");return n.fromBuffer(e)},n.fromRawBlock=function(t){a.isBuffer(t)||(t=new r(t,"binary"));var e=f(t);e.pos=n.Values.START_OF_BLOCK;var i=n._fromBufferReader(e);return new n(i)},n.prototype.toObject=n.prototype.toJSON=function(){var t=[];return this.transactions.forEach(function(e){t.push(e.toObject())}),{header:this.header.toObject(),transactions:t}},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toBufferWriter=function(t){t||(t=new u),t.write(this.header.toBuffer()),t.writeVarintNum(this.transactions.length);for(var e=0;e1;n=Math.floor((n+1)/2)){for(var i=0;n>i;i+=2){var s=Math.min(i+1,n-1),o=r.concat([t[e+i],t[e+s]]);t.push(c.sha256sha256(o))}e+=n}return t},n.prototype.getMerkleRoot=function(){var t=this.getMerkleTree();return t[t.length-1]},n.prototype.validMerkleRoot=function(){var t=new o(this.header.merkleRoot.toString("hex"),"hex"),e=new o(this.getMerkleRoot().toString("hex"),"hex");return 0!==t.cmp(e)?!1:!0},n.prototype._getHash=function(){return this.header._getHash()};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:i.noop};Object.defineProperty(n.prototype,"id",p),Object.defineProperty(n.prototype,"hash",p),n.prototype.inspect=function(){return""},n.Values={START_OF_BLOCK:8,NULL_HASH:new r("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":29,"../util/buffer":43,"../util/preconditions":45,"./blockheader":3,buffer:48,lodash:297}],3:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../crypto/bn"),s=t("../util/buffer"),o=t("../encoding/bufferreader"),a=t("../encoding/bufferwriter"),f=t("../crypto/hash"),u=(t("../util/js"),t("../util/preconditions")),c=486604799,h=function p(t){if(!(this instanceof p))return new p(t);var e=p._from(t);return this.version=e.version,this.prevHash=e.prevHash,this.merkleRoot=e.merkleRoot,this.time=e.time,this.timestamp=e.time,this.bits=e.bits,this.nonce=e.nonce,e.hash&&u.checkState(this.hash===e.hash,"Argument object hash property does not match block hash."),this};h._from=function(t){var e={};if(s.isBuffer(t))e=h._fromBufferReader(o(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");e=h._fromObject(t)}return e},h._fromObject=function(t){u.checkArgument(t,"data is required");var e=t.prevHash,i=t.merkleRoot;n.isString(t.prevHash)&&(e=s.reverse(new r(t.prevHash,"hex"))),n.isString(t.merkleRoot)&&(i=s.reverse(new r(t.merkleRoot,"hex")));var o={hash:t.hash,version:t.version,prevHash:e,merkleRoot:i,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce};return o},h.fromObject=function(t){var e=h._fromObject(t);return new h(e)},h.fromRawBlock=function(t){s.isBuffer(t)||(t=new r(t,"binary"));var e=o(t);e.pos=h.Constants.START_OF_HEADER;var n=h._fromBufferReader(e);return new h(n)},h.fromBuffer=function(t){var e=h._fromBufferReader(o(t));return new h(e)},h.fromString=function(t){var e=new r(t,"hex");return h.fromBuffer(e)},h._fromBufferReader=function(t){var e={};return e.version=t.readUInt32LE(),e.prevHash=t.read(32),e.merkleRoot=t.read(32),e.time=t.readUInt32LE(),e.bits=t.readUInt32LE(),e.nonce=t.readUInt32LE(),e},h.fromBufferReader=function(t){var e=h._fromBufferReader(t);return new h(e)},h.prototype.toObject=h.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:s.reverse(this.prevHash).toString("hex"),merkleRoot:s.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},h.prototype.toBuffer=function(){return this.toBufferWriter().concat()},h.prototype.toString=function(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},h.prototype.getTargetDifficulty=function(t){t=t||this.bits;for(var e=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)e=e.mul(new i(2));return e},h.prototype.getDifficulty=function(){var t=this.getTargetDifficulty(c).mul(new i(Math.pow(10,8))),e=this.getTargetDifficulty(),r=t.div(e).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},h.prototype._getHash=function(){var t=this.toBuffer();return f.sha256sha256(t)};var d={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(h.prototype,"id",d),Object.defineProperty(h.prototype,"hash",d),h.prototype.validTimestamp=function(){var t=Math.round((new Date).getTime()/1e3);return this.time>t+h.Constants.MAX_TIME_OFFSET?!1:!0},h.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return t.cmp(e)>0?!1:!0},h.prototype.inspect=function(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,lodash:297}],4:[function(t,e,r){e.exports=t("./block"),e.exports.BlockHeader=t("./blockheader"),e.exports.MerkleBlock=t("./merkleblock")},{"./block":2,"./blockheader":3,"./merkleblock":5}],5:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);var e={};if(o.isBuffer(t))e=n._fromBufferReader(a(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=t.header instanceof s?t.header:s.fromObject(t.header),e={header:r,numTransactions:t.numTransactions,hashes:t.hashes,flags:t.flags}}return i.extend(this,e),this._flagBitsUsed=0,this._hashesUsed=0,this}var i=t("lodash"),s=t("./blockheader"),o=t("../util/buffer"),a=t("../encoding/bufferreader"),f=t("../encoding/bufferwriter"),u=t("../crypto/hash"),c=(t("../util/js"),t("../transaction")),h=t("../util/preconditions");n.fromBuffer=function(t){return n.fromBufferReader(a(t))},n.fromBufferReader=function(t){return new n(n._fromBufferReader(t))},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toBufferWriter=function(t){t||(t=new f),t.write(this.header.toBuffer()),t.writeUInt32LE(this.numTransactions),t.writeVarintNum(this.hashes.length);for(var e=0;ethis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var i=this.flags[n.flagBitsUsed>>3]>>>(7&n.flagBitsUsed++)&1;if(0!==t&&i){var s=this._traverseMerkleTree(t-1,2*e,n),o=s;return 2*e+1=this.hashes.length)return null;var a=this.hashes[n.hashesUsed++];return 0===t&&i&&n.txs.push(a),new r(a,"hex")},n.prototype._calcTreeWidth=function(t){return this.numTransactions+(1<>t},n.prototype._calcTreeHeight=function(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},n.prototype.hasTransaction=function(t){h.checkArgument(!i.isUndefined(t),"tx cannot be undefined"),h.checkArgument(t instanceof c||"string"==typeof t,'Invalid tx given, tx must be a "string" or "Transaction"');var e=t;t instanceof c&&(e=o.reverse(new r(t.id,"hex")).toString("hex"));var n=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:n}),-1!==n.indexOf(e)},n._fromBufferReader=function(t){h.checkState(!t.finished(),"No merkleblock data received");var e={};e.header=s.fromBufferReader(t),e.numTransactions=t.readUInt32LE();var r=t.readVarintNum();e.hashes=[];for(var n=0;r>n;n++)e.hashes.push(t.read(32).toString("hex"));var i=t.readVarintNum();for(e.flags=[],n=0;i>n;n++)e.flags.push(t.readUInt8());return e},n.fromObject=function(t){return new n(t)},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":29,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,"./blockheader":3,buffer:48,lodash:297}],6:[function(t,e,r){(function(r){"use strict";var n=t("bn.js"),i=t("../util/preconditions"),s=t("lodash"),o=function(t){for(var e=new r(t.length),n=0;nt.size?e=n.trim(e,s):s0&&0===(127&t[t.length-1])&&(t.length<=1||0===(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(t,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.prototype.gt=function(t){return this.cmp(t)>0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.lt=function(t){return this.cmp(t)<0},n.trim=function(t,e){return t.slice(e-t.length,t.length)},n.pad=function(t,e,n){for(var i=new r(n),s=0;ss;s++)i[s]=0;return i},e.exports=n}).call(this,t("buffer").Buffer)},{"../util/preconditions":45,"bn.js":272,buffer:48,lodash:297}],7:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("./point"),s=t("./signature"),o=t("../publickey"),a=t("./random"),f=t("./hash"),u=t("../util/buffer"),c=t("lodash"),h=t("../util/preconditions"),d=function p(t){return this instanceof p?void(t&&this.set(t)):new p(t)};d.prototype.set=function(t){return this.hashbuf=t.hashbuf||this.hashbuf,this.endian=t.endian||this.endian,this.privkey=t.privkey||this.privkey,this.pubkey=t.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=t.sig||this.sig,this.k=t.k||this.k,this.verified=t.verified||this.verified,this},d.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},d.prototype.calci=function(){for(var t=0;4>t;t++){this.sig.i=t;var e;try{e=this.toPublicKey()}catch(r){console.error(r);continue}if(e.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},d.fromString=function(t){var e=JSON.parse(t);return new d(e)},d.prototype.randomK=function(){var t,e=i.getN();do t=n.fromBuffer(a.getRandomBuffer(32));while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},d.prototype.deterministicK=function(t){c.isUndefined(t)&&(t=0);var e=new r(32);e.fill(1);var s=new r(32);s.fill(0);var o=this.privkey.bn.toBuffer({size:32});s=f.sha256hmac(r.concat([e,new r([0]),o,this.hashbuf]),s),e=f.sha256hmac(e,s),s=f.sha256hmac(r.concat([e,new r([1]),o,this.hashbuf]),s),e=f.sha256hmac(e,s),e=f.sha256hmac(e,s);for(var a=n.fromBuffer(e),u=i.getN(),h=0;t>h||!a.lt(u)||!a.gt(n.Zero);h++)s=f.sha256hmac(r.concat([e,new r([0])]),s),e=f.sha256hmac(e,s),e=f.sha256hmac(e,s),a=n.fromBuffer(e);return this.k=a,this},d.prototype.toPublicKey=function(){var t=this.sig.i;h.checkArgument(0===t||1===t||2===t||3===t,new Error("i must be equal to 0, 1, 2, or 3"));var e=n.fromBuffer(this.hashbuf),r=this.sig.r,s=this.sig.s,a=1&t,f=t>>1,u=i.getN(),c=i.getG(),d=f?r.add(u):r,p=i.fromX(a,d),l=p.mul(u);if(!l.isInfinity())throw new Error("nR is not a valid curve point");var b=e.neg().mod(u),g=r.invm(u),m=p.mul(s).add(c.mul(b)).mul(g),y=o.fromPoint(m,this.sig.compressed);return y},d.prototype.sigError=function(){if(!u.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,e=this.sig.s;if(!(t.gt(n.Zero)&&t.lt(i.getN())&&e.gt(n.Zero)&&e.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=i.getN(),o=e.invm(s),a=o.mul(r).mod(s),f=o.mul(t).mod(s),c=i.getG().mulAdd(a,this.pubkey.point,f);return c.isInfinity()?"p is infinity":0!==c.getX().mod(s).cmp(t)?"Invalid signature":!1},d.toLowS=function(t){return t.gt(n.fromBuffer(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=i.getN().sub(t)),t},d.prototype._findSignature=function(t,e){var r,s,o,a,f=i.getN(),u=i.getG(),c=0;do(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,s=u.mul(r),o=s.x.mod(f),a=r.invm(f).mul(e.add(t.mul(o))).mod(f);while(o.cmp(n.Zero)<=0||a.cmp(n.Zero)<=0);return a=d.toLowS(a),{s:a,r:o}},d.prototype.sign=function(){var t=this.hashbuf,e=this.privkey,r=e.bn;h.checkState(t&&e&&r,new Error("invalid parameters")),h.checkState(u.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(t,this.endian?{endian:this.endian}:void 0),o=this._findSignature(r,i);return o.compressed=this.pubkey.compressed,this.sig=new s(o),this},d.prototype.signRandomK=function(){return this.randomK(),this.sign()},d.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},d.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},d.sign=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().sig},d.verify=function(t,e,r,n){return d().set({hashbuf:t,endian:n,sig:e,pubkey:r}).verify().verified},e.exports=d}).call(this,t("buffer").Buffer)},{"../publickey":25,"../util/buffer":43,"../util/preconditions":45,"./bn":6,"./hash":8,"./point":9,"./random":10,"./signature":11,buffer:48,lodash:297}],8:[function(t,e,r){(function(r){"use strict";var n=t("sha512"),i=t("crypto"),s=t("../util/buffer"),o=t("../util/preconditions"),a=e.exports;a.sha1=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("sha1").update(t).digest()},a.sha1.blocksize=512,a.sha256=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("sha256").update(t).digest()},a.sha256.blocksize=512,a.sha256sha256=function(t){return o.checkArgument(s.isBuffer(t)),a.sha256(a.sha256(t))},a.ripemd160=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("ripemd160").update(t).digest()},a.sha256ripemd160=function(t){return o.checkArgument(s.isBuffer(t)),a.ripemd160(a.sha256(t))},a.sha512=function(t){o.checkArgument(s.isBuffer(t));var e=n(t);return new r(e)},a.sha512.blocksize=1024,a.hmac=function(t,e,n){o.checkArgument(s.isBuffer(e)),o.checkArgument(s.isBuffer(n)),o.checkArgument(t.blocksize);var i=t.blocksize/8;if(n.length>i)n=t(n);else if(i>n){var a=new r(i);a.fill(0),n.copy(a),n=a}var f=new r(i);f.fill(92);var u=new r(i);u.fill(54);for(var c=new r(i),h=new r(i),d=0;i>d;d++)c[d]=f[d]^n[d],h[d]=u[d]^n[d];return t(r.concat([c,t(r.concat([h,e]))]))},a.sha256hmac=function(t,e){return a.hmac(a.sha256,t,e)},a.sha512hmac=function(t,e){return a.hmac(a.sha512,t,e)}}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/preconditions":45,buffer:48,crypto:52,sha512:300}],9:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("../util/buffer"),s=t("elliptic").curves.secp256k1,o=s.curve.point.bind(s.curve),a=s.curve.pointFromX.bind(s.curve),f=function(t,e,r){var n=o(t,e,r);return n.validate(),n};f.prototype=Object.getPrototypeOf(s.curve.point()),f.fromX=function(t,e){var r=a(t,e);return r.validate(),r},f.getG=function(){return s.curve.g},f.getN=function(){return new n(s.curve.n.toArray())},f.prototype._getX=f.prototype.getX,f.prototype.getX=function(){return new n(this._getX().toArray())},f.prototype._getY=f.prototype.getY,f.prototype.getY=function(){return new n(this._getY().toArray())},f.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");if(0===this.getX().cmp(n.Zero)||0===this.getY().cmp(n.Zero))throw new Error("Invalid x,y value for curve, cannot equal 0.");var t=a(this.getY().isOdd(),this.getX());if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");var e=this.getX().gt(n.Minus1)&&this.getX().lt(f.getN()),r=this.getY().gt(n.Minus1)&&this.getY().lt(f.getN());if(!e||!r)throw new Error("Point does not lie on the curve");if(!this.mul(f.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},f.pointToCompressed=function(t){var e,n=t.getX().toBuffer({size:32}),s=t.getY().toBuffer({size:32}),o=s[s.length-1]%2;return e=new r(o?[3]:[2]),i.concat([e,n])},e.exports=f}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"./bn":6,buffer:48,elliptic:275}],10:[function(t,e,r){(function(r,n){"use strict";function i(){}i.getRandomBuffer=function(t){return r.browser?i.getRandomBufferBrowser(t):i.getRandomBufferNode(t)},i.getRandomBufferNode=function(e){var r=t("crypto");return r.randomBytes(e)},i.getRandomBufferBrowser=function(t){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var e=window.msCrypto}var r=new Uint8Array(t);e.getRandomValues(r);var i=new n(r);return i},i.getPseudoRandomBuffer=function(t){for(var e,r=4294967296,i=new n(t),s=0;t>=s;s++){var o=Math.floor(s/4),a=s-4*o;0===a?(e=Math.random()*r,i[s]=255&e):i[s]=255&(e>>>=8)}return i},e.exports=i}).call(this,t("_process"),t("buffer").Buffer)},{_process:247,buffer:48,crypto:52}],11:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("lodash"),s=t("../util/preconditions"),o=t("../util/buffer"),a=t("../util/js"),f=function u(t,e){if(!(this instanceof u))return new u(t,e);if(t instanceof n)this.set({r:t,s:e});else if(t){var r=t;this.set(r)}};f.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i="undefined"!=typeof t.i?t.i:this.i,this.compressed="undefined"!=typeof t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},f.fromCompact=function(t){s.checkArgument(o.isBuffer(t),"Argument is expected to be a Buffer");var e=new f,r=!0,i=t.slice(0,1)[0]-27-4;0>i&&(r=!1,i+=4);var a=t.slice(1,33),u=t.slice(33,65);return s.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),s.checkArgument(32===a.length,new Error("r must be 32 bytes")),s.checkArgument(32===u.length,new Error("s must be 32 bytes")),e.compressed=r,e.i=i,e.r=n.fromBuffer(a),e.s=n.fromBuffer(u),e},f.fromDER=f.fromBuffer=function(t,e){var r=f.parseDER(t,e),n=new f;return n.r=r.r,n.s=r.s,n},f.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),n=new f.fromDER(r,!1);return n.nhashtype=e,n},f.fromString=function(t){var e=new r(t,"hex");return f.fromDER(e)},f.parseDER=function(t,e){s.checkArgument(o.isBuffer(t),new Error("DER formatted signature should be a buffer")),i.isUndefined(e)&&(e=!0);var r=t[0];s.checkArgument(48===r,new Error("Header byte should be 0x30"));var a=t[1],f=t.slice(2).length;s.checkArgument(!e||a===f,new Error("Length byte should length of what follows")),a=f>a?a:f;var u=t[2];s.checkArgument(2===u,new Error("Integer byte for r should be 0x02"));var c=t[3],h=t.slice(4,4+c),d=n.fromBuffer(h),p=0===t[4]?!0:!1;s.checkArgument(c===h.length,new Error("Length of r incorrect"));var l=t[4+c+0];s.checkArgument(2===l,new Error("Integer byte for s should be 0x02"));var b=t[4+c+1],g=t.slice(4+c+2,4+c+2+b),m=n.fromBuffer(g),y=0===t[4+c+2+2]?!0:!1;s.checkArgument(b===g.length,new Error("Length of s incorrect"));var v=4+c+2+b;s.checkArgument(a===v-2,new Error("Length of signature incorrect"));var _={header:r,length:a,rheader:u,rlength:c,rneg:p,rbuf:h,r:d,sheader:l,slength:b,sneg:y,sbuf:g,s:m};return _},f.prototype.toCompact=function(t,e){if(t="number"==typeof t?t:this.i,e="boolean"==typeof e?e:this.compressed,0!==t&&1!==t&&2!==t&&3!==t)throw new Error("i must be equal to 0, 1, 2, or 3");var n=t+27+4;e===!1&&(n-=4);var i=new r([n]),s=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return r.concat([i,s,o])},f.prototype.toBuffer=f.prototype.toDER=function(){var t=this.r.toBuffer(),e=this.s.toBuffer(),n=128&t[0]?!0:!1,i=128&e[0]?!0:!1,s=n?r.concat([new r([0]),t]):t,o=i?r.concat([new r([0]),e]):e,a=s.length,f=o.length,u=2+a+2+f,c=2,h=2,d=48,p=r.concat([new r([d,u,c,a]),s,new r([h,f]),o]);return p},f.prototype.toString=function(){var t=this.toDER();return t.toString("hex")},f.isTxDER=function(t){if(t.length<9)return!1;if(t.length>73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;var i=t.slice(6+e);return 2!==t[6+e-2]?!1:0===r?!1:128&i[0]?!1:r>1&&0===i[0]&&!(128&i[1])?!1:!0},f.prototype.hasLowS=function(){return this.s.lt(new n(1))||this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))?!1:!0},f.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=this.nhashtype&~f.SIGHASH_ANYONECANPAY;return tf.SIGHASH_SINGLE?!1:!0},f.prototype.toTxFormat=function(){var t=this.toDER(),e=new r(1);return e.writeUInt8(this.nhashtype,0),r.concat([t,e])},f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_ANYONECANPAY=128,e.exports=f}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/js":44,"../util/preconditions":45,"./bn":6,buffer:48,lodash:297}],12:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("bs58"),s=t("buffer"),o="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function f(t){if(!(this instanceof f))return new f(t);if(r.isBuffer(t)){var e=t;this.fromBuffer(e)}else if("string"==typeof t){var n=t;this.fromString(n)}else t&&this.set(t)};a.validCharacters=function(t){return s.Buffer.isBuffer(t)&&(t=t.toString()),n.all(n.map(t,function(t){return n.contains(o,t)}))},a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.encode=function(t){if(!s.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return i.encode(t)},a.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return new r(i.decode(t))},a.prototype.fromBuffer=function(t){
+return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{bs58:273,buffer:48,lodash:297}],13:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./base58"),s=t("buffer"),o=t("../crypto/hash").sha256sha256,a=function f(t){if(!(this instanceof f))return new f(t);if(r.isBuffer(t)){var e=t;this.fromBuffer(e)}else if("string"==typeof t){var n=t;this.fromString(n)}else t&&this.set(t)};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.validChecksum=function(t,e){return n.isString(t)&&(t=new s.Buffer(i.decode(t))),n.isString(e)&&(e=new s.Buffer(i.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===e.toString("hex")},a.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=new r(i.decode(t));if(e.length<4)throw new Error("Input string too short");var n=e.slice(0,-4),s=e.slice(-4),a=o(n),f=a.slice(0,4);if(s.toString("hex")!==f.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(t){return o(t).slice(0,4)},a.encode=function(t){if(!r.isBuffer(t))throw new Error("Input must be a buffer");var e=new r(t.length+4),n=a.checksum(t);return t.copy(e),n.copy(e,t.length),i.encode(e)},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"./base58":12,buffer:48,lodash:297}],14:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../util/preconditions"),s=t("../util/buffer"),o=t("../crypto/bn"),a=function f(t){if(!(this instanceof f))return new f(t);if(!n.isUndefined(t))if(r.isBuffer(t))this.set({buf:t});else if(n.isString(t))this.set({buf:new r(t,"hex")});else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BufferReader");var e=t;this.set(e)}};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(t){i.checkArgument(!n.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},a.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},a.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},a.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=o.fromBuffer(t);return this.pos=this.pos+8,e},a.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=this.buf.readUInt32LE(this.pos+4),n=4294967296*r+e;if(9007199254740991>=n)t=new o(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new o(i,10,"le")}return this.pos=this.pos+8,t},a.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN(),r=e.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},a.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return i.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},a.prototype.readVarintBuf=function(){var t=this.buf.readUInt8(this.pos);switch(t){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(t)}},a.prototype.reverse=function(){for(var t=new r(this.buf.length),e=0;et?(e=new r(1),e.writeUInt8(t,0)):65536>t?(e=new r(3),e.writeUInt8(253,0),e.writeUInt16LE(t,1)):4294967296>t?(e=new r(5),e.writeUInt8(254,0),e.writeUInt32LE(t,1)):(e=new r(9),e.writeUInt8(255,0),e.writeInt32LE(-1&t,1),e.writeUInt32LE(Math.floor(t/4294967296),5)),e},s.varintBufBN=function(t){var e=void 0,n=t.toNumber();if(253>n)e=new r(1),e.writeUInt8(n,0);else if(65536>n)e=new r(3),e.writeUInt8(253,0),e.writeUInt16LE(n,1);else if(4294967296>n)e=new r(5),e.writeUInt8(254,0),e.writeUInt32LE(n,1);else{var i=new s;i.writeUInt8(255),i.writeUInt64LEBN(t);var e=i.concat()}return e},e.exports=s}).call(this,t("buffer").Buffer)},{"../util/buffer":43,assert:46,buffer:48}],16:[function(t,e,r){(function(r){"use strict";var n=t("./bufferwriter"),i=t("./bufferreader"),s=t("../crypto/bn"),o=function a(t){if(!(this instanceof a))return new a(t);if(r.isBuffer(t))this.buf=t;else if("number"==typeof t){var e=t;this.fromNumber(e)}else if(t instanceof s){var n=t;this.fromBN(n)}else if(t){var i=t;this.set(i)}};o.prototype.set=function(t){return this.buf=t.buf||this.buf,this},o.prototype.fromString=function(t){return this.set({buf:new r(t,"hex")}),this},o.prototype.toString=function(){return this.buf.toString("hex")},o.prototype.fromBuffer=function(t){return this.buf=t,this},o.prototype.fromBufferReader=function(t){return this.buf=t.readVarintBuf(),this},o.prototype.fromBN=function(t){return this.buf=n().writeVarintBN(t).concat(),this},o.prototype.fromNumber=function(t){return this.buf=n().writeVarintNum(t).concat(),this},o.prototype.toBuffer=function(){return this.buf},o.prototype.toBN=function(){return i(this.buf).readVarintBN()},o.prototype.toNumber=function(){return i(this.buf).readVarintNum()},e.exports=o}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"./bufferreader":14,"./bufferwriter":15,buffer:48}],17:[function(t,e,r){"use strict";function n(t,e){return t.replace("{0}",e[0]).replace("{1}",e[1]).replace("{2}",e[2])}var i=t("lodash"),s=function(t,e){var r=function(){if(i.isString(e.message))this.message=n(e.message,arguments);else{if(!i.isFunction(e.message))throw new Error("Invalid error definition for "+e.name);this.message=e.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return r.prototype=Object.create(t.prototype),r.prototype.name=t.prototype.name+e.name,t[e.name]=r,e.errors&&o(r,e.errors),r},o=function(t,e){i.each(e,function(e){s(t,e)})},a=function(t,e){return o(t,e),t},f={};f.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},f.Error.prototype=Object.create(Error.prototype),f.Error.prototype.name="bitcore.Error";var u=t("./spec");a(f.Error,u),e.exports=f.Error,e.exports.extend=function(t){return s(f.Error,t)}},{"./spec":18,lodash:297}],18:[function(t,e,r){"use strict";var n="http://bitcore.io/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+n+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},{}],19:[function(t,e,r){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(t,e,r){r=!!r;var n=t+"/"+e+"/"+r;return this._cache[n]?(this._cacheHit(n),this._cache[n]):void 0},set:function(t,e,r,n){r=!!r;var i=t+"/"+e+"/"+r;this._cache[i]=n,this._cacheHit(i)},_cacheHit:function(t){this._usedIndex[t]&&delete this._usedList[this._usedIndex[t]],this._usedList[this._count]=t,this._usedIndex[t]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex=0&&t=n.Hardened?!0:e,tI*S)throw new y.InvalidEntropyArgument.TooMuchEntropy(t);var i=h.sha512hmac(t,new s.Buffer("Bitcoin seed"));return new n({network:d.get(e)||d.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},n.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=t("./hdpublickey");this._hdPublicKey=new e(this)}},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),_.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,v.emptyBuffer(1),t.privateKey],i=s.Buffer.concat(e);if(t.checksum&&t.checksum.length){if(t.checksum.toString()!==c.checksum(i).toString())throw new m.InvalidB58Checksum(i)}else t.checksum=c.checksum(i);var o,a=d.get(v.integerFromBuffer(t.version));o=c.encode(s.Buffer.concat(e)),t.xprivkey=new r(o);var u=new b(f.fromBuffer(t.privateKey),a),p=u.toPublicKey(),l=n.ParentFingerPrintSize,g=h.sha256ripemd160(p.toBuffer()).slice(0,l);return _.defineImmutable(this,{xprivkey:o,network:a,depth:v.integerFromSingleByteBuffer(t.depth),privateKey:u,publicKey:p,fingerPrint:g}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];i(v.isBuffer(n),e+" argument is not a buffer"),i(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("privateKey",n.PrivateKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.prototype.toString=function(){return this.xprivkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(v.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:v.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},n.fromBuffer=function(t){return new n(t.toString())},n.prototype.toBuffer=function(){return v.copy(this._buffers.xprivkey)},n.DefaultDepth=0,n.DefaultFingerprint=0,n.DefaultChildIndex=0,n.Hardened=2147483648,n.MaxIndex=2*n.Hardened,n.RootElementAlias=["m","M","m'","M'"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PrivateKeySize=32,n.CheckSumSize=4,n.DataLength=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PrivateKeyStart=n.ChainCodeEnd+1,n.PrivateKeyEnd=n.PrivateKeyStart+n.PrivateKeySize,n.ChecksumStart=n.PrivateKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,i(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./crypto/random":10,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdkeycache":19,"./hdpublickey":21,"./networks":22,"./privatekey":24,"./util/buffer":43,"./util/js":44,"./util/preconditions":45,assert:46,buffer:48,lodash:297}],21:[function(t,e,r){(function(r){"use strict";function n(t){if(t instanceof n)return t;if(!(this instanceof n))return new n(t);if(t){if(i.isString(t)||_.isBuffer(t)){var e=n.getSerializedError(t);if(e){if(_.isBuffer(t)&&!n.getSerializedError(t.toString()))return this._buildFromSerialized(t.toString());if(e instanceof m.ArgumentIsPrivateExtended)return new c(t).hdPublicKey;throw e}return this._buildFromSerialized(t)}if(i.isObject(t))return t instanceof c?this._buildFromPrivate(t):this._buildFromObject(t);throw new m.UnrecognizedArgument(t)}throw new m.MustSupplyArgument}var i=t("lodash"),s=t("./util/preconditions"),o=t("./crypto/bn"),a=t("./encoding/base58"),f=t("./encoding/base58check"),u=t("./crypto/hash"),c=t("./hdprivatekey"),h=t("./hdkeycache"),d=t("./networks"),p=t("./crypto/point"),l=t("./publickey"),b=t("./errors"),g=b,m=b.HDPublicKey,y=t("assert"),v=t("./util/js"),_=t("./util/buffer");n.isValidPath=function(t){if(i.isString(t)){var e=c._getDerivationIndexes(t);return null!==e&&i.all(e,n.isValidPath)}return i.isNumber(t)?t>=0&&t=n.Hardened||e)throw new m.InvalidIndexCantDeriveHardened;if(0>t)throw new m.InvalidPath(t);var r=h.get(this.xpubkey,t,!1);if(r)return r;var i=_.integerAsBuffer(t),s=_.concat([this.publicKey.toBuffer(),i]),a=u.sha512hmac(s,this._buffers.chainCode),f=o.fromBuffer(a.slice(0,32),{size:32}),c=a.slice(32,64),d=l.fromPoint(p.getG().mul(f).add(this.publicKey.point)),b=new n({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:c,publicKey:d});return h.set(this.xpubkey,t,!1,b),b},n.prototype._deriveFromString=function(t){if(i.contains(t,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!n.isValidPath(t))throw new m.InvalidPath(t);var e=c._getDerivationIndexes(t),r=e.reduce(function(t,e){return t._deriveWithNumber(e)},this);return r},n.isValidSerialized=function(t,e){return i.isNull(n.getSerializedError(t,e))},n.getSerializedError=function(t,e){if(!i.isString(t)&&!_.isBuffer(t))return new m.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(t))return new g.InvalidB58Char("(unknown)",t);try{t=f.decode(t)}catch(r){return new g.InvalidB58Checksum(t)}if(t.length!==n.DataSize)return new m.InvalidLength(t);if(!i.isUndefined(e)){var s=n._validateNetwork(t,e);if(s)return s}var o=_.integerFromBuffer(t.slice(0,4));return o===d.livenet.xprivkey||o===d.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},n._validateNetwork=function(t,e){var r=d.get(e);if(!r)return new g.InvalidNetworkArgument(e);var i=t.slice(n.VersionStart,n.VersionEnd);return _.integerFromBuffer(i)!==r.xpubkey?new g.InvalidNetwork(i):null},n.prototype._buildFromPrivate=function(t){var e=i.clone(t._buffers),r=p.getG().mul(o.fromBuffer(e.privateKey));return e.publicKey=p.pointToCompressed(r),e.version=_.integerAsBuffer(d.get(_.integerFromBuffer(e.version)).xpubkey),e.privateKey=void 0,e.checksum=void 0,e.xprivkey=void 0,this._buildFromBuffers(e)},n.prototype._buildFromObject=function(t){var e={version:t.network?_.integerAsBuffer(d.get(t.network).xpubkey):t.version,depth:i.isNumber(t.depth)?_.integerAsSingleByteBuffer(t.depth):t.depth,parentFingerPrint:i.isNumber(t.parentFingerPrint)?_.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:i.isNumber(t.childIndex)?_.integerAsBuffer(t.childIndex):t.childIndex,chainCode:i.isString(t.chainCode)?_.hexToBuffer(t.chainCode):t.chainCode,publicKey:i.isString(t.publicKey)?_.hexToBuffer(t.publicKey):_.isBuffer(t.publicKey)?t.publicKey:t.publicKey.toBuffer(),checksum:i.isNumber(t.checksum)?_.integerAsBuffer(t.checksum):t.checksum};return this._buildFromBuffers(e)},n.prototype._buildFromSerialized=function(t){var e=f.decode(t),r={version:e.slice(n.VersionStart,n.VersionEnd),depth:e.slice(n.DepthStart,n.DepthEnd),parentFingerPrint:e.slice(n.ParentFingerPrintStart,n.ParentFingerPrintEnd),childIndex:e.slice(n.ChildIndexStart,n.ChildIndexEnd),chainCode:e.slice(n.ChainCodeStart,n.ChainCodeEnd),publicKey:e.slice(n.PublicKeyStart,n.PublicKeyEnd),checksum:e.slice(n.ChecksumStart,n.ChecksumEnd),xpubkey:t};return this._buildFromBuffers(r)},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),v.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,t.publicKey],i=_.concat(e),s=f.checksum(i);if(t.checksum&&t.checksum.length){if(t.checksum.toString("hex")!==s.toString("hex"))throw new g.InvalidB58Checksum(i,s)}else t.checksum=s;var o,a=d.get(_.integerFromBuffer(t.version));o=f.encode(_.concat(e)),t.xpubkey=new r(o);var c=new l(t.publicKey,{network:a}),h=n.ParentFingerPrintSize,p=u.sha256ripemd160(c.toBuffer()).slice(0,h);return v.defineImmutable(this,{xpubkey:o,network:a,depth:_.integerFromSingleByteBuffer(t.depth),publicKey:c,fingerPrint:p}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];y(_.isBuffer(n),e+" argument is not a buffer, it's "+typeof n),y(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("publicKey",n.PublicKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.fromString=function(t){return s.checkArgument(i.isString(t),"No valid string was provided"),new n(t)},n.fromObject=function(t){return s.checkArgument(i.isObject(t),"No valid argument was provided"),new n(t)},n.prototype.toString=function(){return this.xpubkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(_.integerFromBuffer(this._buffers.version)).name,depth:_.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:_.integerFromBuffer(this.fingerPrint),parentFingerPrint:_.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:_.integerFromBuffer(this._buffers.childIndex),chainCode:_.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:_.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},n.fromBuffer=function(t){return new n(t)},n.prototype.toBuffer=function(){return _.copy(this._buffers.xpubkey)},n.Hardened=2147483648,n.RootElementAlias=["m","M"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PublicKeySize=33,n.CheckSumSize=4,n.DataSize=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PublicKeyStart=n.ChainCodeEnd,n.PublicKeyEnd=n.PublicKeyStart+n.PublicKeySize,n.ChecksumStart=n.PublicKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,y(n.PublicKeyEnd===n.DataSize),y(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdkeycache":19,"./hdprivatekey":20,"./networks":22,"./publickey":25,"./util/buffer":43,"./util/js":44,"./util/preconditions":45,assert:46,buffer:48,lodash:297}],22:[function(t,e,r){"use strict";function n(){}function i(t,e){if(~d.indexOf(t))return t;{if(!e)return p[t];u.isArray(e)||(e=[e]);var r=function(e){return d[n][e]===t};for(var n in d)if(u.any(e,r))return d[n]}}function s(t){var e=new n;return h.defineImmutable(e,{name:t.name,alias:t.alias,pubkeyhash:t.pubkeyhash,privatekey:t.privatekey,scripthash:t.scripthash,xpubkey:t.xpubkey,xprivkey:t.xprivkey}),t.networkMagic&&h.defineImmutable(e,{networkMagic:c.integerAsBuffer(t.networkMagic)}),t.port&&h.defineImmutable(e,{port:t.port}),t.dnsSeeds&&h.defineImmutable(e,{dnsSeeds:t.dnsSeeds}),u.each(e,function(t){u.isUndefined(t)||u.isObject(t)||(p[t]=e)}),d.push(e),e}function o(t){for(var e=0;e=0&&16>=t,"Invalid Argument: n must be between 0 and 16"),0===t?n("OP_0"):new n(n.map.OP_1+t-1)},n.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},n.reverseMap=[];for(var f in n.map)n.reverseMap[n.map[f]]=f;i.extend(n,n.map),n.isSmallIntOp=function(t){return t instanceof n&&(t=t.toNumber()),t===n.map.OP_0||t>=n.map.OP_1&&t<=n.map.OP_16},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./util/buffer":43,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],24:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(t instanceof n)return t;var r=this._classifyArguments(t,e);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if("undefined"==typeof r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return f.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var i=t("lodash"),s=t("./address"),o=t("./encoding/base58check"),a=t("./crypto/bn"),f=t("./util/js"),u=t("./networks"),c=t("./crypto/point"),h=t("./publickey"),d=t("./crypto/random"),p=t("./util/preconditions");n.prototype._classifyArguments=function(t,e){var s={compressed:!0,network:e?u.get(e):u.defaultNetwork};if(i.isUndefined(t)||i.isNull(t))s.bn=n._getRandomBN();else if(t instanceof a)s.bn=t;else if(t instanceof r||t instanceof Uint8Array)s=n._transformBuffer(t,e);else if(t.bn&&t.network)s=n._transformObject(t);else if(!e&&u.get(t))s.bn=n._getRandomBN(),s.network=u.get(t);else{if("string"!=typeof t)throw new TypeError("First argument is an unrecognized data type.");f.isHexa(t)?s.bn=new a(new r(t,"hex")):s=n._transformWIF(t,e)}return s},n._getRandomBN=function(){var t,e;do{var r=d.getRandomBuffer(32);e=a.fromBuffer(r),t=e.lt(c.getN())}while(!t);return e},n._transformBuffer=function(t,e){var r={};if(32===t.length)return n._transformBNBuffer(t,e);if(r.network=u.get(t[0],"privatekey"),!r.network)throw new Error("Invalid network");if(e&&r.network!==u.get(e))throw new TypeError("Private key network mismatch");if(34===t.length&&1===t[33])r.compressed=!0;else{if(33!==t.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(t.slice(1,33)),r},n._transformBNBuffer=function(t,e){var r={};return r.network=u.get(e)||u.defaultNetwork,r.bn=a.fromBuffer(t),r.compressed=!1,r},n._transformWIF=function(t,e){return n._transformBuffer(o.decode(t),e)},n.fromBuffer=function(t,e){return new n(t,e)},n._transformObject=function(t){var e=new a(t.bn,"hex"),r=u.get(t.network);return{bn:e,network:r,compressed:t.compressed}},n.fromString=n.fromWIF=function(t){return p.checkArgument(i.isString(t),"First argument is expected to be a string."),new n(t)},n.fromObject=function(t){return p.checkArgument(i.isObject(t),"First argument is expected to be an object."),new n(t)},n.fromRandom=function(t){var e=n._getRandomBN();return new n(e,t)},n.getValidationError=function(t,e){var r;try{new n(t,e)}catch(i){r=i}return r},n.isValid=function(t,e){return t?!n.getValidationError(t,e):!1},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toWIF=function(){var t,e=this.network,n=this.compressed;return t=n?r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32}),new r([1])]):r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(t)},n.prototype.toBigNumber=function(){return this.bn},n.prototype.toBuffer=function(){return this.bn.toBuffer()},n.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},n.prototype.toAddress=function(t){var e=this.toPublicKey();return s.fromPublicKey(e,t||this.network)},n.prototype.toObject=n.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},n.prototype.inspect=function(){var t=this.compressed?"":", uncompressed";return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/point":9,"./crypto/random":10,"./encoding/base58check":13,"./networks":22,"./publickey":25,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],25:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(c.checkArgument(t,"First argument is required, please include public key data."),t instanceof n)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||f.defaultNetwork}),this}var i=t("./crypto/bn"),s=t("./crypto/point"),o=t("./crypto/hash"),a=t("./util/js"),f=t("./networks"),u=t("lodash"),c=t("./util/preconditions");n.prototype._classifyArgs=function(t,e){var i={compressed:u.isUndefined(e.compressed)||e.compressed};if(t instanceof s)i.point=t;else if(t.x&&t.y)i=n._transformObject(t);else if("string"==typeof t)i=n._transformDER(new r(t,"hex"));else if(n._isBuffer(t))i=n._transformDER(t);else{if(!n._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");i=n._transformPrivateKey(t)}return i.network||(i.network=u.isUndefined(e.network)?void 0:f.get(e.network)),i},n._isPrivateKey=function(e){var r=t("./privatekey");return e instanceof r},n._isBuffer=function(t){return t instanceof r||t instanceof Uint8Array},n._transformPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=s.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},n._transformDER=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r={};e=u.isUndefined(e)?!0:e;var o,a,f,h;if(4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])f=t.slice(1),o=new i(f),r=n._transformX(!0,o),r.compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");f=t.slice(1),o=new i(f),r=n._transformX(!1,o),r.compressed=!0}else{if(f=t.slice(1,33),h=t.slice(33,65),32!==f.length||32!==h.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");o=new i(f),a=new i(h),r.point=new s(o,a),r.compressed=!1}return r},n._transformX=function(t,e){c.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=s.fromX(t,e),r},n._transformObject=function(t){var e=new i(t.x,"hex"),r=new i(t.y,"hex"),o=new s(e,r);return new n(o,{compressed:t.compressed})},n.fromPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e=n._transformPrivateKey(t);return new n(e.point,{compressed:e.compressed,network:e.network})},n.fromDER=n.fromBuffer=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r=n._transformDER(t,e);return new n(r.point,{compressed:r.compressed})},n.fromPoint=function(t,e){return c.checkArgument(t instanceof s,"First argument must be an instance of Point."),new n(t,{compressed:e})},n.fromString=function(t,e){var i=new r(t,e||"hex"),s=n._transformDER(i);return new n(s.point,{compressed:s.compressed})},n.fromX=function(t,e){var r=n._transformX(t,e);return new n(r.point,{compressed:r.compressed})},n.getValidationError=function(t){var e;try{new n(t)}catch(r){e=r}return e},n.isValid=function(t){return!n.getValidationError(t)},n.prototype.toObject=n.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},n.prototype.toBuffer=n.prototype.toDER=function(){var t,e=this.point.getX(),n=this.point.getY(),i=e.toBuffer({size:32}),s=n.toBuffer({size:32});if(this.compressed){var o=s[s.length-1]%2;return t=new r(o?[3]:[2]),r.concat([t,i])}return t=new r([4]),r.concat([t,i,s])},n.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},n.prototype.toAddress=function(e){var r=t("./address");return r.fromPublicKey(this,e||this.network)},n.prototype.toString=function(){return this.toDER().toString("hex")},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./networks":22,"./privatekey":24,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],26:[function(t,e,r){e.exports=t("./script"),e.exports.Interpreter=t("./interpreter")},{"./interpreter":27,"./script":28}],27:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./script"),s=t("../opcode"),o=t("../crypto/bn"),a=t("../crypto/hash"),f=t("../crypto/signature"),u=t("../publickey"),c=function h(t){return this instanceof h?void(t?(this.initialize(),this.set(t)):this.initialize()):new h(t)};c.prototype.verify=function(e,r,s,o,a){var f=t("../transaction");n.isUndefined(s)&&(s=new f),n.isUndefined(o)&&(o=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:s,nin:o,flags:a});var u;if(0!==(a&c.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&c.SCRIPT_VERIFY_P2SH&&(u=this.stack.slice());var h=this.stack;if(this.initialize(),this.set({script:r,stack:h,tx:s,nin:o,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var d=this.stack[this.stack.length-1];if(!c.castToBool(d))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&c.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===u.length)throw new Error("internal error - stack copy empty");var p=u[u.length-1],l=i.fromBuffer(p);return u.pop(),this.initialize(),this.set({script:l,stack:u,tx:s,nin:o,flags:a}),this.evaluate()?0===u.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):c.castToBool(u[u.length-1])?!0:(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1):!1}return!0},e.exports=c,c.prototype.initialize=function(t){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},c.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin="undefined"!=typeof t.nin?t.nin:this.nin,this.stack=t.stack||this.stack,this.altstack=t.altack||this.altstack,this.pc="undefined"!=typeof t.pc?t.pc:this.pc,this.pbegincodehash="undefined"!=typeof t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount="undefined"!=typeof t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags="undefined"!=typeof t.flags?t.flags:this.flags},c["true"]=new r([1]),c["false"]=new r([]),c.MAX_SCRIPT_ELEMENT_SIZE=520,c.LOCKTIME_THRESHOLD=5e8,c.LOCKTIME_THRESHOLD_BN=new o(c.LOCKTIME_THRESHOLD),c.SCRIPT_VERIFY_NONE=0,c.SCRIPT_VERIFY_P2SH=1,c.SCRIPT_VERIFY_STRICTENC=2,c.SCRIPT_VERIFY_DERSIG=4,c.SCRIPT_VERIFY_LOW_S=8,c.SCRIPT_VERIFY_NULLDUMMY=16,c.SCRIPT_VERIFY_SIGPUSHONLY=32,c.SCRIPT_VERIFY_MINIMALDATA=64,c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,c.castToBool=function(t){for(var e=0;e1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return this.vfExec.length>0?(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1):!0},c.prototype.checkLockTime=function(t){return this.tx.nLockTime=c.LOCKTIME_THRESHOLD&&t.gte(c.LOCKTIME_THRESHOLD_BN)?t.gt(new o(this.tx.nLockTime))?!1:this.tx.inputs[this.nin].isFinal()?!0:!1:!1},c.prototype.step=function(){var t,e,r,h,d,p,l,b,g,m,y,v,_,w,S,I,k,E=0!==(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),A=-1===this.vfExec.indexOf(!1),x=this.script.chunks[this.pc];this.pc++;var P=x.opcodenum;if(n.isUndefined(P))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(x.buf&&x.buf.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(P>s.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(P===s.OP_CAT||P===s.OP_SUBSTR||P===s.OP_LEFT||P===s.OP_RIGHT||P===s.OP_INVERT||P===s.OP_AND||P===s.OP_OR||P===s.OP_XOR||P===s.OP_2MUL||P===s.OP_2DIV||P===s.OP_MUL||P===s.OP_DIV||P===s.OP_MOD||P===s.OP_LSHIFT||P===s.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(A&&P>=0&&P<=s.OP_PUSHDATA4){if(E&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(x.buf){if(x.len!==x.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(x.buf)}else this.stack.push(c["false"])}else if(A||s.OP_IF<=P&&P<=s.OP_ENDIF)switch(P){case s.OP_1NEGATE:case s.OP_1:case s.OP_2:case s.OP_3:case s.OP_4:case s.OP_5:case s.OP_6:case s.OP_7:case s.OP_8:case s.OP_9:case s.OP_10:case s.OP_11:case s.OP_12:case s.OP_13:case s.OP_14:case s.OP_15:case s.OP_16:d=P-(s.OP_1-1),t=new o(d).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_NOP:break;case s.OP_NOP2:case s.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var O=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E,5);if(O.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(O))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP1:case s.OP_NOP3:case s.OP_NOP4:case s.OP_NOP5:case s.OP_NOP6:case s.OP_NOP7:case s.OP_NOP8:case s.OP_NOP9:case s.OP_NOP10:if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case s.OP_IF:case s.OP_NOTIF:if(I=!1,A){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;t=this.stack.pop(),I=c.castToBool(t),P===s.OP_NOTIF&&(I=!I)}this.vfExec.push(I);break;case s.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case s.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case s.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],I=c.castToBool(t),!I)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case s.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case s.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case s.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case s.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case s.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],this.stack.push(e),this.stack.push(r);break;case s.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-3],r=this.stack[this.stack.length-2];var B=this.stack[this.stack.length-1];this.stack.push(e),this.stack.push(r),this.stack.push(B);break;case s.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-4],r=this.stack[this.stack.length-3],this.stack.push(e),this.stack.push(r);break;case s.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-6,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-4,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1],I=c.castToBool(t),I&&this.stack.push(t);break;case s.OP_DEPTH:t=new o(this.stack.length).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case s.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case s.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case s.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case s.OP_PICK:case s.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,E),d=b.toNumber(),this.stack.pop(),0>d||d>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-d-1],P===s.OP_ROLL&&this.stack.splice(this.stack.length-d-1,1),this.stack.push(t);break;case s.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-3],l=this.stack[this.stack.length-2];var M=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=l,this.stack[this.stack.length-2]=M,this.stack[this.stack.length-1]=p;break;case s.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=l,this.stack[this.stack.length-1]=p;break;case s.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case s.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=new o(this.stack[this.stack.length-1].length),this.stack.push(b.toScriptNumBuffer());break;case s.OP_EQUAL:case s.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];var R=e.toString("hex")===r.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(R?c["true"]:c["false"]),P===s.OP_EQUALVERIFY){if(!R)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case s.OP_1ADD:case s.OP_1SUB:case s.OP_NEGATE:case s.OP_ABS:case s.OP_NOT:case s.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,E),P){case s.OP_1ADD:b=b.add(o.One);break;case s.OP_1SUB:b=b.sub(o.One);break;case s.OP_NEGATE:b=b.neg();break;case s.OP_ABS:b.cmp(o.Zero)<0&&(b=b.neg());break;case s.OP_NOT:b=new o((0===b.cmp(o.Zero))+0);break;case s.OP_0NOTEQUAL:b=new o((0!==b.cmp(o.Zero))+0)}this.stack.pop(),this.stack.push(b.toScriptNumBuffer());break;case s.OP_ADD:case s.OP_SUB:case s.OP_BOOLAND:case s.OP_BOOLOR:case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:case s.OP_NUMNOTEQUAL:case s.OP_LESSTHAN:case s.OP_GREATERTHAN:case s.OP_LESSTHANOREQUAL:case s.OP_GREATERTHANOREQUAL:case s.OP_MIN:case s.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(g=o.fromScriptNumBuffer(this.stack[this.stack.length-2],E),m=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E),b=new o(0),P){case s.OP_ADD:b=g.add(m);break;case s.OP_SUB:b=g.sub(m);break;case s.OP_BOOLAND:b=new o((0!==g.cmp(o.Zero)&&0!==m.cmp(o.Zero))+0);break;case s.OP_BOOLOR:b=new o((0!==g.cmp(o.Zero)||0!==m.cmp(o.Zero))+0);break;case s.OP_NUMEQUAL:b=new o((0===g.cmp(m))+0);break;case s.OP_NUMEQUALVERIFY:b=new o((0===g.cmp(m))+0);break;case s.OP_NUMNOTEQUAL:b=new o((0!==g.cmp(m))+0);break;case s.OP_LESSTHAN:b=new o((g.cmp(m)<0)+0);break;case s.OP_GREATERTHAN:b=new o((g.cmp(m)>0)+0);break;case s.OP_LESSTHANOREQUAL:b=new o((g.cmp(m)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:b=new o((g.cmp(m)>=0)+0);break;case s.OP_MIN:b=g.cmp(m)<0?g:m;break;case s.OP_MAX:b=g.cmp(m)>0?g:m}if(this.stack.pop(),this.stack.pop(),this.stack.push(b.toScriptNumBuffer()),P===s.OP_NUMEQUALVERIFY){if(!c.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case s.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=o.fromScriptNumBuffer(this.stack[this.stack.length-3],E),m=o.fromScriptNumBuffer(this.stack[this.stack.length-2],E);var T=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E);I=m.cmp(g)<=0&&g.cmp(T)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(I?c["true"]:c["false"]);break;case s.OP_RIPEMD160:case s.OP_SHA1:case s.OP_SHA256:case s.OP_HASH160:case s.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1];var C;P===s.OP_RIPEMD160?C=a.ripemd160(t):P===s.OP_SHA1?C=a.sha1(t):P===s.OP_SHA256?C=a.sha256(t):P===s.OP_HASH160?C=a.sha256ripemd160(t):P===s.OP_HASH256&&(C=a.sha256sha256(t)),this.stack.pop(),this.stack.push(C);break;case s.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case s.OP_CHECKSIG:case s.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-2],v=this.stack[this.stack.length-1],_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var N=(new i).add(y);if(_.findAndDelete(N),!this.checkSignatureEncoding(y)||!this.checkPubkeyEncoding(v))return!1;try{w=f.fromTxFormat(y),S=u.fromBuffer(v,!1),k=this.tx.verifySignature(w,S,this.nin,_)}catch(j){k=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(k?c["true"]:c["false"]),P===s.OP_CHECKSIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case s.OP_CHECKMULTISIG:case s.OP_CHECKMULTISIGVERIFY:var U=1;if(this.stack.lengthL||L>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=L,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var D=++U;if(U+=L,this.stack.lengthz||z>L)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var F=++U;if(U+=z,this.stack.lengthK;K++)y=this.stack[this.stack.length-F-K],_.findAndDelete((new i).add(y));for(k=!0;k&&z>0;){if(y=this.stack[this.stack.length-F],v=this.stack[this.stack.length-D],!this.checkSignatureEncoding(y)||!this.checkPubkeyEncoding(v))return!1;var H;try{w=f.fromTxFormat(y),S=u.fromBuffer(v,!1),H=this.tx.verifySignature(w,S,this.nin,_)}catch(j){H=!1}H&&(F++,z--),D++,L--,z>L&&(k=!1)}for(;U-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&c.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(k?c["true"]:c["false"]),P===s.OP_CHECKMULTISIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../opcode":23,"../publickey":25,"../transaction":29,"./script":28,buffer:48,lodash:297}],28:[function(t,e,r){(function(r){"use strict";var n=t("../address"),i=t("../encoding/bufferreader"),s=t("../encoding/bufferwriter"),o=t("../crypto/hash"),a=t("../opcode"),f=t("../publickey"),u=t("../crypto/signature"),c=t("../networks"),h=t("../util/preconditions"),d=t("lodash"),p=t("../errors"),l=t("buffer"),b=t("../util/buffer"),g=t("../util/js"),m=function y(t){return this instanceof y?(this.chunks=[],b.isBuffer(t)?y.fromBuffer(t):t instanceof n?y.fromAddress(t):t instanceof y?y.fromBuffer(t.toBuffer()):"string"==typeof t?y.fromString(t):void("undefined"!=typeof t&&this.set(t))):new y(t)};m.prototype.set=function(t){return this.chunks=t.chunks||this.chunks,this},m.fromBuffer=function(t){var e=new m;e.chunks=[];for(var r=new i(t);!r.finished();)try{var n,s,o=r.readUInt8();o>0&&o0&&f0&&(i=n?i+" "+t.buf.toString("hex"):i+" "+t.len+" 0x"+t.buf.toString("hex"));else if("undefined"!=typeof a.reverseMap[r])i=i+" "+a(r).toString();else{
+var s=r.toString(16);s.length%2!==0&&(s="0"+s),i=n?i+" "+s:i+" 0x"+s}return i},m.prototype.toASM=function(){for(var t="",e=0;e"},m.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},m.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},m.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},m.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},m.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if(4!==e&&6!==e&&7!==e||65!==t.length?3!==e&&2!==e||33!==t.length||(r=!0):r=!0,r)return f.isValid(t)}return!1},m.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},m.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===a.OP_HASH160&&20===t[1]&&t[t.length-1]===a.OP_EQUAL},m.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t=this.chunks[this.chunks.length-1],e=t.buf;if(!e)return!1;var r;try{r=m.fromBuffer(e)}catch(n){if(n instanceof p.Script.InvalidBuffer)return!1;throw n}var i=r.classify();return i!==m.types.UNKNOWN},m.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(t){return t.buf&&b.isBuffer(t.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},m.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(t){return t.buf&&b.isBuffer(t.buf)&&u.isTxDER(t.buf)})},m.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=m.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},m.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new r(d.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new r(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},m.prototype.isPushOnly=function(){return d.every(this.chunks,function(t){return t.opcodenum<=a.OP_16})},m.types={},m.types.UNKNOWN="Unknown",m.types.PUBKEY_OUT="Pay to public key",m.types.PUBKEY_IN="Spend from public key",m.types.PUBKEYHASH_OUT="Pay to public key hash",m.types.PUBKEYHASH_IN="Spend from public key hash",m.types.SCRIPTHASH_OUT="Pay to script hash",m.types.SCRIPTHASH_IN="Spend from script hash",m.types.MULTISIG_OUT="Pay to multisig",m.types.MULTISIG_IN="Spend from multisig",m.types.DATA_OUT="Data push",m.OP_RETURN_STANDARD_SIZE=80,m.identifiers={},m.identifiers.PUBKEY_OUT=m.prototype.isPublicKeyOut,m.identifiers.PUBKEY_IN=m.prototype.isPublicKeyIn,m.identifiers.PUBKEYHASH_OUT=m.prototype.isPublicKeyHashOut,m.identifiers.PUBKEYHASH_IN=m.prototype.isPublicKeyHashIn,m.identifiers.MULTISIG_OUT=m.prototype.isMultisigOut,m.identifiers.MULTISIG_IN=m.prototype.isMultisigIn,m.identifiers.SCRIPTHASH_OUT=m.prototype.isScriptHashOut,m.identifiers.SCRIPTHASH_IN=m.prototype.isScriptHashIn,m.identifiers.DATA_OUT=m.prototype.isDataOut,m.prototype.classify=function(){for(var t in m.identifiers)if(m.identifiers[t].bind(this)())return m.types[t];return m.types.UNKNOWN},m.prototype.isStandard=function(){return this.classify()!==m.types.UNKNOWN},m.prototype.prepend=function(t){return this._addByType(t,!0),this},m.prototype.equals=function(t){if(h.checkState(t instanceof m,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e=0&&n=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:r.length<=65535?n===a.OP_PUSHDATA2:!0:!0},m.prototype._decodeOP_N=function(t){if(t===a.OP_0)return 0;if(t>=a.OP_1&&t<=a.OP_16)return t-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},m.prototype.getSignatureOperationsCount=function(t){t=d.isUndefined(t)?!0:t;var e=this,r=0,n=a.OP_INVALIDOPCODE;return d.each(e.chunks,function(i){var s=i.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:(s==a.OP_CHECKMULTISIG||s==a.OP_CHECKMULTISIGVERIFY)&&(r+=t&&n>=a.OP_1&&n<=a.OP_16?e._decodeOP_N(n):20),n=s}),r},e.exports=m}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../networks":22,"../opcode":23,"../publickey":25,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,lodash:297}],29:[function(t,e,r){e.exports=t("./transaction"),e.exports.Input=t("./input"),e.exports.Output=t("./output"),e.exports.UnspentOutput=t("./unspentoutput"),e.exports.Signature=t("./signature"),e.exports.Sighash=t("./sighash")},{"./input":30,"./output":36,"./sighash":37,"./signature":38,"./transaction":39,"./unspentoutput":40}],30:[function(t,e,r){e.exports=t("./input"),e.exports.PublicKey=t("./publickey"),e.exports.PublicKeyHash=t("./publickeyhash"),e.exports.MultiSig=t("./multisig.js"),e.exports.MultiSigScriptHash=t("./multisigscripthash.js")},{"./input":31,"./multisig.js":32,"./multisigscripthash.js":33,"./publickey":34,"./publickeyhash":35}],31:[function(t,e,r){"use strict";function n(t){return this instanceof n?t?this._fromObject(t):void 0:new n(t)}var i=t("lodash"),s=t("../../util/preconditions"),o=t("../../errors"),a=t("../../encoding/bufferwriter"),f=t("buffer"),u=t("../../util/buffer"),c=t("../../util/js"),h=t("../../script"),d=t("../sighash"),p=t("../output"),l=4294967295,b=0;n.DEFAULT_SEQNUMBER=l,n.DEFAULT_LOCKTIME_SEQNUMBER=b,Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),n.fromObject=function(t){s.checkArgument(i.isObject(t));var e=new n;return e._fromObject(t)},n.prototype._fromObject=function(t){var e;if(e=i.isString(t.prevTxId)&&c.isHexa(t.prevTxId)?new f.Buffer(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof p?t.output:new p(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=i.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=i.isUndefined(t.sequenceNumber)?i.isUndefined(t.seqnum)?l:t.seqnum:t.sequenceNumber,i.isUndefined(t.script)&&i.isUndefined(t.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},n.prototype.toObject=n.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},n.fromBufferReader=function(t){var e=new n;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},n.prototype.toBufferWriter=function(t){t||(t=new a),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},n.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(c.isHexa(t))this._scriptBuffer=new f.Buffer(t,"hex");else if(i.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new f.Buffer(t)}return this},n.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},n.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},n.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},n.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},n.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,d.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script)},n.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},n.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=n},{"../../encoding/bufferwriter":15,"../../errors":17,"../../script":26,"../../util/buffer":43,"../../util/js":44,"../../util/preconditions":45,"../output":36,"../sighash":37,buffer:48,lodash:297}],32:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),f.checkState(u.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=(t("../transaction"),t("./input")),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),p=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){return t?new p(t):void 0})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){return t?t.toObject():void 0})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new p({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.output.script),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script)},n.normalizeSignatures=function(t,e,r,n,i){return i.map(function(i){var s=null;return n=n.filter(function(n){if(s)return!0;var o=new p({signature:c.fromTxFormat(n),publicKey:i,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:c.SIGHASH_ALL});o.signature.nhashtype=o.sigtype;var a=h.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script);return a?(s=o,!1):!0}),s?s:null})},n.OPCODES_SIZE=1,n.SIGNATURE_SIZE=73,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":25,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"../transaction":39,"./input":31,inherits:296,lodash:297}],33:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),f.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=t("./input"),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),p=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){return t?new p(t):void 0})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){return t?t.toObject():void 0})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new p({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.redeemScript),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript)},n.OPCODES_SIZE=7,n.SIGNATURE_SIZE=74,n.PUBKEY_SIZE=34,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE+this.publicKeys.length*n.PUBKEY_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":25,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296,lodash:297}],34:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=(t("../../util/buffer"),t("./input")),a=t("../output"),f=t("../sighash"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../signature");i(n,o),n.prototype.getSignatures=function(t,e,r,n){s.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var i=e.toPublicKey();return i.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:i,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:f.sign(t,e,n,r,this.output.script),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},n.SCRIPT_MAX_SIZE=73,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/signature":11,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296}],35:[function(t,e,r){"use strict";function n(){f.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=t("../../util/buffer"),a=t("../../crypto/hash"),f=t("./input"),u=t("../output"),c=t("../sighash"),h=t("../../script"),d=t("../../crypto/signature"),p=t("../signature");i(n,f),n.prototype.getSignatures=function(t,e,r,n,i){return s.checkState(this.output instanceof u),i=i||a.sha256ripemd160(e.publicKey.toBuffer()),n=n||d.SIGHASH_ALL,o.equals(i,this.output.script.getPublicKeyHash())?[new p({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(t,e,n,r,this.output.script),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(h.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(h.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},n.SCRIPT_MAX_SIZE=107,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/hash":8,"../../crypto/signature":11,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296}],36:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(!i.isObject(t))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=t.satoshis,a.isBuffer(t.script))this._scriptBuffer=t.script;else{var e;e=i.isString(t.script)&&f.isHexa(t.script)?new o.Buffer(t.script,"hex"):t.script,this.setScript(e)}}var i=t("lodash"),s=t("../crypto/bn"),o=t("buffer"),a=t("../util/buffer"),f=t("../util/js"),u=t("../encoding/bufferwriter"),c=t("../script"),h=t("../util/preconditions"),d=t("../errors"),p=9007199254740991;Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(n.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(t){t instanceof s?(this._satoshisBN=t,this._satoshis=t.toNumber()):i.isString(t)?(this._satoshis=parseInt(t),this._satoshisBN=s.fromNumber(this._satoshis)):(h.checkArgument(f.isNaturalNumber(t),"Output satoshis is not a natural number"),this._satoshisBN=s.fromNumber(t),this._satoshis=t),h.checkState(f.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.prototype.invalidSatoshis=function(){return this._satoshis>p?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0?"transaction txout negative":!1},n.prototype.toObject=n.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},n.fromObject=function(t){return new n(t)},n.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof d.Script.InvalidBuffer))throw e;this._script=null}},n.prototype.setScript=function(t){if(t instanceof c)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(i.isString(t))this._script=c.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!a.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},n.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"